|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.util.AbstractCollection
|
+--CharBag
CharBag.java Created: Mon Jan 20 13:03:08 2003
A bag of characters, i.e., an unordered collection of characters, that may contain some character some number of times.
| Constructor Summary | |
CharBag()
Creates a new empty CharBag instance. |
|
CharBag(StringBuffer b)
Creates a new CharBag instance
containing all the chars of b. |
|
| Method Summary | |
boolean |
add(char c)
Adds c to this bag of characters. |
boolean |
contains(char c)
Tests if c is in this bag of characters. |
boolean |
equals(CharBag b)
Tests whether this bag and b have the same characters
the same number of times. |
boolean |
isEmpty()
Tests if this bag of characters is empty |
Iterator |
iterator()
Not yet implemented. |
boolean |
remove(char c)
Removes char from this bag of characters. |
int |
size()
Returns the number of characters in this bag of characters. |
String |
toString()
Converts this bag of characters to a string. |
| Methods inherited from class java.util.AbstractCollection |
add, addAll, clear, contains, containsAll, remove, removeAll, retainAll, toArray, toArray |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
equals, hashCode |
| Constructor Detail |
public CharBag()
CharBag instance.
public CharBag(StringBuffer b)
CharBag instance
containing all the chars of b.
b - a StringBuffer value| Method Detail |
public boolean add(char c)
c to this bag of characters.
c - a char value
truepublic boolean remove(char c)
char from this bag of characters.
post: this == this@pre->excluding(c)
c - a char value
true if c was in this@pre;
false otherwisepublic boolean contains(char c)
c is in this bag of characters.
c - a char value
true if this->includes(c), else falsepublic boolean isEmpty()
isEmpty in interface CollectionisEmpty in class AbstractCollectiontrue if this is empty, else falsepublic int size()
size in interface Collectionsize in class AbstractCollectionpublic boolean equals(CharBag b)
b have the same characters
the same number of times.
b - a CharBag value
true
if this bag and b have the same characters
the same number of times.
else falsepublic Iterator iterator()
iterator in interface Collectioniterator in class AbstractCollectionpublic String toString()
toString in class AbstractCollectionString representation of this bag of characters.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||