Class ConstantDefinitions
- java.lang.Object
-
- com.google.common.css.compiler.passes.ConstantDefinitions
-
public class ConstantDefinitions extends java.lang.ObjectA 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 Summary
Constructors Constructor Description ConstantDefinitions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConstantDefinition(CssDefinitionNode definition)Adds a constant definition to this css tree.CssDefinitionNodegetConstantDefinition(java.lang.String constant)Returns the last definition of a constant.java.util.List<CssDefinitionNode>getConstantDefinitions(java.lang.String constant)Returns all definitions of a constant.com.google.common.collect.Multimap<java.lang.String,CssDefinitionNode>getConstantMultimap()java.lang.Iterable<java.lang.String>getConstantsNames()
-
-
-
Method Detail
-
getConstantMultimap
public com.google.common.collect.Multimap<java.lang.String,CssDefinitionNode> getConstantMultimap()
-
getConstantDefinition
public CssDefinitionNode getConstantDefinition(java.lang.String constant)
Returns the last definition of a constant. Callers should not attempt to modify the returned value.- Returns:
- definition node or
nullif the constant is not defined
-
getConstantDefinitions
public java.util.List<CssDefinitionNode> getConstantDefinitions(java.lang.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
EliminateConditionalNodescompiler pass needs to be run first).
-
getConstantsNames
public java.lang.Iterable<java.lang.String> getConstantsNames()
- Returns:
- the iterable of names of all defined constants
-
-