org.tinygroup.queue.impl
Class QueueImpl<E>

java.lang.Object
  extended by org.tinygroup.queue.impl.QueueImpl<E>
All Implemented Interfaces:
Queue<E>, QueueMonitor

public class QueueImpl<E>
extends Object
implements Queue<E>

Created by IntelliJ IDEA. User: luoguo Date: 11-3-30 Time: 下午1:37 To change this template use File | Settings | File Templates.


Field Summary
 
Fields inherited from interface org.tinygroup.queue.Queue
DEFAULT_QUEUE_SIZE
 
Constructor Summary
QueueImpl()
          构造函数
QueueImpl(int size)
          构造函数
QueueImpl(String name)
          构造函数
QueueImpl(String name, int size)
          构造函数
 
Method Summary
 E element()
          获取队列头元素
 int getIdleSize()
          获取空闲队列长度
 String getName()
          获取队列名称
 int getSize()
          获取队列长度
 int getUsingSize()
          获取已用队列长度
 boolean isEmpty()
          检查队列是否为空
 boolean isFull()
          检查队列是否为满
 void offer(E o)
          添加元素到队列中
 E peek()
          获取队列头元素
 E poll()
          元素出队,并删除 返回所删除的元素
 E remove()
          元素出队,并删除 返回所删除的元素
 void setName(String name)
          设置队列名称
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueueImpl

public QueueImpl()
构造函数


QueueImpl

public QueueImpl(String name)
构造函数

Parameters:
name -

QueueImpl

public QueueImpl(String name,
                 int size)
构造函数

Parameters:
name -
size -

QueueImpl

public QueueImpl(int size)
构造函数

Parameters:
size -
Method Detail

offer

public void offer(E o)
添加元素到队列中

Specified by:
offer in interface Queue<E>
Parameters:
o -

poll

public E poll()
元素出队,并删除 返回所删除的元素

Specified by:
poll in interface Queue<E>
Returns:
E

remove

public E remove()
元素出队,并删除 返回所删除的元素

Specified by:
remove in interface Queue<E>
Returns:
E

peek

public E peek()
获取队列头元素

Specified by:
peek in interface Queue<E>
Returns:
E

element

public E element()
获取队列头元素

Specified by:
element in interface Queue<E>
Returns:
E

isEmpty

public boolean isEmpty()
检查队列是否为空

Specified by:
isEmpty in interface Queue<E>
Returns:

isFull

public boolean isFull()
检查队列是否为满

Specified by:
isFull in interface Queue<E>
Returns:

setName

public void setName(String name)
设置队列名称

Parameters:
name -

getName

public String getName()
获取队列名称

Specified by:
getName in interface QueueMonitor
Returns:
String

getSize

public int getSize()
获取队列长度

Specified by:
getSize in interface QueueMonitor
Returns:
int

getUsingSize

public int getUsingSize()
获取已用队列长度

Specified by:
getUsingSize in interface QueueMonitor
Returns:
int

getIdleSize

public int getIdleSize()
获取空闲队列长度

Specified by:
getIdleSize in interface QueueMonitor
Returns:
int

size

public int size()
Specified by:
size in interface Queue<E>


Copyright © 2006–2015 TinyGroup. All rights reserved.