java.lang.Object
io.sf.carte.doc.DOMTokenListImpl
- All Implemented Interfaces:
DOMTokenList,Iterable<String>
An implementation of the
DOMTokenList interface.
It is internally a linked list, but behaves like an ordered set.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given token to this collection.booleanDoes this collection contains this token?booleancontainsAll(DOMTokenList otherlist) Does this collection contain all the tokens in the suppliedDOMTokenList?booleancontainsAll(Collection<String> tokenSet) Does this collection contain all the tokens in the given collection?intGets the number of tokens stored in this collection.Gets the value of the collection as a String, with the tokens alphabetically ordered.getValue()Gets the value of the collection as a String.item(int index) Retrieves a token from the collection by its index.iterator()Obtain an iterator over the members of this set.voidRemoves the given token from this collection.voidReplaces an existing token with a new token.voidSets the value of the collection as a String.booleanIf the given token exists in this collection, remove it; otherwise add it.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DOMTokenListImpl
public DOMTokenListImpl()
-
-
Method Details
-
getLength
public int getLength()Description copied from interface:DOMTokenListGets the number of tokens stored in this collection.- Specified by:
getLengthin interfaceDOMTokenList- Returns:
- the number of tokens stored in this collection.
-
getValue
Description copied from interface:DOMTokenListGets the value of the collection as a String.- Specified by:
getValuein interfaceDOMTokenList- Returns:
- the value of the collection as a String.
-
getSortedValue
Description copied from interface:DOMTokenListGets the value of the collection as a String, with the tokens alphabetically ordered.- Specified by:
getSortedValuein interfaceDOMTokenList- Returns:
- the value of the collection as an alphabetically ordered string.
-
setValue
Sets the value of the collection as a String.- Parameters:
value- the string value of the collection- Throws:
DOMException-SYNTAX_ERRifvalueisnull.
-
item
Description copied from interface:DOMTokenListRetrieves a token from the collection by its index.- Specified by:
itemin interfaceDOMTokenList- Parameters:
index- the index.- Returns:
- the token in the given place of this collection, or
nullif the index is negative, greater than or equal to the length of this collection.
-
contains
Description copied from interface:DOMTokenListDoes this collection contains this token?- Specified by:
containsin interfaceDOMTokenList- Parameters:
token- the token.- Returns:
trueif the list contains the given token,falseotherwise.
-
iterator
Description copied from interface:DOMTokenListObtain an iterator over the members of this set.- Specified by:
iteratorin interfaceDOMTokenList- Specified by:
iteratorin interfaceIterable<String>- Returns:
- an iterator over the members of this set.
-
containsAll
Description copied from interface:DOMTokenListDoes this collection contain all the tokens in the suppliedDOMTokenList?- Specified by:
containsAllin interfaceDOMTokenList- Parameters:
otherlist- anotherDOMTokenList.- Returns:
trueif this list contains all the tokens in the givenotherlist,falseotherwise.- Throws:
DOMException- SYNTAX_ERR if the argument isnullor empty.
-
containsAll
Description copied from interface:DOMTokenListDoes this collection contain all the tokens in the given collection?- Specified by:
containsAllin interfaceDOMTokenList- Parameters:
tokenSet- the collection of tokens.- Returns:
trueif the list contains all the tokens in the given set, false otherwise.
-
add
Description copied from interface:DOMTokenListAdds the given token to this collection.If the set already contains the token, then do nothing.
- Specified by:
addin interfaceDOMTokenList- Parameters:
token- the token to add.- Throws:
DOMException- SYNTAX_ERR if the token isnullor empty. INVALID_CHARACTER_ERR if the token contains spaces.
-
remove
Description copied from interface:DOMTokenListRemoves the given token from this collection.- Specified by:
removein interfaceDOMTokenList- Parameters:
token- the token to remove.- Throws:
DOMException- SYNTAX_ERR if the token isnullor empty. INVALID_CHARACTER_ERR if the token contains spaces.
-
toggle
Description copied from interface:DOMTokenListIf the given token exists in this collection, remove it; otherwise add it.- Specified by:
togglein interfaceDOMTokenList- Parameters:
token- the token to toggle.- Returns:
trueif the token is added,falseif it is removed.- Throws:
DOMException- SYNTAX_ERR if the token isnullor empty. INVALID_CHARACTER_ERR if the token contains spaces.
-
replace
Description copied from interface:DOMTokenListReplaces an existing token with a new token.If the set does not contain the token, do nothing.
- Specified by:
replacein interfaceDOMTokenList- Parameters:
oldToken- the token that has to be replaced.newToken- the new token.- Throws:
DOMException- SYNTAX_ERR if any of the tokens isnullor empty. INVALID_CHARACTER_ERR if any of the tokens contains spaces.
-