com.springsource.util.math
Interface ConcurrentRelation<X,Y>

Type Parameters:
X - the type of elements in the domain of the relation
Y - the type of elements in the range of the relation
All Known Implementing Classes:
ConcurrentMapRelation

public interface ConcurrentRelation<X,Y>

Provide a mathematical relation which is notionally a set of ordered pairs. It represents a relationship between the members of two sets: the domain and the range.

Author:
Glyn Normington

Method Summary
 boolean add(X x, Y y)
          Add the given pair (x, y) to the relation.
 boolean contains(X x, Y y)
          Return true if and only if the given pair (x, y) is present in the relation.
 java.util.Set<X> dom()
          Return the domain of the relation.
 void domSubtract(java.util.Set<X> xset)
          Remove all the pairs (x, y) where x is in the given set of X's.
 java.util.Set<Y> ran()
          Return the range of the relation.
 java.util.Set<Y> relationalImage(java.util.Set<X> xset)
          Return the relational image of a set of X's.
 boolean remove(X x, Y y)
          Remove the given pair (x, y) from the relation.
 

Method Detail

add

boolean add(X x,
            Y y)
Add the given pair (x, y) to the relation. It is not an error if the pair is already present.

Parameters:
x -
y -
Returns:
true if and only if the relation was updated

remove

boolean remove(X x,
               Y y)
Remove the given pair (x, y) from the relation. It is not an error if the pair is not present.

Parameters:
x -
y -
Returns:
true if and only if the relation was updated

contains

boolean contains(X x,
                 Y y)
Return true if and only if the given pair (x, y) is present in the relation.

Parameters:
x -
y -
Returns:
true if the pair is present in the relation

dom

java.util.Set<X> dom()
Return the domain of the relation.

Returns:
a set comprising the domain

ran

java.util.Set<Y> ran()
Return the range of the relation.

Returns:
a set comprising the range

relationalImage

java.util.Set<Y> relationalImage(java.util.Set<X> xset)
Return the relational image of a set of X's.

Parameters:
xset - a set of X's
Returns:
the set of Y's which relate to X's in xset

domSubtract

void domSubtract(java.util.Set<X> xset)
Remove all the pairs (x, y) where x is in the given set of X's.

Parameters:
xset - a set of X's