Class CssCustomFunctionNode

All Implemented Interfaces:
ChunkAware, Proxiable<CssCustomFunctionNode>, Locatable
Direct Known Subclasses:
CssCustomFunctionNode.CssCustomFunctionNodeProxy

public class CssCustomFunctionNode extends CssFunctionNode implements Proxiable<CssCustomFunctionNode>
A node representing a custom GSS function call.
  • Field Details

  • Constructor Details

    • CssCustomFunctionNode

      public CssCustomFunctionNode(String gssFunctionName, SourceCodeLocation sourceCodeLocation)
      Constructor of the node.
      Parameters:
      gssFunctionName - name of the function "called" by this node
      sourceCodeLocation - location of this node
    • CssCustomFunctionNode

      public CssCustomFunctionNode(CssCustomFunctionNode function)
      Copy constructor.
      Parameters:
      function - the copied custom function node
  • Method Details

    • deepCopy

      public CssCustomFunctionNode deepCopy()
      Overrides:
      deepCopy in class CssFunctionNode
    • getFunctionName

      public String getFunctionName()
      Overrides:
      getFunctionName in class CssFunctionNode
    • toString

      public String toString()
      Description copied from class: CssValueNode
      Use for debugging only.
      Overrides:
      toString in class CssFunctionNode
      See Also:
    • setArguments

      public void setArguments(CssFunctionArgumentsNode arguments)
      Overrides:
      setArguments in class CssFunctionNode
    • createProxy

      public CssCustomFunctionNode createProxy()
      Description copied from interface: Proxiable
      Creates the proxy object. If the original object is immutable and does not have any children, it can return itself.
      Specified by:
      createProxy in interface Proxiable<CssCustomFunctionNode>
      Returns:
      the copy-on-write proxy for this node
    • getResult

      public List<CssValueNode> getResult()
      Returns:
      cached result of function value computation
    • setResult

      public void setResult(List<CssValueNode> functionResult)
      Saves the value of function computation for later use.
      Parameters:
      functionResult - the list of nodes returned by the call to the GssFunction
    • fixupFunctionArguments

      public static List<CssValueNode> fixupFunctionArguments(Iterable<CssValueNode> functionParameters)
      Turns functionParameters containing comma and space literals into a correctly-grouped list of CssValueNodes. For example, in this code:
      * @def A 1 2 3 4; @def B 6 7 8 9; @def USE_A true; @def MARGIN selectFrom(USE_A, A, B);
       
      the selectFrom gets expanded to:
      * @def MARGIN selectFrom([true][,][1][ ][2][ ][3][ ][4][,][6][ ][7][ ][8][ ][9])
       
      where each value in braces is one parameter. That's 17 parameters. Passing that parameter list to this function returns a list with 3 values: true, 1 2 3 4, and 6 7 8 9.

      Note that this function must be passed value nodes that are already expanded as it will create CssLiteralNodes out of the values between commas via concatenation of their toString methods.

      Parameters:
      functionParameters - an iterable that contains resolved parameter values (no references)
      Returns:
      a list values that represent the actual arguments to the function, one value per argument