Class CssCustomFunctionNode.CssCustomFunctionNodeProxy
- java.lang.Object
-
- com.google.common.css.compiler.ast.CssNode
-
- com.google.common.css.compiler.ast.CssValueNode
-
- com.google.common.css.compiler.ast.CssFunctionNode
-
- com.google.common.css.compiler.ast.CssCustomFunctionNode
-
- com.google.common.css.compiler.ast.CssCustomFunctionNode.CssCustomFunctionNodeProxy
-
- All Implemented Interfaces:
ChunkAware,Proxiable<CssCustomFunctionNode>,Locatable
- Enclosing class:
- CssCustomFunctionNode
public static class CssCustomFunctionNode.CssCustomFunctionNodeProxy extends CssCustomFunctionNode
Copy-on-Write proxy forCssCustomFunctionNodeused to avoid copying of function call subtrees inReplaceConstantReferencespass. It behaves as a proxy of the original node until a write operation happens. When the first write operation happens, proxy node copies the original node and since then acts as a plainCssCustomFunctionNode.NOTE(dgajda): Proxied custom function nodes are also replaced by proxies of themselves to disallow changes, which would be visible to all proxy nodes. Only one kind of changes is propagated to proxy nodes - this is setting of function computation results.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.css.compiler.ast.CssCustomFunctionNode
CssCustomFunctionNode.CssCustomFunctionNodeProxy
-
Nested classes/interfaces inherited from class com.google.common.css.compiler.ast.CssFunctionNode
CssFunctionNode.Function
-
-
Field Summary
-
Fields inherited from class com.google.common.css.compiler.ast.CssCustomFunctionNode
resultNodes
-
-
Constructor Summary
Constructors Constructor Description CssCustomFunctionNodeProxy(CssCustomFunctionNode function)Constructs the node proxy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CssCustomFunctionNodecreateProxy()Creates the proxy object.CssFunctionArgumentsNodegetArguments()java.util.List<CssValueNode>getResult()voidsetArguments(CssFunctionArgumentsNode arguments)voidsetResult(java.util.List<CssValueNode> functionResult)Sets the results of function computation for this node, can set results on the proxied node.-
Methods inherited from class com.google.common.css.compiler.ast.CssCustomFunctionNode
deepCopy, fixupFunctionArguments, getFunctionName, toString
-
Methods inherited from class com.google.common.css.compiler.ast.CssFunctionNode
getChunk, getFunction, getValue, setChunk
-
Methods inherited from class com.google.common.css.compiler.ast.CssValueNode
getIsDefault, setIsDefault, setValue
-
Methods inherited from class com.google.common.css.compiler.ast.CssNode
ancestors, appendComment, deepCopyNodes, equals, getComments, getParent, getShouldBeFlipped, getSourceCodeLocation, getVisitController, hasComment, hashCode, inFunArgs, setComments, setShouldBeFlipped, setSourceCodeLocation
-
-
-
-
Constructor Detail
-
CssCustomFunctionNodeProxy
public CssCustomFunctionNodeProxy(CssCustomFunctionNode function)
Constructs the node proxy. It uses a special super class constructor which avoids unnecessary initialization of arguments node.- Parameters:
function- the proxied node
-
-
Method Detail
-
getArguments
public CssFunctionArgumentsNode getArguments()
- Overrides:
getArgumentsin classCssFunctionNode
-
setArguments
public void setArguments(CssFunctionArgumentsNode arguments)
- Overrides:
setArgumentsin classCssCustomFunctionNode
-
createProxy
public CssCustomFunctionNode createProxy()
Creates the proxy object. If the original object is immutable and does not have any children, it can return itself.- Specified by:
createProxyin interfaceProxiable<CssCustomFunctionNode>- Overrides:
createProxyin classCssCustomFunctionNode- Returns:
- the copy-on-write proxy for this node
-
getResult
public java.util.List<CssValueNode> getResult()
- Overrides:
getResultin classCssCustomFunctionNode- Returns:
- cached result of function value computation
-
setResult
public void setResult(java.util.List<CssValueNode> functionResult)
Sets the results of function computation for this node, can set results on the proxied node. This is harmless because proxied node is exactly the same as proxy node, and function computation results are a derivative of function arguments.- Overrides:
setResultin classCssCustomFunctionNode- Parameters:
functionResult- the list of nodes returned by the call to theGssFunction
-
-