Class Combinator

    • Constructor Detail

      • Combinator

        protected Combinator​(Selector firstSelector,
                             Selector secondSelector)
        Creates a combinator.
        Parameters:
        firstSelector - the first selector.
        secondSelector - the second selector.
    • Method Detail

      • getFirstSelector

        public Selector getFirstSelector()
        Returns the first selector of this combinator.
        Returns:
        the first selector.
      • getSecondSelector

        public Selector getSecondSelector()
        Returns the second selector of this combinator.
        Returns:
        the second selector.
      • getSpecificity

        public int getSpecificity()
        Description copied from interface: Selector
        Returns the specificity of this selector.

        The specificity allows to determine in which order the rules of a stylesheet should be applied.

        A specificity is composed of four numbers (defined by CSS2 specification):

        • count 1 if the declaration is from is a 'style' attribute rather than a rule with a selector, 0 otherwise (= a)
        • count the number of ID attributes in the selector (= b)
        • count the number of other attributes and pseudo-classes in the selector (= c)
        • count the number of widget names and pseudo-widgets in the selector (= d)
        Concatenating the four numbers a-b-c-d (in a number system with a large base) gives the specificity. In this implementation, each number is stored on a byte in an integer. SelectorHelper provides a method to compute the specificity of a selector.
        Specified by:
        getSpecificity in interface Selector
        Returns:
        the specificity of this selector.
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object obj)
        Specified by:
        equals in interface Selector
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object