DSRG.MW
Class Table

java.lang.Object
  |
  +--DSRG.MW.Table

public class Table
extends java.lang.Object

this class holds a number of tuples together with a Relation object in the MKB to form a relation extent. It's used for holding relation extents, since those belong in the MKB.


Field Summary
private  java.util.Vector attributeNames
          the schema of the Table.
private  java.util.Vector attributeSizes
          the sizes of attribute in the attributes of the Table.
static boolean DEBUG
          Debug flag
private  java.lang.String relName
          the virtual name of this relation (for query breakdown)
private  java.util.Vector tuples
          a number of tuples in this extent
 
Constructor Summary
Table()
          a new constructor without argument...
Table(int capacity)
          constructs a relation extent object with a default size.
Table(Table oldTable)
          a copy constructor used to copy the extent.
 
Method Summary
 void addTuple(Tuple t)
          adds a tuple at the end of this vector.
 java.util.Vector getAttributeNames()
           
 java.util.Vector getAttributeSizes()
           
 java.lang.String getRelName()
           
 int getSize()
          returns the number of tuples in this relation.
 Tuple getTuple(int i)
          gets the tuples at index i
 java.util.Vector getTuples()
          return this Table's vector of tuples (the reference, not a clone)
 int removeTuple(Tuple t, int multiplicity)
          searches for a certain tuple with the tuple's equals method and removes it from the extent.
 void setAttributeNames(java.util.Vector attNames)
           
 void setAttributeSizes(java.util.Vector attSizes)
           
 void setRelName(java.lang.String name)
           
 java.lang.String toString()
          string representation (calls toString for all tuples, one line each).
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
Debug flag

tuples

private java.util.Vector tuples
a number of tuples in this extent

attributeNames

private java.util.Vector attributeNames
the schema of the Table. A vector of Strings (attribute names)

attributeSizes

private java.util.Vector attributeSizes
the sizes of attribute in the attributes of the Table. A vector of Integer (lengths)

relName

private java.lang.String relName
the virtual name of this relation (for query breakdown)
Constructor Detail

Table

public Table()
a new constructor without argument... trying to get rid of the peer object

Table

public Table(int capacity)
constructs a relation extent object with a default size. This is good for efficiency (if the size of the relation to be stored is known)

Table

public Table(Table oldTable)
a copy constructor used to copy the extent. Necessary for comparing old and new view extent in the EVE-Demo
Method Detail

getTuples

public java.util.Vector getTuples()
return this Table's vector of tuples (the reference, not a clone)

getTuple

public Tuple getTuple(int i)
gets the tuples at index i
Parameters:
i - the index of the tuple to be retrieved
Returns:
null if the index is invalid

getSize

public int getSize()
returns the number of tuples in this relation.
Returns:
-1 if there are no tuples

addTuple

public void addTuple(Tuple t)
adds a tuple at the end of this vector. If Vector is empty, creates a new vector with 10 original entries. Bag semantics.

removeTuple

public int removeTuple(Tuple t,
                       int multiplicity)
searches for a certain tuple with the tuple's equals method and removes it from the extent. This is done multiplicity times.
Returns:
the actual number of removed tuples. If this is less than multiplicity of 0, then something is wrong

toString

public java.lang.String toString()
string representation (calls toString for all tuples, one line each).
Returns:
null if no tuples in the relation
Overrides:
toString in class java.lang.Object

getRelName

public java.lang.String getRelName()

setRelName

public void setRelName(java.lang.String name)

getAttributeNames

public java.util.Vector getAttributeNames()

setAttributeNames

public void setAttributeNames(java.util.Vector attNames)

getAttributeSizes

public java.util.Vector getAttributeSizes()

setAttributeSizes

public void setAttributeSizes(java.util.Vector attSizes)