omnics
Class TupleSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet<Tuple>
              extended by omnics.TupleSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Tuple>, java.util.Collection<Tuple>, java.util.Set<Tuple>

public class TupleSet
extends java.util.HashSet<Tuple>
implements java.io.Serializable

Author:
Cristian Frasinaru
See Also:
Serialized Form

Constructor Summary
TupleSet()
          Creates a new instance of TupleSet
TupleSet(TupleSet tuples)
          Creates a new instance of TupleSet
 
Method Summary
 boolean contains(java.lang.Object... values)
          Tests if in this relation there is a tuple with the specified values.
 boolean contains(Var[] vars, java.lang.Object[] values)
          Tests if in this relation there is a tuple with the specified values for the specified variables.
 boolean contains(Var var, java.lang.Object value)
          Tests if in this relation there is a tuple for which a certain variable has the specified value.
 TupleSet difference(TupleSet otherSet)
          Performs the difference of two relations.
 Tuple first()
          Returns the first tuple from the set.
 TupleSet intersection(TupleSet otherSet)
          Performs the intersection of two relations.
 TupleSet join(TupleSet otherSet)
          Performs the join of two relations.
 TupleSet projection(VarSet vars)
          Return the projection on the specified set of variables
 TupleSet union(TupleSet otherSet)
          Performs the union of two relations.
 VarSet variables()
          Returns the variables of this relation as a @link{VarSet}
 
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

TupleSet

public TupleSet()
Creates a new instance of TupleSet


TupleSet

public TupleSet(TupleSet tuples)
Creates a new instance of TupleSet

Method Detail

variables

public VarSet variables()
Returns the variables of this relation as a @link{VarSet}


contains

public boolean contains(Var var,
                        java.lang.Object value)
Tests if in this relation there is a tuple for which a certain variable has the specified value.


contains

public boolean contains(Var[] vars,
                        java.lang.Object[] values)
Tests if in this relation there is a tuple with the specified values for the specified variables.


contains

public boolean contains(java.lang.Object... values)
Tests if in this relation there is a tuple with the specified values. The number and the order of values must be the same as the number and order of this tupleset variables.


projection

public TupleSet projection(VarSet vars)
Return the projection on the specified set of variables


union

public TupleSet union(TupleSet otherSet)
Performs the union of two relations. The method returns a new TupleSet consisting of the union of this set of tuples with the specified set of tuples.
Use addAll to add a set of tuples.

Parameters:
otherSet - the set of tuples to be added
Returns:
the union of this tuple and the argument

intersection

public TupleSet intersection(TupleSet otherSet)
Performs the intersection of two relations. The method returns a new TupleSet consisting of the intersection of this set of tuples with the specified set of tuples. Use retainAll to retain only a set of tuples.


difference

public TupleSet difference(TupleSet otherSet)
Performs the difference of two relations. The method returns a new TupleSet consisting of the difference of this set of tuples with the specified set of tuples. Use removeAll to remove a set of tuples.


join

public TupleSet join(TupleSet otherSet)
Performs the join of two relations. The method returns the join of this set of tuples with the specified set of tuples on the common variables.


first

public Tuple first()
Returns the first tuple from the set.