All Packages Class Hierarchy This Package Previous Next Index
Class tw.edu.ncnu.im.cnclab.DataStru.ListArray2
java.lang.Object
|
+----tw.edu.ncnu.im.cnclab.DataStru.ListArray2
- public class ListArray2
- extends Object
- implements Cloneable, Serializable
The ListArray2 class implements an two dimension ListArray
Coordinate is needed while specified the location of item.
Example of of coordinate:
int coord[]=new int[]{column,row}
- Version:
- 0.4 Jul 8, 1999
- Author:
- Ding-Yi Chen
- See Also:
- Enumeration, ListItem, ListArray
-
capacity
- The capacity of the ListArray.
-
COLUMN
- Stand for column
-
dimension
- The capacity of the ListArray.
-
first
- First availible item of the ListArray2 in one dimension .
-
firstOfAll
- First availible item of the ListArray2.
-
itemArray
- The array buffer into which the components of the ListArray are stored.
-
last
- Last availible item of the ListArray2 in one dimension.
-
lastOfAll
- Last availible item of the ListArray2.
-
numOfItem
- The number of valid object in one column (or row).
-
ROW
- Stand for row
-
totalItem
- The number of valid object in this ListArray
-
ListArray2(int)
- Constructs an empty ListArray with the specified initial capacity.
-
addItemAt(Object, int[])
- Add an item at specified index.
-
addItemAt(Object, int[], boolean)
- Add an item at specified index.
-
allElements()
- Returns an enumeration of the all components of this ListArray2.
-
allListItems()
- Returns an enumeration of the all ListItem of this ListArray2.
-
clone()
- Returns a deep-copied clone of this ListArray.
-
copyFrom(ListArray2)
- Copies the components from specified ListArray to this ListArray
The size of these ListArrays must be identical.
-
count()
- Number of valid items in this ListArray.
-
count(int, int)
- Number of valid items in this ListArray of specified row/column.
-
deleteAllItems()
- delete all items
-
deleteItemAt(int[])
- delete item at specified coordinate
-
deleteItemAt(ListItem)
- delete specified item
-
elements(int, int)
- Returns an enumeration of the components of one column/row of this ListArray2.
-
getFirst(int, int)
- Get first ListItem of linked-list.
-
getFirstCoord(int, int)
- Get coordinate of first item of linked-list.
-
getFirstIndex(int, int)
- Get index of first item of linked-list.
-
getLast(int, int)
- Get last ListItem of linked-list.
-
getLastCoord(int, int)
- Get coordinate of last item of linked-list.
-
getLastIndex(int, int)
- Get index of last item of linked-list.
-
getListItemAt(int[])
- Get the ListItem at specified index.
-
getNext(int[], int)
- Get next ListItem of linked-list.
-
getNextCoord(int[], int)
- Get the coordinate next ListItem of linked-list.
-
getNextIndex(int[], int)
- Get index of next item of linked-list.
-
getPrev(int[], int)
- Get prev ListItem of linked-list.
-
getPrevCoord(int[], int)
- Get the coordinate prev ListItem of linked-list.
-
getPrevIndex(int[], int)
- Get index of prev item of linked-list.
-
itemAt(int[])
- Get the item at specified index.
-
itemExistAt(int[])
- Check whether item exist at specified index.
-
makeLink(int[], int[])
- Link item from specified coordinate to another coordinate.
-
purge(int[])
- Remove deleted items from specified index translation table
-
setItemAt(Object, int[])
- Set an item at specified index.
COLUMN
public static final int COLUMN
- Stand for column
ROW
public static final int ROW
- Stand for row
capacity
protected int capacity
- The capacity of the ListArray.
dimension
protected int dimension
- The capacity of the ListArray.
totalItem
protected int totalItem
- The number of valid object in this ListArray
numOfItem
protected int numOfItem[][]
- The number of valid object in one column (or row).
itemArray
protected ListItem itemArray[][]
- The array buffer into which the components of the ListArray are stored.
first
protected ListItem first[][]
- First availible item of the ListArray2 in one dimension . Used in linked-list.
firstOfAll
protected ListItem firstOfAll
- First availible item of the ListArray2. Used in linked-list.
last
protected ListItem last[][]
- Last availible item of the ListArray2 in one dimension. Used in linked-list.
lastOfAll
protected ListItem lastOfAll
- Last availible item of the ListArray2. Used in linked-list.
ListArray2
public ListArray2(int capacity)
- Constructs an empty ListArray with the specified initial capacity.
- Parameters:
- capacity - the initial capacity of the ListArray.
addItemAt
public synchronized void addItemAt(Object object,
int coord[])
- Add an item at specified index. Also link the item at tail of linked-list.
- Parameters:
- object - the item to insert.
- coord - coordinate to insert the new component.
addItemAt
public synchronized void addItemAt(Object object,
int coord[],
boolean linkOnly)
- Add an item at specified index. Also link the item at tail of linked-list.
- Parameters:
- object - the item to insert.
- coord - coordinate to insert the new component.
- linkOnly - If
true , it won't appear in allElements(), false otherwise.
makeLink
public synchronized void makeLink(int coordSrc[],
int coordTarget[])
- Link item from specified coordinate to another coordinate.
Like hard-link of UNIX, Item at coordSrc and coordTarget share the same space.
- Parameters:
- coordSrc - Coordinate of original item to link.
- coordTarget - Coordinate of new reference.
clone
public synchronized Object clone()
- Returns a deep-copied clone of this ListArray.
- Returns:
- a deep-copied clone of this ListArray.
- Overrides:
- clone in class Object
copyFrom
public synchronized void copyFrom(ListArray2 src)
- Copies the components from specified ListArray to this ListArray
The size of these ListArrays must be identical.
- Parameters:
- src - the source ListArray
count
public int count()
- Number of valid items in this ListArray.
- Returns:
- Number of valid items in this ListArray
count
public int count(int index,
int dimension)
- Number of valid items in this ListArray of specified row/column.
- Parameters:
- index - the index of row/column
- dimension -
COLUMN stand for column, ROW stand for row
- Returns:
- Number of valid items in this ListArray.
deleteAllItems
public synchronized void deleteAllItems()
- delete all items
deleteItemAt
public synchronized void deleteItemAt(int coord[]) throws NullItemException
- delete item at specified coordinate
- Parameters:
- coord - coordinate to be delete.
deleteItemAt
public synchronized void deleteItemAt(ListItem li) throws NullItemException
- delete specified item
- Parameters:
- li - ListItem to delete.
itemAt
public Object itemAt(int coord[])
- Get the item at specified index.
- Parameters:
- coord - the coordinate of the item.
- Returns:
- the item at specified coord ;
null if no such item
getListItemAt
public ListItem getListItemAt(int coord[])
- Get the ListItem at specified index.
- Parameters:
- coord - the coordinate of the ListItem.
- Returns:
- the ListItem at specified coord ;
null if no such ListItem
itemExistAt
public boolean itemExistAt(int coord[])
- Check whether item exist at specified index.
- Parameters:
- coord - the coordinate of the item.
- Returns:
-
true if item exist at index.
purge
public synchronized void purge(int indexTable[])
- Remove deleted items from specified index translation table
- Parameters:
- indexTable - the index translation table
setItemAt
public synchronized void setItemAt(Object object,
int coord[])
- Set an item at specified index.
if item exist, then set object into item ; otherwise add item at specified coordinate.
- Parameters:
- obj - the item to replace.
- coord - where to set the new component (obj).
getFirstCoord
public int[] getFirstCoord(int index,
int dimension)
- Get coordinate of first item of linked-list.
- Parameters:
- index - the index of row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- coordinate of first item of linked-list.
getFirstIndex
public int getFirstIndex(int index,
int dimension)
- Get index of first item of linked-list.
- Parameters:
- index - the index of row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- index of first item of linked-list of specified dimension.
getLastCoord
public int[] getLastCoord(int index,
int dimension)
- Get coordinate of last item of linked-list.
- Parameters:
- index - the index of row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- coordinate of last item of linked-list.
getLastIndex
public int getLastIndex(int index,
int dimension)
- Get index of last item of linked-list.
- Parameters:
- index - the index of row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- index of last item of linked-list of specified dimension.
getFirst
public ListItem getFirst(int index,
int dimension)
- Get first ListItem of linked-list.
- Parameters:
- index - the index of row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- first item of linked-list.
getLast
public ListItem getLast(int index,
int dimension)
- Get last ListItem of linked-list.
- Parameters:
- index - the index of row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- last ListItem of linked-list.
getNext
public ListItem getNext(int coord[],
int dimension)
- Get next ListItem of linked-list.
- Parameters:
- index - the index of current row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- next ListItem of linked-list.
getNextCoord
public int[] getNextCoord(int coord[],
int dimension)
- Get the coordinate next ListItem of linked-list.
- Parameters:
- coord - the coordinate of current row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- next ListItem of linked-list.
getNextIndex
public int getNextIndex(int coord[],
int dimension)
- Get index of next item of linked-list.
- Parameters:
- index - the index of current row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- index of last item of linked-list of specified dimension.
getPrev
public ListItem getPrev(int coord[],
int dimension)
- Get prev ListItem of linked-list.
- Parameters:
- index - the index of current row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- prev ListItem of linked-list.
getPrevCoord
public int[] getPrevCoord(int coord[],
int dimension)
- Get the coordinate prev ListItem of linked-list.
- Parameters:
- coord - the coordinate of current row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- prev ListItem of linked-list.
getPrevIndex
public int getPrevIndex(int coord[],
int dimension)
- Get index of prev item of linked-list.
- Parameters:
- index - the index of current row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- index of prev item of linked-list of specified dimension.
elements
public final synchronized Enumeration elements(int index,
int dimension)
- Returns an enumeration of the components of one column/row of this ListArray2.
- Parameters:
- index - the index of row/column
- dimension -
0 stand for column, 1 stand for row
- Returns:
- an enumeration of the components of this ListArray2.
- See Also:
- Enumeration
allElements
public final synchronized Enumeration allElements()
- Returns an enumeration of the all components of this ListArray2.
- Returns:
- an enumeration of the all components of this ListArray2.
- See Also:
- Enumeration
allListItems
public final synchronized Enumeration allListItems()
- Returns an enumeration of the all ListItem of this ListArray2.
- Returns:
- an enumeration of the all ListItem of this ListArray2.
- See Also:
- Enumeration
All Packages Class Hierarchy This Package Previous Next Index