@NotThreadSafe public class CSSDeclarationList extends CSSWritableList<CSSDeclaration> implements IHasCSSDeclarations<CSSDeclarationList>
CSSDeclaration
objects. This class emits all
declarations in a row, without any surrounding block elements.modCount
Constructor and Description |
---|
CSSDeclarationList() |
Modifier and Type | Method and Description |
---|---|
CSSDeclarationList |
addDeclaration(CSSDeclaration aNewDeclaration)
Add a new declaration.
|
CSSDeclarationList |
addDeclaration(int nIndex,
CSSDeclaration aNewDeclaration)
Add a new declaration at the specified index.
|
com.helger.commons.collection.impl.ICommonsList<CSSDeclaration> |
getAllDeclarations() |
com.helger.commons.collection.impl.ICommonsList<CSSDeclaration> |
getAllDeclarationsOfPropertyName(String sPropertyName)
Get all declarations within this list that have the specified property
name.
|
CSSDeclaration |
getDeclarationAtIndex(int nIndex) |
int |
getDeclarationCount() |
CSSDeclaration |
getDeclarationOfPropertyName(String sPropertyName)
Get the first declaration with the specified property name.
|
boolean |
hasDeclarations() |
com.helger.commons.state.EChange |
removeAllDeclarations()
Remove all declarations.
|
com.helger.commons.state.EChange |
removeDeclaration(CSSDeclaration aDeclaration)
Remove the given declaration
|
com.helger.commons.state.EChange |
removeDeclaration(int nDeclarationIndex)
Remove the declaration at the specified index
|
CSSDeclarationList |
setDeclarationAtIndex(int nIndex,
CSSDeclaration aNewDeclaration)
Set the declaration at the specified index with a new one.
|
getAsCSSString, getSourceLocation, setSourceLocation, toString
createFiltered, createFiltered, createFiltered, createFiltered, createFiltered, createFiltered, createInstance, getClone
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
equals, hashCode
containsAll
finalize, getClass, notify, notifyAll, wait, wait, wait
addDeclaration, getAllDeclarationsOfPropertyNameCaseInsensitive, getDeclarationOfPropertyNameCaseInsensitive
getAsCSSString, getAsCSSString, getAsCSSString
getAll, getAllInstanceOf, getAllMapped, getAllMapped, getAsUnmodifiable, getAtIndex, getFirst, getFirst, getLast, getLast, getSortedInline, removeAndReturnElementAtIndex, removeAtIndex, removeFirst, removeLast, reverse, setFirst, setLast, swapItems
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
addAll, addAll, addAll, addAll, addAll, addAll, addAll, addAll, addAllMapped, addAllMapped, addAllMapped, addAllMapped, addAllMapped, addAllMapped, addIf, addIfNotNull, addObject, getAtIndex, getAtIndex, getAtIndex, getAtIndexMapped, getAtIndexMapped, getAtIndexMapped, getAtIndexMapped, getCopyAsList, getCount, getSorted, iterator2, removeAll, removeObject, set, setAll, setAll, setAllMapped, setAllMapped
parallelStream, removeIf, stream
containsAny, containsNone, containsOnly, findAll, findAllInstanceOf, findAllMapped, findAllMapped, findAllMapped, findFirst, findFirst, findFirstIndex, findFirstMapped, findFirstMapped, findLastIndex, forEachBreakable, forEachByIndex, forEachThrowing, getCount
@Nonnull public final CSSDeclarationList addDeclaration(@Nonnull CSSDeclaration aNewDeclaration)
IHasCSSDeclarations
addDeclaration
in interface IHasCSSDeclarations<CSSDeclarationList>
aNewDeclaration
- The declaration to be added. May not be null
.@Nonnull public CSSDeclarationList addDeclaration(@Nonnegative int nIndex, @Nonnull CSSDeclaration aNewDeclaration)
IHasCSSDeclarations
addDeclaration
in interface IHasCSSDeclarations<CSSDeclarationList>
nIndex
- The index to retrieve. Must be ≥ 0. If the index is ≥ than
getDeclarationCount()
, it behaves like
IHasCSSDeclarations.addDeclaration(CSSDeclaration)
.aNewDeclaration
- The declaration to be added. May not be null
.@Nonnull public final com.helger.commons.state.EChange removeDeclaration(@Nonnull CSSDeclaration aDeclaration)
IHasCSSDeclarations
removeDeclaration
in interface IHasCSSDeclarations<CSSDeclarationList>
aDeclaration
- The declaration to be removed. May not be null
.EChange.CHANGED
if the declaration was successfully removed@Nonnull public final com.helger.commons.state.EChange removeDeclaration(@Nonnegative int nDeclarationIndex)
IHasCSSDeclarations
removeDeclaration
in interface IHasCSSDeclarations<CSSDeclarationList>
nDeclarationIndex
- The index of the declaration to be removed. Must be ≥ 0.EChange.CHANGED
if the declaration was successfully
removed, EChange.UNCHANGED
if the index was invalid.@Nonnull public com.helger.commons.state.EChange removeAllDeclarations()
removeAllDeclarations
in interface IHasCSSDeclarations<CSSDeclarationList>
EChange.CHANGED
if any declaration was removed,
EChange.UNCHANGED
otherwise. Never null
.@Nonnull @ReturnsMutableCopy public final com.helger.commons.collection.impl.ICommonsList<CSSDeclaration> getAllDeclarations()
getAllDeclarations
in interface IHasCSSDeclarations<CSSDeclarationList>
null
copy of all contained
declarations.@Nullable public final CSSDeclaration getDeclarationAtIndex(@Nonnegative int nIndex)
getDeclarationAtIndex
in interface IHasCSSDeclarations<CSSDeclarationList>
nIndex
- The index to retrievenull
if the
index is invalid@Nonnull public CSSDeclarationList setDeclarationAtIndex(@Nonnegative int nIndex, @Nonnull CSSDeclaration aNewDeclaration)
IHasCSSDeclarations
setDeclarationAtIndex
in interface IHasCSSDeclarations<CSSDeclarationList>
nIndex
- The index to retrieve. Must be ≥ 0. If the index is ≥ than
getDeclarationCount()
, it behaves like
IHasCSSDeclarations.addDeclaration(CSSDeclaration)
.aNewDeclaration
- The new declaration to be set.public boolean hasDeclarations()
hasDeclarations
in interface IHasCSSDeclarations<CSSDeclarationList>
true
if at least one declaration is present,
false
if no declaration is present.@Nonnegative public int getDeclarationCount()
getDeclarationCount
in interface IHasCSSDeclarations<CSSDeclarationList>
@Nullable public CSSDeclaration getDeclarationOfPropertyName(@Nullable String sPropertyName)
IHasCSSDeclarations
null
is returned. If more than one
declaration ith the specified property name is present, always the first in
the list will be returned. The comparison happens case insensitive
(since v6.0.0).getDeclarationOfPropertyName
in interface IHasCSSDeclarations<CSSDeclarationList>
sPropertyName
- The property name of the declaration to search (e.g.
color
). May be null
.null
if no such property name was found.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSDeclaration> getAllDeclarationsOfPropertyName(@Nullable String sPropertyName)
IHasCSSDeclarations
getAllDeclarationsOfPropertyName
in interface IHasCSSDeclarations<CSSDeclarationList>
sPropertyName
- The property name of the declaration to search (e.g.
color
). May be null
.null
but maybe an empty list.Copyright © 2014–2021 Philip Helger. All rights reserved.