|
||||||||||
| 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
org.zedlib.HashBag
Bags are collections of elements of X in which the number of times an element occurs is significant.
| Constructor Summary | |
HashBag()
|
|
HashBag(Bag b)
Constructs a bag from another given bag. |
|
HashBag(Collection c)
Constructs a bag by iterating over a given collection. |
|
HashBag(Map m)
Constructs a bag by iterating over a given map. |
|
| Method Summary | |
boolean |
add(Baglet b)
Adds a maplet to this bag. |
boolean |
add(Maplet m)
Adds a maplet to this bag. |
boolean |
add(Object o)
Adds an object to this bag. |
boolean |
add(Object x,
int y)
Adds an object to this bag with the specified number of occurrences. |
boolean |
containsMember(Object x)
Determines whether an object is in the bag. |
boolean |
containsValue(int count)
A convenience function for the alternative range().contains(new Integer(count)). |
int |
getCount(Object o)
Counts the number of times an element appears in this bag. |
protected Set |
getInstance()
|
protected Set |
getInstance(Set s)
|
boolean |
isSubBagOf(Bag c)
Determines whether this bag is a sub-bag of a given bag. |
Object |
put(Object x,
int y)
Adds an object to this bag with the specified number of occurrences. |
boolean |
remove(Object o)
Removes an occurrence of the given object from this function. |
| Methods inherited from class org.zedlib.HashFun |
containsKey, containsValue, getMaplet, getValue, put, put |
| Methods inherited from class org.zedlib.HashRel |
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, 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.Function |
containsKey, containsValue, getMaplet, put |
| 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 |
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray |
| Constructor Detail |
public HashBag()
public HashBag(Collection c)
public HashBag(Map m)
ClassCastException - if any value in the map is not an Integerpublic HashBag(Bag b)
| Method Detail |
protected Set getInstance()
getInstance in class HashFunprotected Set getInstance(Set s)
getInstance in class HashFunpublic int getCount(Object o)
getCount in interface Bago - the object for which to count occurrences
public boolean remove(Object o)
remove in interface Seto - the object to remove
true if an object was removedpublic boolean containsValue(int count)
range().contains(new Integer(count)).
containsValue in interface Bagcount - any integer being the number of occurrences to check for
true if at least one object exists in the bag occurrence times.public boolean add(Object o)
add in interface Setadd in class HashRelo - the object to add
true if the object was added.public boolean add(Baglet b)
add in interface Bagb - the baglet to add
true if the maplet was added or false if the
maplet already exists or number of occurrences given is less then one.
ClassCastException - if y in the maplet (x,y) is not an IntegerSet.add(Object o)public boolean add(Maplet m)
add in interface Relationadd in class HashFunm - the maplet to add
true if the maplet was added or false if the
maplet already exists or number of occurrences given is less then one.
ClassCastException - if y in the maplet (x,y) is not an Integer
public boolean add(Object x,
int y)
add in interface Bagx - the object to addy - the number of times the object should appear in the bag
true if the maplet was added
public Object put(Object x,
int y)
put in interface Bagx - the object to addy - the number of times the object should appear in the bag
Integer object that was replaced or null
if x was not previously in the bag or occurrences is less then one.public boolean containsMember(Object x)
containsMember in interface Bagx - the object to check for existence
true if the object is in the bagpublic boolean isSubBagOf(Bag c)
isSubBagOf in interface Bagc - any bag
true if this bag is a sub-bag of c
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||