|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractSet
java.util.HashSet
org.zedlib.HashSet
org.zedlib.HashRel
org.zedlib.HashFun
This class provides similar functionality to java.util.Map, however,
it is properly descended from a Set (org.zedlib.Set, hence
implements the java.util.Set interface). It does
not implement the java.util.Map interface because of conflicts between the
java.util.Map and java.util.Set interfaces.
If X and Y are sets, X → Y is the set of partial functions from X to Y.
These are relations which relate each member x of X to at most one member
of Y.
| Constructor Summary | |
HashFun()
|
|
HashFun(Collection c)
Constructs a function containing all elements in the supplied collection of maplets. |
|
HashFun(Collection c1,
Collection c2)
Constructs a function between two collections. |
|
HashFun(Function f)
Constructs a function from a given function. |
|
HashFun(Map m)
Constructs a function from a given java.util.Map. |
|
| Method Summary | |
boolean |
add(Maplet m)
Adds a maplet to this function. |
boolean |
containsKey(Object key)
An alternative for domain().contains(key). |
boolean |
containsValue(Object value)
An alternative for range().contains(value). |
protected Set |
getInstance()
|
protected Set |
getInstance(Set s)
|
Maplet |
getMaplet(Object key)
Returns the maplet that a given key participates in. |
Object |
getValue(Object key)
Returns the value that a given key maps to. |
Object |
put(Maplet m)
Adds a maplet to this function. |
Object |
put(Object x,
Object y)
Adds two objects representing a maplet to this function. |
| Methods inherited from class org.zedlib.HashRel |
add, add, addAll, addAll, buildRelation, composition, domain, domainAntiRestriction, domainRestriction, image, inverse, isFunction, isInjection, isReflexive, override, range, rangeAntiRestriction, rangeRestriction, toString, transitiveClosure |
| Methods inherited from class org.zedlib.HashSet |
cartesianProduct, difference, difference, identity, intersection, intersection, isProperSubsetOf, isSubsetOf, isSupersetOf, union, union |
| Methods inherited from class java.util.HashSet |
clear, clone, contains, isEmpty, iterator, remove, size |
| Methods inherited from class java.util.AbstractSet |
equals, hashCode, removeAll |
| Methods inherited from class java.util.AbstractCollection |
containsAll, retainAll, toArray, toArray |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.zedlib.Relation |
add, addAll, composition, domain, domainAntiRestriction, domainRestriction, image, inverse, isFunction, isInjection, isReflexive, override, range, rangeAntiRestriction, rangeRestriction, transitiveClosure |
| Methods inherited from interface org.zedlib.Set |
cartesianProduct, difference, identity, intersection, isSubsetOf, isSupersetOf, union |
| Methods inherited from interface java.util.Set |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Constructor Detail |
public HashFun()
public HashFun(Collection c1,
Collection c2)
java.util.Map but
is properly contained in the collections hierarchy.
c1 - any collectionc2 - any collection
IllegalArgumentException - if the collections do not contain the same number of unique elementspublic HashFun(Collection c)
ClassCastException - if the collection does not contain mapletspublic HashFun(Map m)
java.util.Map.
public HashFun(Function f)
| Method Detail |
protected Set getInstance()
getInstance in class HashRelprotected Set getInstance(Set s)
getInstance in class HashRelpublic boolean add(Maplet m)
add in interface Relationadd in class HashRelm - the maplet to add to the function
true if the maplet was added to this function
public Object put(Object x,
Object y)
x - the key to add to the function; x in the maplet (x,y)y - the value to add to the function; y in the maplet (x,y)
null if
there was no maplet having a key of x in the function.public Object put(Maplet m)
put in interface Functionm - the maplet to add to the function
null if
there was no maplet having a key of x in the function.public Object getValue(Object key)
key - the key (x) with which to obtain its corresponding (y) value
public Maplet getMaplet(Object key)
getMaplet in interface Functionkey - the key (x) with which to obtain its corresponding (y) value
public boolean containsValue(Object value)
range().contains(value).
containsValue in interface Functionvalue - the object to check for existence in the range of this function
true if a given value, y, is contained in the range of this
functionpublic boolean containsKey(Object key)
domain().contains(key).
containsKey in interface Functionkey - the object to check for existence in the domain of this function
true if a given value, x, is contained in the domain of
this function
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||