Class Output<D,T>

java.lang.Object
eu.bandm.tools.ramus.ogma.Output<D,T>
Type Parameters:
D - the type of source document identifiers
T - the type of token types; typically an enum type

public class Output<D,T> extends Object
Immutable parser transition outputs. Each output is a pair of the reified semantic effect of a parsing transition and the next input state.
See Also:
  • Constructor Details

  • Method Details

    • getEffect

      public Update<SimpleMessage<D>> getEffect()
      Returns the effect on semantic parsing state of this output.
      Returns:
      the effect on semantic parsing state of this output.
    • getNext

      public Input<D,T> getNext()
      Returns the next input state of this output.
      Returns:
      the next input state of this output.
    • withEffect

      public Output<D,T> withEffect(Update<SimpleMessage<D>> effect)
      Returns a variant of this output with the given semantic effect.
      Parameters:
      effect - the new semantic effect
      Returns:
      a variant of this output with the given semantic effect replacing the original one
      Throws:
      NullPointerException - if effect is null
    • withPreEffect

      public Output<D,T> withPreEffect(Update<SimpleMessage<D>> preEffect)
      Returns a variant of this output with the given semantic pre-effect.
      Parameters:
      preEffect - the semantic effect to prepend
      Returns:
      a variant of this output with the given semantic effect prepended to the original one
      Throws:
      NullPointerException - if preEffect is null
    • withPostEffect

      public Output<D,T> withPostEffect(Update<SimpleMessage<D>> postEffect)
      Returns a variant of this output with the given semantic post-effect.
      Parameters:
      postEffect - the semantic effect to prepend
      Returns:
      a variant of this output with the given semantic effect appended to the original one
      Throws:
      NullPointerException - if postEffect is null
    • mapEffect

      public Output<D,T> mapEffect(Function<? super Update<SimpleMessage<D>>,? extends Update<SimpleMessage<D>>> fun)
      Returns a variant of this output with the semantic effect tranformed by a given function.
      Parameters:
      fun - the function to transform the semantic effect with
      Returns:
      a variant of this output where fun has been applied to the semantic effect
      Throws:
      NullPointerException - if fun is null
    • withNext

      public Output<D,T> withNext(Input<D,T> next)
      Returns a variant of this output with the given next input state.
      Parameters:
      next - the next input state
      Returns:
      a variant of this output with the given next input state replacing the original one
      Throws:
      NullPointerException - if next is null
    • toString

      public String toString()
      Overrides:
      toString in class Object