Class Specificity

java.lang.Object
io.sf.carte.doc.style.css.om.Specificity
All Implemented Interfaces:
Serializable

public class Specificity extends Object implements Serializable
The specificity of a selector (in the context given by a SelectorMatcher).

See Cascading Style Sheets, level 2 revision 1 CSS 2.1 Specification, § 6.4.3 and also Selectors Level 4 § 16, Calculating a selector’s specificity.

See Also:
  • Constructor Details

    • Specificity

      public Specificity(Selector selector, SelectorMatcher matcher)
      Construct a specificity for a selector and a SelectorMatcher context.
      Parameters:
      selector - the selector.
      matcher - the selector matcher.
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • selectorCompare

      public static int selectorCompare(Specificity s1, Specificity s2)
      Compare two specificities according to its selectors.
      Parameters:
      s1 - the first specificity being compared.
      s2 - the other specificity (to compare against the first).
      Returns:
      a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
    • toString

      public String toString()
      Overrides:
      toString in class Object