com.sapportals.portal.prt.util

Class FiFoList

java.lang.Object
  extended by com.sapportals.portal.prt.util.FiFoList

public class FiFoList
extends Object

FiFoList - implementation of a first-in first-out list. The list has a fixed size. Neither put nor get are blocked if the list is full or empty. A put on a full list deletes the item that came earliest into the list. A get on an empty list returns null. The list is efficient because the underlying data structure is an array which end is connected to its begin. Internally elements are never shifted in the list. Instead the index for begin and end in the array is changed. The list is synchronized.


Constructor Summary
FiFoList(int size)
          Create a first-in first-out list with the given size.
 
Method Summary
 Object get()
          Get an item from the list.
 int getNumberOfItems()
          Returns the number of available items.
 boolean isEmpty()
          Checks if the list is currently empty.
 Object lookupNext()
          Look up the next item.
 Object put(Object item)
          Put an item in the list.
 void setLogger(ILogger logger)
          There is some logging in the list which can be activated by setting the logger.
 String toString()
          Prints the state of the list and its content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FiFoList

public FiFoList(int size)
Create a first-in first-out list with the given size.

Method Detail

setLogger

public void setLogger(ILogger logger)
There is some logging in the list which can be activated by setting the logger. If the logger is set using this method logging still depends on the state of the logger (i.e. active or non-active). The logging contained in this list is of level 'info'.


get

public Object get()
Get an item from the list. The call is not blocked if the list is empty. Returns null if the list is empty.


put

public Object put(Object item)
Put an item in the list. If the list is full the item which came earliest into the list is overwritten and returned. Otherwise this method returns null. A list with size=0 is regarded as always full, thus when doing a put it returns the item as it was an overwritten one.


lookupNext

public Object lookupNext()
Look up the next item. Returns null if the list is empty.


getNumberOfItems

public int getNumberOfItems()
Returns the number of available items.


isEmpty

public boolean isEmpty()
Checks if the list is currently empty.


toString

public String toString()
Prints the state of the list and its content.

Overrides:
toString in class Object
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] EP-BASIS-API [sap.com] epbc.prtapi._apideprecated default EP-PIN-PRT
[sap.com] EP-BASIS-API [sap.com] tc/epbc/prt/api api EP-PIN


Copyright 2011 SAP AG Complete Copyright Notice