sears.search.data
Class ListOfRow

java.lang.Object
  extended by sears.search.data.ListOfRow

public class ListOfRow
extends java.lang.Object

If elements added is not bigger or equals than the last one it do not correspond and it not added...


Constructor Summary
ListOfRow()
          Creates a new list with initial capacity set to default: 10
ListOfRow(int inititialCapacity)
          Creates a new empty list with capacity set to initialCapacity
 
Method Summary
 boolean add(int indexOfOccurrence)
          Add a new item in the list Item must be positive and no have entry in the list
 void clear()
          Empty the list
 int getIndexOfRow(int row)
          Dichotomic search, gets the index of the row contained in the list
 int getRow(int index)
          Gets the row at index given in parameter
 boolean isEmpty()
          Tests if the list is empty or not
 LoopIterator iterator()
          Returns a new LoopIterator object over the list
 int size()
          Gets the size of the list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListOfRow

public ListOfRow()
Creates a new list with initial capacity set to default: 10


ListOfRow

public ListOfRow(int inititialCapacity)
Creates a new empty list with capacity set to initialCapacity

Parameters:
inititialCapacity - the initial capacity of the list
Method Detail

add

public boolean add(int indexOfOccurrence)
Add a new item in the list Item must be positive and no have entry in the list

Parameters:
indexOfOccurrence - a positive int
Returns:
true if indexOfOccurencce is added in the list, false if not
Throws:
java.lang.IllegalArgumentException - if indexOfOccurencce is negative

getRow

public int getRow(int index)
Gets the row at index given in parameter

Parameters:
index - the index in the list
Returns:
the row at index, -1 if the list is empty
Throws:
java.lang.IndexOutOfBoundsException - if index is bigger than the list's capacity

getIndexOfRow

public int getIndexOfRow(int row)
Dichotomic search, gets the index of the row contained in the list

Parameters:
row - the row to search
Returns:
the index of the row or -1 if the row is not in the list

clear

public void clear()
Empty the list


isEmpty

public boolean isEmpty()
Tests if the list is empty or not

Returns:
true if the list is empty, false if not

size

public int size()
Gets the size of the list

Returns:
the size of the list

iterator

public LoopIterator iterator()
Returns a new LoopIterator object over the list

Returns:
an instance of LoopIterator for this list
See Also:
LoopIterator