Package com.helger.css.decl
Class CSSDeclarationList
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<ELEMENTTYPE>
com.helger.commons.collection.impl.CommonsArrayList<DATATYPE>
- All Implemented Interfaces:
com.helger.commons.collection.impl.ICommonsCollection<CSSDeclaration>,com.helger.commons.collection.impl.ICommonsIterable<CSSDeclaration>,com.helger.commons.collection.impl.ICommonsList<CSSDeclaration>,com.helger.commons.lang.ICloneable<com.helger.commons.collection.impl.ICommonsList<CSSDeclaration>>,com.helger.commons.lang.IHasSize,com.helger.commons.traits.IGenericImplTrait<CSSDeclarationList>,IHasCSSDeclarations<CSSDeclarationList>,ICSSSourceLocationAware,ICSSWriteable,Serializable,Cloneable,Iterable<CSSDeclaration>,Collection<CSSDeclaration>,List<CSSDeclaration>,RandomAccess
- Direct Known Subclasses:
CSSDeclarationContainer
@NotThreadSafe
public class CSSDeclarationList
extends CSSWritableList<CSSDeclaration>
implements IHasCSSDeclarations<CSSDeclarationList>
Represents a list of
CSSDeclaration objects. This class emits all
declarations in a row, without any surrounding block elements.- Author:
- Philip Helger
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDeclaration(int nIndex, CSSDeclaration aNewDeclaration) Add a new declaration at the specified index.final CSSDeclarationListaddDeclaration(CSSDeclaration aNewDeclaration) Add a new declaration.final com.helger.commons.collection.impl.ICommonsList<CSSDeclaration>com.helger.commons.collection.impl.ICommonsList<CSSDeclaration>getAllDeclarationsOfPropertyName(String sPropertyName) Get all declarations within this list that have the specified property name.final CSSDeclarationgetDeclarationAtIndex(int nIndex) intgetDeclarationOfPropertyName(String sPropertyName) Get the first declaration with the specified property name.booleancom.helger.commons.state.EChangeRemove all declarations.final com.helger.commons.state.EChangeremoveDeclaration(int nDeclarationIndex) Remove the declaration at the specified indexfinal com.helger.commons.state.EChangeremoveDeclaration(CSSDeclaration aDeclaration) Remove the given declarationsetDeclarationAtIndex(int nIndex, CSSDeclaration aNewDeclaration) Set the declaration at the specified index with a new one.Methods inherited from class com.helger.css.decl.CSSWritableList
equals, getAsCSSString, getSourceLocation, hashCode, setSourceLocation, toStringMethods inherited from class com.helger.commons.collection.impl.CommonsArrayList
createFiltered, createFiltered, createFiltered, createFiltered, createFiltered, createFiltered, createInstance, getCloneMethods inherited from class java.util.ArrayList
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, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAllMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface com.helger.commons.collection.impl.ICommonsCollection
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, setAllMappedMethods inherited from interface com.helger.commons.collection.impl.ICommonsIterable
containsAny, containsNone, containsOnly, findAll, findAllInstanceOf, findAllMapped, findAllMapped, findAllMapped, findFirst, findFirst, findFirstIndex, findFirstMapped, findFirstMapped, findLastIndex, forEachBreakable, forEachByIndex, forEachThrowing, getCountMethods inherited from interface com.helger.commons.collection.impl.ICommonsList
getAll, getAllInstanceOf, getAllMapped, getAllMapped, getAsUnmodifiable, getAtIndex, getFirst, getFirst, getFirstOrNull, getLast, getLast, getLastOrNull, getSortedInline, removeAndReturnElementAtIndex, removeAtIndex, removeFirst, removeFirstOrNull, removeLast, removeLastOrNull, reverse, setFirst, setLast, swapItemsMethods inherited from interface com.helger.css.ICSSWriteable
getAsCSSString, getAsCSSString, getAsCSSStringMethods inherited from interface com.helger.commons.traits.IGenericImplTrait
thisAsTMethods inherited from interface com.helger.css.decl.IHasCSSDeclarations
addDeclaration, getAllDeclarationsOfPropertyNameCaseInsensitive, getDeclarationOfPropertyNameCaseInsensitiveMethods inherited from interface com.helger.commons.lang.IHasSize
isEmpty, isNotEmpty, sizeMethods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
Constructor Details
-
CSSDeclarationList
public CSSDeclarationList()
-
-
Method Details
-
addDeclaration
Description copied from interface:IHasCSSDeclarationsAdd a new declaration.- Specified by:
addDeclarationin interfaceIHasCSSDeclarations<CSSDeclarationList>- Parameters:
aNewDeclaration- The declaration to be added. May not benull.- Returns:
- this
-
addDeclaration
@Nonnull public CSSDeclarationList addDeclaration(@Nonnegative int nIndex, @Nonnull CSSDeclaration aNewDeclaration) Description copied from interface:IHasCSSDeclarationsAdd a new declaration at the specified index.- Specified by:
addDeclarationin interfaceIHasCSSDeclarations<CSSDeclarationList>- Parameters:
nIndex- The index to retrieve. Must be ≥ 0. If the index is ≥ thangetDeclarationCount(), it behaves likeIHasCSSDeclarations.addDeclaration(CSSDeclaration).aNewDeclaration- The declaration to be added. May not benull.- Returns:
- this
-
removeDeclaration
@Nonnull public final com.helger.commons.state.EChange removeDeclaration(@Nonnull CSSDeclaration aDeclaration) Description copied from interface:IHasCSSDeclarationsRemove the given declaration- Specified by:
removeDeclarationin interfaceIHasCSSDeclarations<CSSDeclarationList>- Parameters:
aDeclaration- The declaration to be removed. May not benull.- Returns:
EChange.CHANGEDif the declaration was successfully removed
-
removeDeclaration
@Nonnull public final com.helger.commons.state.EChange removeDeclaration(@Nonnegative int nDeclarationIndex) Description copied from interface:IHasCSSDeclarationsRemove the declaration at the specified index- Specified by:
removeDeclarationin interfaceIHasCSSDeclarations<CSSDeclarationList>- Parameters:
nDeclarationIndex- The index of the declaration to be removed. Must be ≥ 0.- Returns:
EChange.CHANGEDif the declaration was successfully removed,EChange.UNCHANGEDif the index was invalid.
-
removeAllDeclarations
Remove all declarations.- Specified by:
removeAllDeclarationsin interfaceIHasCSSDeclarations<CSSDeclarationList>- Returns:
EChange.CHANGEDif any declaration was removed,EChange.UNCHANGEDotherwise. Nevernull.- Since:
- 3.7.3
-
getAllDeclarations
@Nonnull @ReturnsMutableCopy public final com.helger.commons.collection.impl.ICommonsList<CSSDeclaration> getAllDeclarations()- Specified by:
getAllDeclarationsin interfaceIHasCSSDeclarations<CSSDeclarationList>- Returns:
- A mutable, non-
nullcopy of all contained declarations.
-
getDeclarationAtIndex
- Specified by:
getDeclarationAtIndexin interfaceIHasCSSDeclarations<CSSDeclarationList>- Parameters:
nIndex- The index to retrieve- Returns:
- The declaration at the specified index or
nullif the index is invalid
-
setDeclarationAtIndex
@Nonnull public CSSDeclarationList setDeclarationAtIndex(@Nonnegative int nIndex, @Nonnull CSSDeclaration aNewDeclaration) Description copied from interface:IHasCSSDeclarationsSet the declaration at the specified index with a new one. If an existing declaration is present at that index, it is overwritten.- Specified by:
setDeclarationAtIndexin interfaceIHasCSSDeclarations<CSSDeclarationList>- Parameters:
nIndex- The index to retrieve. Must be ≥ 0. If the index is ≥ thangetDeclarationCount(), it behaves likeIHasCSSDeclarations.addDeclaration(CSSDeclaration).aNewDeclaration- The new declaration to be set.- Returns:
- this
-
hasDeclarations
public boolean hasDeclarations()- Specified by:
hasDeclarationsin interfaceIHasCSSDeclarations<CSSDeclarationList>- Returns:
trueif at least one declaration is present,falseif no declaration is present.
-
getDeclarationCount
- Specified by:
getDeclarationCountin interfaceIHasCSSDeclarations<CSSDeclarationList>- Returns:
- The number of contained declarations. Always ≥ 0.
-
getDeclarationOfPropertyName
Description copied from interface:IHasCSSDeclarationsGet the first declaration with the specified property name. If no such property name is present,nullis 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).- Specified by:
getDeclarationOfPropertyNamein interfaceIHasCSSDeclarations<CSSDeclarationList>- Parameters:
sPropertyName- The property name of the declaration to search (e.g.color). May benull.- Returns:
nullif no such property name was found.
-
getAllDeclarationsOfPropertyName
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSDeclaration> getAllDeclarationsOfPropertyName(@Nullable String sPropertyName) Description copied from interface:IHasCSSDeclarationsGet all declarations within this list that have the specified property name. The comparison happens case insensitive (since v6.0.0).- Specified by:
getAllDeclarationsOfPropertyNamein interfaceIHasCSSDeclarations<CSSDeclarationList>- Parameters:
sPropertyName- The property name of the declaration to search (e.g.color). May benull.- Returns:
- Never
nullbut maybe an empty list.
-