java.lang.Object
- All Implemented Interfaces:
CSSRuleList<AbstractCSSRule>
,Serializable
,Cloneable
,Iterable<AbstractCSSRule>
,Collection<AbstractCSSRule>
,List<AbstractCSSRule>
,RandomAccess
,SequencedCollection<AbstractCSSRule>
,CSSRuleList
Stores a list of CSS rules, implementing CSSRuleList.
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorDescriptionConstructs an empty rule list with an initial capacity of 16.CSSRuleArrayList
(int initialCapacity) Constructs an empty rule list with the specified initial capacity.CSSRuleArrayList
(Collection<? extends AbstractCSSRule> c) -
Method Summary
Modifier and TypeMethodDescriptionboolean
append
(AbstractCSSRule rule) Appends the rule to the end of the listint
Gives the number of rules in the list.int
insertRule
(CSSRule cssrule, int index) Insert the given CSS rule at the given index.item
(int index) Used to retrieve a CSS rule by ordinal index.Gives a minified parsable representation of this rule list.toString()
void
writeCssText
(SimpleWriter wri, StyleFormattingContext context) Write a serialization of this rule list to the given simple writer, according to the given context.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface io.sf.carte.doc.style.css.CSSRuleList
clear, iterator
Methods inherited from interface java.util.List
containsAll, reversed
-
Constructor Details
-
CSSRuleArrayList
public CSSRuleArrayList(int initialCapacity) Constructs an empty rule list with the specified initial capacity.- Parameters:
initialCapacity
- the initial capacity.- Throws:
IllegalArgumentException
- if the specified initial capacity is negative.
-
CSSRuleArrayList
public CSSRuleArrayList()Constructs an empty rule list with an initial capacity of 16. -
CSSRuleArrayList
-
-
Method Details
-
insertRule
Insert the given CSS rule at the given index.- Parameters:
cssrule
- the rule.index
- the index at which to insert the rule.- Returns:
- the index at which the rule was finally inserted.
-
toString
-
writeCssText
Description copied from interface:CSSRuleList
Write a serialization of this rule list to the given simple writer, according to the given context.- Specified by:
writeCssText
in interfaceCSSRuleList<AbstractCSSRule>
- Parameters:
wri
- the simple writer object.context
- the formatting context.- Throws:
IOException
- if an error happened while writing.
-
getLength
public int getLength()Gives the number of rules in the list.- Specified by:
getLength
in interfaceCSSRuleList
- Returns:
- the number of
CSSRules
in the list. The range of valid child rule indices is0
tolength-1
inclusive.
-
item
Used to retrieve a CSS rule by ordinal index. The order in this collection represents the order of the rules in the CSS style sheet. If index is greater than or equal to the number of rules in the list, this returnsnull
.- Specified by:
item
in interfaceCSSRuleList<T extends CSSRule>
- Specified by:
item
in interfaceCSSRuleList
- Parameters:
index
- Index into the collection.- Returns:
- The style rule at the
index
position in theCSSRuleList
, ornull
if that is not a valid index.
-
append
Appends the rule to the end of the list- Parameters:
rule
- the rule to append.- Returns:
true
if the rule was appended successfully,false
otherwise.
-
toMinifiedString
Description copied from interface:CSSRuleList
Gives a minified parsable representation of this rule list.- Specified by:
toMinifiedString
in interfaceCSSRuleList<T extends CSSRule>
- Returns:
- the minified rule list.
-