jfreerails.world.top
Class NonNullElements

java.lang.Object
  extended by jfreerails.world.top.NonNullElements
All Implemented Interfaces:
WorldIterator

public class NonNullElements
extends java.lang.Object
implements WorldIterator

Iterates over one of the lists on the world object only returning non null elements.

Author:
Luke

Field Summary
private  int index
           
private  KEY key
           
private  FreerailsPrincipal principal
           
private  int row
           
private  int size
           
private  SKEY skey
           
private  ReadOnlyWorld w
           
 
Fields inherited from interface jfreerails.world.top.WorldIterator
BEFORE_FIRST
 
Constructor Summary
NonNullElements(KEY k, ReadOnlyWorld world, FreerailsPrincipal p)
           
NonNullElements(SKEY k, ReadOnlyWorld world)
           
 
Method Summary
 FreerailsSerializable getElement()
          Returns the element the curor is pointing to.
 int getIndex()
          Returns the index of the element the cursor is pointing to.
 int getNaturalNumber()
          Returns the number of the row where the cursor is (the first row is 1).
 int getRowID()
          Returns the number of the row where the cursor is (the first row is 0).
 void gotoIndex(int i)
          Moves the cursor to the specified index.
 void gotoRow(int newRow)
          Moves the cursor to the specified index.
private  FreerailsSerializable listGet(int i)
           
private  int listSize()
           
 boolean next()
          Moves the cursor down one row from its current position.
 boolean previous()
          Moves the cursor up one row from its current position.
 void reset()
          Moves the cursor to before the first element and updates any cached values.
static int row2index(ReadOnlyWorld w, KEY key, FreerailsPrincipal p, int row)
           
 int size()
          Returns the number of rows.
protected  boolean testCondition(int i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

private final KEY key

skey

private final SKEY skey

w

private final ReadOnlyWorld w

principal

private final FreerailsPrincipal principal

index

private int index

row

private int row

size

private int size
Constructor Detail

NonNullElements

public NonNullElements(SKEY k,
                       ReadOnlyWorld world)

NonNullElements

public NonNullElements(KEY k,
                       ReadOnlyWorld world,
                       FreerailsPrincipal p)
Method Detail

next

public boolean next()
Description copied from interface: WorldIterator
Moves the cursor down one row from its current position.

Specified by:
next in interface WorldIterator

reset

public void reset()
Description copied from interface: WorldIterator
Moves the cursor to before the first element and updates any cached values.

Specified by:
reset in interface WorldIterator

getElement

public FreerailsSerializable getElement()
Description copied from interface: WorldIterator
Returns the element the curor is pointing to.

Specified by:
getElement in interface WorldIterator

listGet

private FreerailsSerializable listGet(int i)

listSize

private int listSize()

getIndex

public int getIndex()
Description copied from interface: WorldIterator
Returns the index of the element the cursor is pointing to. The value returned is index you would need to use in World.get(KEY key, int index) to retrieve the same element as is returned by getElement()

Specified by:
getIndex in interface WorldIterator

getRowID

public int getRowID()
Description copied from interface: WorldIterator
Returns the number of the row where the cursor is (the first row is 0).

Specified by:
getRowID in interface WorldIterator

size

public int size()
Description copied from interface: WorldIterator
Returns the number of rows.

Specified by:
size in interface WorldIterator

previous

public boolean previous()
Description copied from interface: WorldIterator
Moves the cursor up one row from its current position.

Specified by:
previous in interface WorldIterator

gotoIndex

public void gotoIndex(int i)
Moves the cursor to the specified index.

Specified by:
gotoIndex in interface WorldIterator

testCondition

protected boolean testCondition(int i)

getNaturalNumber

public int getNaturalNumber()
Description copied from interface: WorldIterator
Returns the number of the row where the cursor is (the first row is 1).

Specified by:
getNaturalNumber in interface WorldIterator

gotoRow

public void gotoRow(int newRow)
Description copied from interface: WorldIterator
Moves the cursor to the specified index.

Specified by:
gotoRow in interface WorldIterator

row2index

public static int row2index(ReadOnlyWorld w,
                            KEY key,
                            FreerailsPrincipal p,
                            int row)