edu.ou.kmi.buddyspace.core
Class BSConsumerList

java.lang.Object
  |
  +--edu.ou.kmi.buddyspace.core.BSConsumerList

public class BSConsumerList
extends java.lang.Object

BSConsumerList is list of packet/event consumers devided into several levels of priority. The priority level are numbers from 0 to levelNum-1. The higher number, the higher priority.


Constructor Summary
BSConsumerList(int levelNum)
           
 
Method Summary
 void addFirst(java.lang.Object object, int level)
          Inserts the object as the first one in given level
 void addLast(java.lang.Object object, int level)
          Inserts the object as the last one in given level
 void clear()
          Removes all consumers
 boolean contains(java.lang.Object object)
          Returns if the consumer list contains the object
 boolean contains(java.lang.Object object, int level)
          Returns if the consumer list contains the object on given level
 java.util.Enumeration getConsumers()
          Returns list of all objects sorted according to their priority and the order in each priority level.
 boolean remove(java.lang.Object object)
          Removes occurence of the object with the highest priority
 boolean remove(java.lang.Object object, int level)
          Removes occurence of the object with the highest priority on given level
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BSConsumerList

public BSConsumerList(int levelNum)
Method Detail

addLast

public void addLast(java.lang.Object object,
                    int level)
             throws java.lang.ArrayIndexOutOfBoundsException
Inserts the object as the last one in given level

java.lang.ArrayIndexOutOfBoundsException

addFirst

public void addFirst(java.lang.Object object,
                     int level)
              throws java.lang.ArrayIndexOutOfBoundsException
Inserts the object as the first one in given level

java.lang.ArrayIndexOutOfBoundsException

getConsumers

public java.util.Enumeration getConsumers()
Returns list of all objects sorted according to their priority and the order in each priority level.


remove

public boolean remove(java.lang.Object object)
Removes occurence of the object with the highest priority


remove

public boolean remove(java.lang.Object object,
                      int level)
               throws java.lang.ArrayIndexOutOfBoundsException
Removes occurence of the object with the highest priority on given level

java.lang.ArrayIndexOutOfBoundsException

clear

public void clear()
Removes all consumers


contains

public boolean contains(java.lang.Object object)
Returns if the consumer list contains the object


contains

public boolean contains(java.lang.Object object,
                        int level)
                 throws java.lang.ArrayIndexOutOfBoundsException
Returns if the consumer list contains the object on given level

java.lang.ArrayIndexOutOfBoundsException