org.jostraca.unit
Interface UnitList

All Known Implementing Classes:
BasicUnitList

public interface UnitList

Description:
A UnitList is a collection of Units provided for processing in some way. Sequential access to the Units is provided as the default method of access, although random access is also provided. UnitList is immutable - create a new UnitList if you need to change the list.

See Also:
Unit

Method Summary
 int getNumUnits()
          Return number of Units.
 Unit getUnit()
          Return current Unit.
 Unit getUnit(int pIndex)
          Return current Unit at index.
 int getUnitIndex()
          Return current index in list of Units.
 boolean nextUnit()
          Return true if their are more Units, false otherwise.
 

Method Detail

nextUnit

public boolean nextUnit()
Return true if their are more Units, false otherwise. Contract: wraps back to the start after returning false once.


getUnit

public Unit getUnit()
Return current Unit. Contract: does not return null, throws IllegalStateException() if nextUnit not called


getUnit

public Unit getUnit(int pIndex)
Return current Unit at index. Contract: does not return null for valid index, otherwise ArrayIndexOutOfBounds at Runtime

Parameters:
pIndex - index of unit

getNumUnits

public int getNumUnits()
Return number of Units. Contract: returns >= 0.


getUnitIndex

public int getUnitIndex()
Return current index in list of Units. Contract: returns >= 0, < getNumUnits, throws IllegalStateException() if nextUnit not called



Copyright © 2000-2002 Richard Rodger