org.jscience.util
Class BinaryRelation

java.lang.Object
  extended by org.jscience.util.BinaryRelation
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.Set, Relation

public class BinaryRelation
extends java.lang.Object
implements Relation, Cloneable

A class representing a binary relation. You can use this class to design any transition network (compilators and the like for example). This would be a good start for a trellis. It could also be used for a small neural network or why not a Petri net.


Constructor Summary
BinaryRelation()
          Creates a new BinaryRelation object.
 
Method Summary
 boolean add(NAry nAry)
          DOCUMENT ME!
 boolean add(java.lang.Object o)
          DOCUMENT ME!
 boolean add(java.lang.Object[] o)
          DOCUMENT ME!
 boolean addAll(java.util.Collection c)
          DOCUMENT ME!
 boolean addAll(Relation r)
          DOCUMENT ME!
 void clear()
          DOCUMENT ME!
 java.lang.Object clone()
          DOCUMENT ME!
 boolean contains(NAry nAry)
          DOCUMENT ME!
 boolean contains(java.lang.Object o)
          DOCUMENT ME!
 boolean contains(java.lang.Object[] o)
          DOCUMENT ME!
 boolean contains(java.lang.Object object, int i)
          DOCUMENT ME!
 boolean containsAll(java.util.Collection c)
          DOCUMENT ME!
 boolean containsAll(Relation r)
          DOCUMENT ME!
 boolean equals(java.lang.Object o)
          DOCUMENT ME!
 java.util.Set get(int i)
          DOCUMENT ME!
 java.util.Set getAll()
          DOCUMENT ME!
 int getDimension()
          DOCUMENT ME!
 java.util.Set getElements(java.lang.Object object, int i)
          DOCUMENT ME!
 BinaryRelation getInverse()
          DOCUMENT ME!
 java.util.Map getMap()
          DOCUMENT ME!
 boolean isBijection()
          DOCUMENT ME!
 boolean isEmpty()
          DOCUMENT ME!
 boolean isFunction(int i)
          DOCUMENT ME!
 boolean isReflexive()
          DOCUMENT ME!
 boolean isSymetric()
          DOCUMENT ME!
 boolean isTransitive()
          DOCUMENT ME!
 java.util.Iterator iterator()
          DOCUMENT ME!
 boolean remove(NAry nAry)
          DOCUMENT ME!
 boolean remove(java.lang.Object o)
          DOCUMENT ME!
 boolean remove(java.lang.Object[] o)
          DOCUMENT ME!
 boolean removeAll(java.util.Collection c)
          DOCUMENT ME!
 boolean removeAll(Relation r)
          DOCUMENT ME!
 boolean retainAll(java.util.Collection c)
          DOCUMENT ME!
 boolean retainAll(Relation r)
          DOCUMENT ME!
 int size()
          DOCUMENT ME!
 java.lang.Object[] toArray()
          DOCUMENT ME!
 java.lang.Object[] toArray(NAry[] a)
          DOCUMENT ME!
 java.lang.Object[] toArray(java.lang.Object[] a)
          DOCUMENT ME!
 java.lang.String toString()
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
hashCode
 

Constructor Detail

BinaryRelation

public BinaryRelation()
Creates a new BinaryRelation object.

Method Detail

getDimension

public final int getDimension()
DOCUMENT ME!

Specified by:
getDimension in interface Relation
Returns:
DOCUMENT ME!

add

public boolean add(java.lang.Object o)
DOCUMENT ME!

Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Specified by:
add in interface Relation
Parameters:
o - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!
java.lang.NullPointerException - DOCUMENT ME!

add

public boolean add(NAry nAry)
DOCUMENT ME!

Specified by:
add in interface Relation
Parameters:
nAry - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!
java.lang.NullPointerException - DOCUMENT ME!

add

public boolean add(java.lang.Object[] o)
DOCUMENT ME!

Specified by:
add in interface Relation
Parameters:
o - DOCUMENT ME!
Returns:
DOCUMENT ME!

clear

public void clear()
DOCUMENT ME!

Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.Set
Specified by:
clear in interface Relation

clone

public java.lang.Object clone()
DOCUMENT ME!

Specified by:
clone in interface Relation
Overrides:
clone in class java.lang.Object
Returns:
DOCUMENT ME!
See Also:
Object.clone()

contains

public boolean contains(java.lang.Object o)
DOCUMENT ME!

Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set
Specified by:
contains in interface Relation
Parameters:
o - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

contains

public boolean contains(NAry nAry)
DOCUMENT ME!

Specified by:
contains in interface Relation
Parameters:
nAry - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

contains

public boolean contains(java.lang.Object[] o)
DOCUMENT ME!

Specified by:
contains in interface Relation
Parameters:
o - DOCUMENT ME!
Returns:
DOCUMENT ME!

isEmpty

public boolean isEmpty()
DOCUMENT ME!

Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.Set
Specified by:
isEmpty in interface Relation
Returns:
DOCUMENT ME!

iterator

public java.util.Iterator iterator()
DOCUMENT ME!

Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set
Specified by:
iterator in interface Relation
Returns:
DOCUMENT ME!

remove

public boolean remove(java.lang.Object o)
DOCUMENT ME!

Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set
Specified by:
remove in interface Relation
Parameters:
o - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

remove

public boolean remove(NAry nAry)
DOCUMENT ME!

Specified by:
remove in interface Relation
Parameters:
nAry - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

remove

public boolean remove(java.lang.Object[] o)
DOCUMENT ME!

Specified by:
remove in interface Relation
Parameters:
o - DOCUMENT ME!
Returns:
DOCUMENT ME!

size

public int size()
DOCUMENT ME!

Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.Set
Specified by:
size in interface Relation
Returns:
DOCUMENT ME!

addAll

public boolean addAll(Relation r)
DOCUMENT ME!

Specified by:
addAll in interface Relation
Parameters:
r - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

addAll

public boolean addAll(java.util.Collection c)
DOCUMENT ME!

Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.Set
Specified by:
addAll in interface Relation
Parameters:
c - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

containsAll

public boolean containsAll(Relation r)
DOCUMENT ME!

Specified by:
containsAll in interface Relation
Parameters:
r - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

containsAll

public boolean containsAll(java.util.Collection c)
DOCUMENT ME!

Specified by:
containsAll in interface java.util.Collection
Specified by:
containsAll in interface java.util.Set
Specified by:
containsAll in interface Relation
Parameters:
c - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

removeAll

public boolean removeAll(Relation r)
DOCUMENT ME!

Specified by:
removeAll in interface Relation
Parameters:
r - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

removeAll

public boolean removeAll(java.util.Collection c)
DOCUMENT ME!

Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.Set
Specified by:
removeAll in interface Relation
Parameters:
c - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

retainAll

public boolean retainAll(Relation r)
DOCUMENT ME!

Specified by:
retainAll in interface Relation
Parameters:
r - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

retainAll

public boolean retainAll(java.util.Collection c)
DOCUMENT ME!

Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.Set
Specified by:
retainAll in interface Relation
Parameters:
c - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.NullPointerException - DOCUMENT ME!

toArray

public java.lang.Object[] toArray()
DOCUMENT ME!

Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set
Specified by:
toArray in interface Relation
Returns:
DOCUMENT ME!

toArray

public java.lang.Object[] toArray(NAry[] a)
DOCUMENT ME!

Specified by:
toArray in interface Relation
Parameters:
a - DOCUMENT ME!
Returns:
DOCUMENT ME!

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
DOCUMENT ME!

Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set
Specified by:
toArray in interface Relation
Parameters:
a - DOCUMENT ME!
Returns:
DOCUMENT ME!

toString

public java.lang.String toString()
DOCUMENT ME!

Specified by:
toString in interface Relation
Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!

equals

public boolean equals(java.lang.Object o)
DOCUMENT ME!

Specified by:
equals in interface java.util.Collection
Specified by:
equals in interface java.util.Set
Specified by:
equals in interface Relation
Overrides:
equals in class java.lang.Object
Parameters:
o - DOCUMENT ME!
Returns:
DOCUMENT ME!

contains

public boolean contains(java.lang.Object object,
                        int i)
DOCUMENT ME!

Specified by:
contains in interface Relation
Parameters:
object - DOCUMENT ME!
i - DOCUMENT ME!
Returns:
DOCUMENT ME!

getAll

public java.util.Set getAll()
DOCUMENT ME!

Specified by:
getAll in interface Relation
Returns:
DOCUMENT ME!

get

public java.util.Set get(int i)
DOCUMENT ME!

Specified by:
get in interface Relation
Parameters:
i - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

getElements

public java.util.Set getElements(java.lang.Object object,
                                 int i)
DOCUMENT ME!

Specified by:
getElements in interface Relation
Parameters:
object - DOCUMENT ME!
i - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

isReflexive

public boolean isReflexive()
DOCUMENT ME!

Returns:
DOCUMENT ME!

isSymetric

public boolean isSymetric()
DOCUMENT ME!

Returns:
DOCUMENT ME!

isTransitive

public boolean isTransitive()
DOCUMENT ME!

Returns:
DOCUMENT ME!

isFunction

public boolean isFunction(int i)
DOCUMENT ME!

Specified by:
isFunction in interface Relation
Parameters:
i - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

getMap

public java.util.Map getMap()
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
java.lang.ClassCastException - DOCUMENT ME!

isBijection

public boolean isBijection()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getInverse

public BinaryRelation getInverse()
DOCUMENT ME!

Returns:
DOCUMENT ME!