jpaul.DataStructs
Class Relation3<Ta,Tb,Tc>

java.lang.Object
  extended by jpaul.DataStructs.Relation3<Ta,Tb,Tc>
Direct Known Subclasses:
Relation3MapRelImpl

public abstract class Relation3<Ta,Tb,Tc>
extends java.lang.Object

Relation3 models a simple ternary relation.

Version:
$Id: Relation3.java,v 1.7 2006/03/14 02:29:31 salcianu Exp $
Author:
Alexandru Salcianu - salcianu@alum.mit.edu

Constructor Summary
Relation3()
           
 
Method Summary
abstract  boolean add(Ta a, Tb b, Tc c)
          Adds the triple <a,b,c> to this ternary relation.
abstract  void clear()
          Removes all associations from this ternary relation.
abstract  boolean contains(Ta a, Tb b, Tc c)
          Checks the presence of the triple <a,b,c> in this ternary relation.
abstract  java.util.Collection<Tb> get2ndValues(Ta a)
          Returns the elements that appear in the 2nd position of at least one triple that appears in this ternary relation and has a in its 1st position.
abstract  java.util.Collection<Tc> get3rdValues(Ta a, Tb b)
          Returns the elements that appear in the third position of at least one triple of the form <a,b,*%gt; that appears in this ternary relation.
abstract  java.util.Collection<Ta> getKeys()
          Returns the elements that appear in the 1st position of at least one triple from this ternary relation.
abstract  boolean remove(Ta a, Tb b, Tc c)
          Removes the triple <a,b,c> from this ternary relation.
 int size()
          Returns the number of <a,b,c> triples in this ternary relation.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Relation3

public Relation3()
Method Detail

add

public abstract boolean add(Ta a,
                            Tb b,
                            Tc c)
Adds the triple <a,b,c> to this ternary relation.


remove

public abstract boolean remove(Ta a,
                               Tb b,
                               Tc c)
Removes the triple <a,b,c> from this ternary relation.


contains

public abstract boolean contains(Ta a,
                                 Tb b,
                                 Tc c)
Checks the presence of the triple <a,b,c> in this ternary relation.


getKeys

public abstract java.util.Collection<Ta> getKeys()
Returns the elements that appear in the 1st position of at least one triple from this ternary relation. Unmodifiable view.


get2ndValues

public abstract java.util.Collection<Tb> get2ndValues(Ta a)
Returns the elements that appear in the 2nd position of at least one triple that appears in this ternary relation and has a in its 1st position. Unmodifiable view.


get3rdValues

public abstract java.util.Collection<Tc> get3rdValues(Ta a,
                                                      Tb b)
Returns the elements that appear in the third position of at least one triple of the form <a,b,*%gt; that appears in this ternary relation.


size

public int size()
Returns the number of <a,b,c> triples in this ternary relation. Linear in the size of the relation. This may be also implemented by incrementally in O(1) by updating a size field, but that may complicate the code in the presence of subclassing, etc. Will think about it if it becomes a problem.


clear

public abstract void clear()
Removes all associations from this ternary relation.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright 2005 Alexandru Salcianu - salcianu@alum.mit.edu