com.vaadin.sass.internal.selector
Class Selector

java.lang.Object
  extended by com.vaadin.sass.internal.selector.Selector
All Implemented Interfaces:
Serializable

public class Selector
extends Object
implements Serializable

See Also:
Serialized Form

Constructor Summary
  Selector(Combinator comb, SimpleSelectorSequence simpl)
          Selector with a leading combinator ("> foo")
protected Selector(List<SelectorSegment> parts)
           
  Selector(Selector source)
           
  Selector(Selector first, Combinator comb, Selector second)
          Joins two selectors in sequence with given combinator.
  Selector(SimpleSelectorSequence simple)
          Non-nested selector
 
Method Summary
 Selector createNested(Combinator c, SimpleSelectorSequence s)
          Appends the given sequence of simple selectors to this selector using combinator c.
 boolean equals(Object that)
           
 SimpleSelectorSequence firstSimple()
           
 int hashCode()
           
 boolean isPlaceholder()
          Returns whether the selector contains a placeholder selector
 boolean isSimple()
           
 Selector replace(SimpleSelectorSequence extendSelector, Selector extending)
          Combine this selector with an @extend.
 Selector replaceParentReference(Selector replacement)
          Combine a parent selector with this selector, replacing parent reference selectors (&-selector) in this with replacement if any and return the modified copy of this.
 Selector replaceVariables(Collection<VariableNode> variables)
          Replace variables with their values (textually) in subselectors
 boolean subsumes(Selector that)
          Returns whether this selector matches (at least) all elements that selector matches.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Selector

public Selector(Selector source)

Selector

protected Selector(List<SelectorSegment> parts)

Selector

public Selector(SimpleSelectorSequence simple)
Non-nested selector


Selector

public Selector(Combinator comb,
                SimpleSelectorSequence simpl)
Selector with a leading combinator ("> foo")


Selector

public Selector(Selector first,
                Combinator comb,
                Selector second)
Joins two selectors in sequence with given combinator. Either first and comb are both not null, or both null.

Method Detail

isSimple

public boolean isSimple()

firstSimple

public SimpleSelectorSequence firstSimple()

subsumes

public boolean subsumes(Selector that)
Returns whether this selector matches (at least) all elements that selector matches.


replaceParentReference

public Selector replaceParentReference(Selector replacement)
Combine a parent selector with this selector, replacing parent reference selectors (&-selector) in this with replacement if any and return the modified copy of this. If there are no parent reference selectors, simply concatenates the parent selector and this with the DESCENDANT relationship.

Parameters:
replacement - replacement selector, or null in which case & is just removed
Returns:
modified copy of this with parent selector prepended or substituted for the parent reference selector

replaceVariables

public Selector replaceVariables(Collection<VariableNode> variables)
Replace variables with their values (textually) in subselectors


createNested

public Selector createNested(Combinator c,
                             SimpleSelectorSequence s)
Appends the given sequence of simple selectors to this selector using combinator c.


replace

public Selector replace(SimpleSelectorSequence extendSelector,
                        Selector extending)
Combine this selector with an @extend. This effectively replaces instances of extendSelector in this with extending and returns the new copy of this.

Parameters:
extendSelector - selector in @extend clause (simple selector sequence to be replaced)
extending - selectors replacing the extendSelector
Returns:
new selector replacing this

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object that)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isPlaceholder

public boolean isPlaceholder()
Returns whether the selector contains a placeholder selector



Copyright © 2013–2014 Vaadin. All rights reserved.