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

public class CSSRuleArrayList extends ArrayList<T>
Stores a list of CSS rules, implementing CSSRuleList.
See Also:
  • 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

      public CSSRuleArrayList(Collection<? extends AbstractCSSRule> c)
  • 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

      public String toString()
    • writeCssText

      public void writeCssText(io.sf.carte.util.SimpleWriter wri, StyleFormattingContext context) throws IOException
      Specified by:
      writeCssText in interface CSSRuleList<AbstractCSSRule>
      Throws:
      IOException
    • getLength

      public int getLength()
      Gives the number of rules in the list.
      Specified by:
      getLength in interface org.w3c.dom.css.CSSRuleList
      Returns:
      the number of CSSRules in the list. The range of valid child rule indices is 0 to length-1 inclusive.
    • item

      public AbstractCSSRule item(int index)
      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 returns null.
      Specified by:
      item in interface CSSRuleList<T extends CSSRule>
      Specified by:
      item in interface org.w3c.dom.css.CSSRuleList
      Parameters:
      index - Index into the collection.
      Returns:
      The style rule at the index position in the CSSRuleList, or null if that is not a valid index.
    • append

      public boolean append(AbstractCSSRule rule)
      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

      public String toMinifiedString()
      Specified by:
      toMinifiedString in interface CSSRuleList<T extends CSSRule>