Package io.sf.carte.doc.style.css.om
Class CSSRuleArrayList
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<T>
io.sf.carte.doc.style.css.om.CSSRuleArrayList
- All Implemented Interfaces:
CSSRuleList<AbstractCSSRule>,Serializable,Cloneable,Iterable<AbstractCSSRule>,Collection<AbstractCSSRule>,List<AbstractCSSRule>,RandomAccess,org.w3c.dom.css.CSSRuleList
Stores a list of CSS rules, implementing CSSRuleList.
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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 TypeMethodDescriptionbooleanappend(AbstractCSSRule rule) Appends the rule to the end of the listintGives the number of rules in the list.intinsertRule(org.w3c.dom.css.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.toString()voidwriteCssText(io.sf.carte.util.SimpleWriter wri, StyleFormattingContext context) Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, 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, stream, toArrayMethods inherited from interface io.sf.carte.doc.style.css.CSSRuleList
clear, iteratorMethods inherited from interface java.util.List
containsAll
-
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
public int insertRule(org.w3c.dom.css.CSSRule cssrule, int index) 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
public void writeCssText(io.sf.carte.util.SimpleWriter wri, StyleFormattingContext context) throws IOException - Specified by:
writeCssTextin interfaceCSSRuleList<AbstractCSSRule>- Throws:
IOException
-
getLength
public int getLength()Gives the number of rules in the list.- Specified by:
getLengthin interfaceorg.w3c.dom.css.CSSRuleList- Returns:
- the number of
CSSRulesin the list. The range of valid child rule indices is0tolength-1inclusive.
-
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:
itemin interfaceCSSRuleList<T extends CSSRule>- Specified by:
itemin interfaceorg.w3c.dom.css.CSSRuleList- Parameters:
index- Index into the collection.- Returns:
- The style rule at the
indexposition in theCSSRuleList, ornullif that is not a valid index.
-
append
Appends the rule to the end of the list- Parameters:
rule- the rule to append.- Returns:
trueif the rule was appended successfully,falseotherwise.
-
toMinifiedString
- Specified by:
toMinifiedStringin interfaceCSSRuleList<T extends CSSRule>
-