Turtle DB
A mini DDBMS
|
Public Member Functions | |
void | reset () |
abstract Schema | getSchema () |
Relation () | |
final boolean | hasNext () |
final Tuple | next () |
final int | getDegree () |
String | toString () |
void | remove () |
abstract void | accept (QueryVisitor v) throws QueryVisitor.VisitorException |
int | getCardinality () |
abstract int | tupleCount () |
boolean | contains (Tuple tup) |
Protected Member Functions | |
abstract Tuple | internalNext () |
Protected Attributes | |
List< Tuple > | m_outputTuples |
Tuple | m_nextTuple |
boolean | m_internalNextCalled |
A relation is implemented as a map from a set of tuples (the relation's key) to a set of tuples
Empty constructor. Should only be called from children's constructors.
abstract void ca.uqac.dim.ddb.Relation.accept | ( | QueryVisitor | v | ) | throws QueryVisitor.VisitorException [pure virtual] |
boolean ca.uqac.dim.ddb.Relation.contains | ( | Tuple | tup | ) |
Determines if a relation contains a given tuple. Warning #1: this implementation is inefficient, as it enumerates all tuples until found. Warning #2: using contains resets any undergoing enumeration made on the relation.
tup | The tuple to look for |
Reimplemented in ca.uqac.dim.ddb.Table.
Computes the cardinality of a relation. Except for instances of Table (which actually contain concrete tuples), calling this method will trigger the evaluation of the query tree and the enumeration of all tuples. It should be used sparingly.
Reimplemented in ca.uqac.dim.ddb.Table.
final int ca.uqac.dim.ddb.Relation.getDegree | ( | ) |
A relation's degree is the size of its schema.
abstract Schema ca.uqac.dim.ddb.Relation.getSchema | ( | ) | [pure virtual] |
Returns the relation's schema
Implemented in ca.uqac.dim.ddb.Table, ca.uqac.dim.ddb.VariableTable, ca.uqac.dim.ddb.Projection, ca.uqac.dim.ddb.NAryRelation, and ca.uqac.dim.ddb.Selection.
final boolean ca.uqac.dim.ddb.Relation.hasNext | ( | ) |
abstract Tuple ca.uqac.dim.ddb.Relation.internalNext | ( | ) | [protected, pure virtual] |
Method that must be implemented by every non-abstract relation; it returns the next tuple of the enumeration, if any. Methods next and hasNext use the return value of internalNext and additionally remove any duplicate tuples from the output enumeration. Hence a call to next may result in multiple calls to the relation's internalNext, if the tuples returned are already part of the result (this is especially true of Projections.
null
if no such tuple exists Implemented in ca.uqac.dim.ddb.Table, ca.uqac.dim.ddb.Projection, ca.uqac.dim.ddb.Selection, ca.uqac.dim.ddb.VariableTable, ca.uqac.dim.ddb.Intersection, and ca.uqac.dim.ddb.Union.
final Tuple ca.uqac.dim.ddb.Relation.next | ( | ) |
void ca.uqac.dim.ddb.Relation.remove | ( | ) |
Reimplemented in ca.uqac.dim.ddb.Table.
void ca.uqac.dim.ddb.Relation.reset | ( | ) |
Resets the enumeration of tuples, i.e. starts back at the first tuple of the relation.
Reimplemented in ca.uqac.dim.ddb.Table, ca.uqac.dim.ddb.Union, and ca.uqac.dim.ddb.UnaryRelation.
String ca.uqac.dim.ddb.Relation.toString | ( | ) |
Pretty-prints a relation to a string
abstract int ca.uqac.dim.ddb.Relation.tupleCount | ( | ) | [pure virtual] |
Returns the number of actual tuples present in the query. This number is different from the cardinality of the query; it counts the number of tuples that are present in the leaves of the query tree.
Implemented in ca.uqac.dim.ddb.Table, ca.uqac.dim.ddb.VariableTable, ca.uqac.dim.ddb.NAryRelation, and ca.uqac.dim.ddb.UnaryRelation.
boolean ca.uqac.dim.ddb.Relation.m_internalNextCalled [protected] |
Tuple ca.uqac.dim.ddb.Relation.m_nextTuple [protected] |
List<Tuple> ca.uqac.dim.ddb.Relation.m_outputTuples [protected] |