Class FunctionCallPrototype

java.lang.Object
nz.org.riskscape.engine.rl.FunctionCallPrototype

public class FunctionCallPrototype extends Object

Wraps a FunctionCall and provides conveniences for updating the function call arguments.

Exists primarily for binding purposes.

  • Constructor Details

    • FunctionCallPrototype

      public FunctionCallPrototype(nz.org.riskscape.rl.ast.FunctionCall prototype)
  • Method Details

    • setArgument

      public FunctionCallPrototype setArgument(int i, String argFormat, Object... formatArgs)

      Sets or replaces argument i with the Expression produced from argFormat and formatArgs. If the expression is invalid then exceptions will be thrown from ExpressionParser.parse(java.lang.String).

      Arguments must set in a manner that will not create a hole in the argument list at any time else IllegalArgumentException will result. That is it is not possible to set arg 2 if arg 1 does not yet exist.

      Parameters:
      i - index of the argument to set (zero based)
      argFormat - string format of expression to set argument with
      formatArgs - args (if any) required by argFormat
      Returns:
      FunctionCallPrototype Expression with the replaced/set argument
    • setArgument

      public FunctionCallPrototype setArgument(int i, Optional<String> argumentName, String argFormat, Object... formatArgs)

      Sets or replaces argument i with the Expression produced from argFormat and formatArgs. If the expression is invalid then exceptions will be thrown from ExpressionParser.parse(java.lang.String).

      Arguments must set in a manner that will not create a hole in the argument list at any time else IllegalArgumentException will result. That is it is not possible to set arg 2 if arg 1 does not yet exist.

      Parameters:
      i - index of the argument to set (zero based)
      argumentName - optional argument name
      argFormat - string format of expression to set argument with
      formatArgs - args (if any) required by argFormat
      Returns:
      FunctionCallPrototype Expression with the replaced/set argument (with optional arg name)
    • setFirstArgument

      public FunctionCallPrototype setFirstArgument(String argFormat, Object... formatArgs)
    • addArgument

      public FunctionCallPrototype addArgument(Optional<String> argumentName, String argFormat, Object... formatArgs)
    • build

      public nz.org.riskscape.rl.ast.FunctionCall build()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getPrototype

      public nz.org.riskscape.rl.ast.FunctionCall getPrototype()
    • getNewArguments

      public List<nz.org.riskscape.rl.ast.FunctionCall.Argument> getNewArguments()