com.osbcp.cssparser
Class Rule

java.lang.Object
  extended by com.osbcp.cssparser.Rule

public final class Rule
extends java.lang.Object

Represents a CSS rule.

Author:
Christoffer Pettersson

Constructor Summary
Rule()
          Creates an empty rule.
Rule(java.util.List<Selector> selectors)
          Creates a new rule based on a list of selectors.
Rule(Selector selector)
          Creates a rule with a single selector.
 
Method Summary
 void addPropertyValue(PropertyValue propertyValue)
          Adds a property value to the rule.
 void addSelector(Selector selector)
          Adds a selector to the rule.
 void addSelectors(java.util.List<Selector> selectors)
          Adds a list of selectors to the existing list of selectors.
 java.util.List<PropertyValue> getPropertyValues()
          Returns a list of all property values attached to the rule.
 java.util.List<Selector> getSelectors()
          Returns a list of all selectors attached to the rule.
 void removePropertyValue(PropertyValue propertyValue)
          Removes a property value from the rule.
 void removeSelector(Selector selector)
          Removes a selector from the rule.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rule

public Rule(Selector selector)
Creates a rule with a single selector.

Parameters:
selector - A selector that the rule should initial with.

Rule

public Rule()
Creates an empty rule.


Rule

public Rule(java.util.List<Selector> selectors)
Creates a new rule based on a list of selectors.

Parameters:
selectors - A list of selectors that the rule should initial with.
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addPropertyValue

public void addPropertyValue(PropertyValue propertyValue)
Adds a property value to the rule.

Parameters:
propertyValue - The property value that should be attached.

getPropertyValues

public java.util.List<PropertyValue> getPropertyValues()
Returns a list of all property values attached to the rule.

Returns:
A list of all property values attached to the rule.

getSelectors

public java.util.List<Selector> getSelectors()
Returns a list of all selectors attached to the rule.

Returns:
A list of all selectors attached to the rule.

addSelectors

public void addSelectors(java.util.List<Selector> selectors)
Adds a list of selectors to the existing list of selectors.

Parameters:
selectors - A list of selectors that should be appended.

removePropertyValue

public void removePropertyValue(PropertyValue propertyValue)
Removes a property value from the rule.

Parameters:
propertyValue - The property value that should be removed.

addSelector

public void addSelector(Selector selector)
Adds a selector to the rule.

Parameters:
selector - The selector that should be attached to the rule.

removeSelector

public void removeSelector(Selector selector)
Removes a selector from the rule.

Parameters:
selector - The selector that should be removed from the rule.