|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.data.GridContainer<T>
public class GridContainer<T>
Grid based container. Contents are stored in Lists of Lists.
Gets and Sets for columns,rows, or cells should be constant time.
Copyright 2009 Partner Software, Inc.
| Constructor Summary | |
|---|---|
GridContainer(Cog node)
Creates a new GridContainer matching contents of passed Cog. |
|
GridContainer(GridContainer<T> nother)
Copy constructor for GridContainer. |
|
GridContainer(int width,
int height)
Creates a new GridContainer of the specified size. |
|
| Method Summary | |
|---|---|
void |
clearContentsInColumn(int column)
Deletes contents of an entire column. |
void |
clearContentsInRow(int row)
Deletes contents of an entire row. |
boolean |
contains(T item)
Searches all columns for parameter. |
T |
getContentsAt(int column,
int row)
Gets content from single cell. |
java.util.List<T> |
getContentsInColumn(int col)
Returns a List of elements in a given column. |
java.util.List<T> |
getContentsInRow(int row)
Returns a List of elements in a given row. |
int |
getHeight()
Returns the number of cells high this container will allow. |
int |
getWidth()
Returns the number of cells wide this container will allow. |
void |
insertColumnAt(int column)
Inserts a column at given index. |
void |
insertRowAt(int row)
Inserts a row at given index. |
java.util.List<T> |
listContents()
Returns a list of all items contained in this grid. |
T |
remove(T item)
Searches all columns for parameter. |
java.util.List<T> |
removeColumnAt(int column)
Removes column and column contents at specified row. |
T |
removeContentsAt(int column,
int row)
Removes and returns single cell contents. |
java.util.List<T> |
removeRowAt(int row)
Removes row and row contents at specified row. |
void |
setContentsAt(T storage,
int column,
int row)
Sets content in cell. |
void |
setContentsInColumn(java.util.List<T> entireColumnInOrder,
int column)
Sets contents for a given column. |
void |
setContentsInRow(java.util.List<T> entireRowInOrder,
int row)
Sets contents for a given row. |
void |
setHeight(int height)
Sets the number of cells high this container should allow. |
void |
setWidth(int width)
Sets the number of cells wide this container should allow. |
Cog |
toCog()
Returns the complete internal state of this object in the form of a Cog. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GridContainer(int width,
int height)
public GridContainer(Cog node)
node - public GridContainer(GridContainer<T> nother)
| Method Detail |
|---|
public T getContentsAt(int column,
int row)
column - - column to pull from. column 0 is first column.row - - row to pull from. row 0 is first row.
java.lang.IllegalStateException - if column or row is < 0 or >= width,height.
public void setContentsAt(T storage,
int column,
int row)
storage - - Item to store.column - - column to store in.row - - row to store in.
java.lang.IllegalStateException - if column or row is < 0 or >= width,height.
public T removeContentsAt(int column,
int row)
java.lang.IllegalStateException - if column or row is < 0 or >= width,height.public java.util.List<T> getContentsInRow(int row)
java.lang.IllegalStateException - if row is < 0 or >= width.public java.util.List<T> getContentsInColumn(int col)
java.lang.IllegalStateException - if column is < 0 or >= height.public boolean contains(T item)
item - to search for.
public java.util.List<T> listContents()
public T remove(T item)
item - to remove.
public void setContentsInRow(java.util.List<T> entireRowInOrder,
int row)
entireRowInOrder - - list of items to set for a given row.row - - index of row to set.
java.lang.IllegalStateException - if row is < 0 or >= height.
public void setContentsInColumn(java.util.List<T> entireColumnInOrder,
int column)
entireColumnInOrder - - list of items to set for a given column.column - - index of column to set.
java.lang.IllegalStateException - if column is < 0 or >= width.public void clearContentsInRow(int row)
row - - index of row to clear.
java.lang.IllegalStateException - if row is < 0 or >= height.public void clearContentsInColumn(int column)
column - - index of column to clear.
java.lang.IllegalStateException - if column is < 0 or >= width.public java.util.List<T> removeColumnAt(int column)
column - - index of column to remove.
java.lang.IllegalStateException - if column < 0 or >= widthpublic java.util.List<T> removeRowAt(int row)
row - - index of row to remove
java.lang.IllegalStateException - if row < 0 or row >= height.public void insertRowAt(int row)
row - public void insertColumnAt(int column)
column - public void setWidth(int width)
width - for this container.public void setHeight(int height)
height - for container.public int getHeight()
public int getWidth()
public Cog toCog()
CoggableCog.
toCog in interface Coggable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||