Package io.sf.carte.doc
Class DOMTokenListImpl
java.lang.Object
io.sf.carte.doc.DOMTokenListImpl
- All Implemented Interfaces:
DOMTokenList
,Serializable
,Iterable<String>
An implementation of the
DOMTokenList
interface.
It is internally a linked list, but behaves like an ordered set.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given token to this collection.boolean
Does this collection contains this token?boolean
containsAll
(DOMTokenList otherlist) Does this collection contain all the tokens in the suppliedDOMTokenList
?boolean
containsAll
(Collection<String> tokenSet) Does this collection contain all the tokens in the given collection?int
Gets 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.void
Removes the given token from this collection.void
Replaces an existing token with a new token.void
Sets the value of the collection as a String.boolean
If 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, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DOMTokenListImpl
public DOMTokenListImpl()
-
-
Method Details
-
getLength
public int getLength()Description copied from interface:DOMTokenList
Gets the number of tokens stored in this collection.- Specified by:
getLength
in interfaceDOMTokenList
- Returns:
- the number of tokens stored in this collection.
-
getValue
Description copied from interface:DOMTokenList
Gets the value of the collection as a String.- Specified by:
getValue
in interfaceDOMTokenList
- Returns:
- the value of the collection as a String.
-
getSortedValue
Description copied from interface:DOMTokenList
Gets the value of the collection as a String, with the tokens alphabetically ordered.- Specified by:
getSortedValue
in 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_ERR
ifvalue
isnull
.
-
item
Description copied from interface:DOMTokenList
Retrieves a token from the collection by its index.- Specified by:
item
in interfaceDOMTokenList
- Parameters:
index
- the index.- Returns:
- the token in the given place of this collection, or
null
if the index is negative, greater than or equal to the length of this collection.
-
contains
Description copied from interface:DOMTokenList
Does this collection contains this token?- Specified by:
contains
in interfaceDOMTokenList
- Parameters:
token
- the token.- Returns:
true
if the list contains the given token,false
otherwise.
-
iterator
Description copied from interface:DOMTokenList
Obtain an iterator over the members of this set.- Specified by:
iterator
in interfaceDOMTokenList
- Specified by:
iterator
in interfaceIterable<String>
- Returns:
- an iterator over the members of this set.
-
containsAll
Description copied from interface:DOMTokenList
Does this collection contain all the tokens in the suppliedDOMTokenList
?- Specified by:
containsAll
in interfaceDOMTokenList
- Parameters:
otherlist
- anotherDOMTokenList
.- Returns:
true
if this list contains all the tokens in the givenotherlist
,false
otherwise.- Throws:
DOMException
- SYNTAX_ERR if the argument isnull
or empty.
-
containsAll
Description copied from interface:DOMTokenList
Does this collection contain all the tokens in the given collection?- Specified by:
containsAll
in interfaceDOMTokenList
- Parameters:
tokenSet
- the collection of tokens.- Returns:
true
if the list contains all the tokens in the given set, false otherwise.
-
add
Description copied from interface:DOMTokenList
Adds the given token to this collection.If the set already contains the token, then do nothing.
- Specified by:
add
in interfaceDOMTokenList
- Parameters:
token
- the token to add.- Throws:
DOMException
- SYNTAX_ERR if the token isnull
or empty. INVALID_CHARACTER_ERR if the token contains spaces.
-
remove
Description copied from interface:DOMTokenList
Removes the given token from this collection.- Specified by:
remove
in interfaceDOMTokenList
- Parameters:
token
- the token to remove.- Throws:
DOMException
- SYNTAX_ERR if the token isnull
or empty. INVALID_CHARACTER_ERR if the token contains spaces.
-
toggle
Description copied from interface:DOMTokenList
If the given token exists in this collection, remove it; otherwise add it.- Specified by:
toggle
in interfaceDOMTokenList
- Parameters:
token
- the token to toggle.- Returns:
true
if the token is added,false
if it is removed.- Throws:
DOMException
- SYNTAX_ERR if the token isnull
or empty. INVALID_CHARACTER_ERR if the token contains spaces.
-
replace
Description copied from interface:DOMTokenList
Replaces an existing token with a new token.If the set does not contain the token, do nothing.
- Specified by:
replace
in interfaceDOMTokenList
- Parameters:
oldToken
- the token that has to be replaced.newToken
- the new token.- Throws:
DOMException
- SYNTAX_ERR if any of the tokens isnull
or empty. INVALID_CHARACTER_ERR if any of the tokens contains spaces.
-