Class Signature

java.lang.Object
com.singularsys.extensions.lambda.Signature
Direct Known Subclasses:
Signature.InnerSig, Signature.OuterSig

public abstract sealed class Signature extends Object permits Signature.OuterSig, Signature.InnerSig
Represents the signature of a lambda function Either a single variable x, a list of variables [x,y,z] a pattern (u,v) or a list containing variables and patterns [(x1,x2),y]. A nested structure of sub-types are used:
Since:
Jep 4.1, extensions 2.2
  • Constructor Details

    • Signature

      public Signature()
  • Method Details

    • isSimple

      public abstract boolean isSimple()
      Simple signatures like x or [x,y,z]
      Returns:
      true if it is simple
    • size

      public abstract int size()
      Number of element in a compound signature
      Returns:
      number of elements, 1 for variables
    • calculateArgs

      protected abstract void calculateArgs(Stack<Object> stack, List<Object> args) throws EvaluationException
      Convert arguments on the stack to a list of arguments matching the pattern in this signature
      Parameters:
      stack - input arguments to the function
      args - output list of values matching the variables in the signature
      Throws:
      EvaluationException - on error
    • getSigs

      public abstract List<? extends Signature> getSigs()
      Return a list of signatures
      Returns:
      either a list or an empty list
    • match

      protected abstract boolean match(Object x)
    • match

      protected abstract boolean match(Object x, Object y)
    • calcSig

      protected static Signature.OuterSig calcSig(Node node, List<String> argList, PostfixMathCommandI listPfmc) throws EvaluationException
      Calculate the signature and extract variable names.
      Parameters:
      node - specifying the signature, e.g. [[x,y],z]
      argList - output list of variable names
      listPfmc - the PostfixMathCommandI corresponding to the list operator
      Returns:
      the signature of the node
      Throws:
      EvaluationException
    • calcInnerSig

      protected static Signature.InnerSig calcInnerSig(Node node, List<String> argList, PostfixMathCommandI listPfmc) throws EvaluationException
      Throws:
      EvaluationException
    • matchN

      public abstract boolean matchN(Object[] args)