# -*- coding:utf-8 -*-
class Queue():
#初始化队列
def __init__(self,size):
self.queue=[]
self.size=size
self.tail=0
#判断队列是否为满,为满返回True
def Full(self):
if self.tail==self.size:
return True
else:
return False
#判断队列是否为空,为空返回True
def Empty(self):
if self.tail==0:
return True
else:
return False
#进队
def queuein(self,content):
if self.Full():
print 'The queue is full!'
else:
self.queue.append(content)
self.tail+=1
#出队
def queueout(self):
if self.Empty():
print 'The queue is empty!'
return None
else:
content=self.queue[0]
self.queue.pop(0)
self.tail-=1
return content
#遍历队列
def queueall(self):
if self.Empty():
print 'The queue is empty!'
else:
for i in range(0,self.tail):
print self.queue[i]