com.tivoli.zce.engine
Class EventList

java.lang.Object
  extended bycom.tivoli.zce.engine.EventList

public final class EventList
extends java.lang.Object

The EventList class stores an array of Events and keeps track of the last index used in this array.

This implementation uses the ArrayList class which efficiently increases the capacity of the list on demand. For cases where large numbers of elements are removed from EventList, we provide a mechanism to call ArrayList.trimToSize method

Author:
fer (Metin Feridun)

Constructor Summary
EventList(Event event)
          Create EventList with one given event in it
EventList(int size)
          Create EventList of specific size
 
Method Summary
 Event eventAt(int position)
          Get Event at given position in list
 int length()
          Get maximum size of list.
 void removeLast()
          Remove last element in the list
 void setEventAt(Event event, int position)
          Set Event at given position in list
 int size()
          Get current size of list (index of last element set)
 java.lang.String toString()
          Return contents of the EventList as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventList

public EventList(int size)
Create EventList of specific size

Parameters:
size - Size of list to be created

EventList

public EventList(Event event)
Create EventList with one given event in it

Parameters:
event - Single event contained in this list
Method Detail

setEventAt

public void setEventAt(Event event,
                       int position)
Set Event at given position in list

Parameters:
event - Event to be stored in list
position - Position this Event will be stored in list

eventAt

public Event eventAt(int position)
Get Event at given position in list

Parameters:
position - Position in list we want to get Event from
Returns:
Event at given position

size

public int size()
Get current size of list (index of last element set)

Returns:
Size of list

removeLast

public void removeLast()
Remove last element in the list


length

public int length()
Get maximum size of list. For ArrayList implementation, the value returned by this method is is the same as the number of elements in the list.

Returns:
Maximum size of list

toString

public java.lang.String toString()
Return contents of the EventList as a String.

Returns:
String representation of the contents of the EventList