|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.util.AbstractCollection
|
+--CharBagI
CharBagI.java Created: Thur Jan 30 2003
A bag of characters, i.e., an unordered collection of characters, that may contain some character some number of times. Has an iterator.
| Constructor Summary | |
CharBagI()
Creates a new empty CharBagI instance. |
|
CharBagI(StringBuffer b)
Creates a new CharBagI 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(CharBagI 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()
Creates and returns a new iterator for this CharBagI. |
static void |
main(String[] args)
|
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 CharBagI()
CharBagI instance.
public CharBagI(StringBuffer b)
CharBagI 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(CharBagI b)
b have the same characters
the same number of times.
b - a CharBagI 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.public static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||