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
Copy-on-Write proxy for
CssCustomFunctionNode used to avoid copying
of function call subtrees in
ReplaceConstantReferences
pass. 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 plain CssCustomFunctionNode.
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.CssCustomFunctionNodeProxyNested 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
ConstructorsConstructorDescriptionConstructs the node proxy. -
Method Summary
Modifier and TypeMethodDescriptionCreates the proxy object.voidsetArguments(CssFunctionArgumentsNode arguments) voidsetResult(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, toStringMethods inherited from class com.google.common.css.compiler.ast.CssFunctionNode
getChunk, getFunction, getValue, setChunkMethods inherited from class com.google.common.css.compiler.ast.CssValueNode
getIsDefault, setIsDefault, setValueMethods 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 Details
-
CssCustomFunctionNodeProxy
Constructs the node proxy. It uses a special super class constructor which avoids unnecessary initialization of arguments node.- Parameters:
function- the proxied node
-
-
Method Details
-
getArguments
- Overrides:
getArgumentsin classCssFunctionNode
-
setArguments
- Overrides:
setArgumentsin classCssCustomFunctionNode
-
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
- Overrides:
getResultin classCssCustomFunctionNode- Returns:
- cached result of function value computation
-
setResult
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
-