Class StepDeclaration

java.lang.Object
nz.org.riskscape.pipeline.ast.StepDeclaration
All Implemented Interfaces:
PipelineExpression
Direct Known Subclasses:
StepDefinition, StepReference

public abstract class StepDeclaration extends Object

AST for a single step.

  • Field Details

    • identToken

      protected final Token identToken

      The first identifier that starts this step declaration. Will be either the name of the referenced step (StepReference) or the id of a step being defined (StepDefinition).

    • namedInputToken

      protected final Optional<Token> namedInputToken

      The identifier that specifies a named input which accepts the previous step in the chain's output, e.g. the baz in foo -> bar.baz. Valid for references and definitions.

  • Constructor Details

    • StepDeclaration

      public StepDeclaration(Token identToken, Optional<Token> namedInputToken)
  • Method Details

    • getNamedInput

      public Optional<String> getNamedInput()

      Get the input name, if any, that the output should be directed to. Only applied to StepReferences.

      Returns:
      input name, if any
    • getIdent

      public String getIdent()
      Returns:
      the string value of this declaration's identifier
    • isA

      public <T extends StepDeclaration> Optional<T> isA(Class<T> test)

      Functional cast for a step, useful for definition or reference specific functional code in favour of if-for-instance style logic

    • equals

      public boolean equals(Object o)
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
    • getIdentToken

      public Token getIdentToken()

      The first identifier that starts this step declaration. Will be either the name of the referenced step (StepReference) or the id of a step being defined (StepDefinition).

    • getNamedInputToken

      public Optional<Token> getNamedInputToken()

      The identifier that specifies a named input which accepts the previous step in the chain's output, e.g. the baz in foo -> bar.baz. Valid for references and definitions.

    • toString

      public final String toString()

      Returns a simplified view of the ast in a source-like fashion, but with a lot of details left out for conciseness

      Overrides:
      toString in class Object
    • appendString

      protected abstract void appendString(StringBuilder appendTo)
    • toSource

      public final String toSource()
      Specified by:
      toSource in interface PipelineExpression
      Returns:
      a string that can be parsed back in to the same ast as this one. It might not be whitespace-faithful...
    • appendSource

      protected abstract void appendSource(StringBuilder appendTo)