|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.Table<K,V>
public class Table<K,V>
This class defines a table structure that is used to record various pieces of information.
$Id: Table.java,v 1.27 2006-08-18 21:54:37 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
The table has a very simple structure: a HashMap
points to HashSet
s which point to individual
objects.
The table is optimized to not create a HashSet for a row if the row contains just one element. This means that the elements of a row can not be declarted as HashSets.
HashMap
,
HashSet
Constructor Summary | |
---|---|
Table()
|
|
Table(int capacity)
|
|
Table(Table<K,V> old)
|
Method Summary | |
---|---|
boolean |
add(K key,
V value)
This method adds a new object into the table. |
void |
add(Table<K,V> old)
This method adds a table to this table. |
void |
clear()
Empty the table. |
boolean |
contains(java.lang.Object value)
Return true if the value is contained in the Table . |
boolean |
containsValue(java.lang.Object value)
Return true if the value is contained in the Table . |
java.util.Enumeration<V> |
elements()
Return an enumeration of all the elements of this Table . |
V |
get(K key,
V value)
This method determines if an object is already in the table. |
java.lang.Object[] |
getRowArray(K key)
Return an array of the objects in a row. |
java.util.Iterator<V> |
getRowEnumeration(K key)
Return an iteration of the objects in a row. |
HashSet<V> |
getRowSet(K key)
Return a HashSet of the objects in a row. |
boolean |
isRowEmpty(K key)
Return true if the row is empty. |
java.util.Enumeration<K> |
keys()
Return an enumeration of the row key value. |
int |
numRows()
Return the number of rows of the table. |
java.lang.Object |
put(K key,
V value)
This method adds a new object into the table. |
void |
remove(HashSet<V> values)
Remove the set of values from the table. |
java.lang.Object |
remove(K key,
V value)
This method removes an object from the table. |
V |
remove(java.lang.Object value)
Remove this value from the table. |
void |
removeRow(K key)
This methhod removes an entire row from the table. |
boolean |
rowContains(K key,
java.lang.Object value)
Return true if the row contains the value. |
int |
rowSize(K key)
Return the number of elements in a row of this Table . |
int |
size()
Return the number of elements in this Table . |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Table()
public Table(int capacity)
public Table(Table<K,V> old)
Method Detail |
---|
public void clear()
public void add(Table<K,V> old)
public boolean add(K key, V value)
key
- is the row indexvalue
- is the column index (it may not be a HashSet)
public java.lang.Object put(K key, V value)
key
- is the row indexvalue
- is the column index (it may not be a HashSet)
public V get(K key, V value)
key
- is the row indexvalue
- is the column index (it may not be a HashSet)
public java.lang.Object[] getRowArray(K key)
key
- the row indexpublic HashSet<V> getRowSet(K key)
key
- the row indexpublic boolean rowContains(K key, java.lang.Object value)
public boolean isRowEmpty(K key)
key
- the row indexpublic java.util.Iterator<V> getRowEnumeration(K key)
key
- the row indexpublic void removeRow(K key)
key
- the row indexpublic java.lang.Object remove(K key, V value)
key
- is the row indexvalue
- is the column index
public java.util.Enumeration<K> keys()
public int numRows()
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Enumeration<V> elements()
Table
.
public boolean contains(java.lang.Object value)
Table
.
public boolean containsValue(java.lang.Object value)
Table
.
public int rowSize(K key)
Table
.
public int size()
Table
.
public V remove(java.lang.Object value)
public void remove(HashSet<V> values)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |