Class ConstantDefinitions

java.lang.Object
com.google.common.css.compiler.passes.ConstantDefinitions

public class ConstantDefinitions extends Object
A container for GSS constant definitions, since a constant could be defined multiple times in the tree, this class has two set of interfaces that can be used to get either all definitions of a constant or only last definition of a constant.
  • Constructor Details

    • ConstantDefinitions

      public ConstantDefinitions()
  • Method Details

    • getConstantMultimap

      public com.google.common.collect.Multimap<String,CssDefinitionNode> getConstantMultimap()
    • getConstantDefinition

      public CssDefinitionNode getConstantDefinition(String constant)
      Returns the last definition of a constant. Callers should not attempt to modify the returned value.
      Returns:
      definition node or null if the constant is not defined
    • getConstantDefinitions

      public List<CssDefinitionNode> getConstantDefinitions(String constant)
      Returns all definitions of a constant.
      Returns:
      collection of definition node or empty collection if the constant is not defined
    • addConstantDefinition

      public void addConstantDefinition(CssDefinitionNode definition)
      Adds a constant definition to this css tree.

      Note that a constant may be defined multiple times in the tree. For the compact representation of the tree, all references to a constant will be replaced with the same value: the last one specified in the stylesheet (to ignore the definitions in inactive condition blocks the EliminateConditionalNodes compiler pass needs to be run first).

    • getConstantsNames

      public Iterable<String> getConstantsNames()
      Returns:
      the iterable of names of all defined constants