|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Bags are collections of elements of X in which the number of times an element occurs is significant.
| Method Summary | |
boolean |
add(Baglet b)
Adds a maplet to this relation. |
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. |
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 a specified number of times. |
| Methods inherited from interface org.zedlib.Function |
containsKey, containsValue, getMaplet, put |
| Methods inherited from interface org.zedlib.Relation |
add, 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 |
| Method Detail |
public int getCount(Object o)
o - the object for which to count occurrences
public boolean containsValue(int count)
range().contains(new Integer(count)).
count - any integer
true if at least one object exists in the bag occurrence times.
public boolean add(Object x,
int y)
x - the object to addy - the number of times the object should appear in the bag
true if the maplet was added or false if the
maplet already exists or number of occurrences given is less then one.public boolean add(Baglet b)
b - the baglet to add to this bag
true if the given maplet was added to this relationSet.add(Object o)
public Object put(Object x,
int y)
x - 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.public boolean containsMember(Object x)
domain().contains(x).
x - the object to check for existence
true if the object is in the bagpublic boolean isSubBagOf(Bag c)
c - 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 | |||||||||