Class MacroProcessorBase<T extends MacroContextBase>

java.lang.Object
org.qubership.atp.dataset.macros.processor.MacroProcessorBase<T>
Direct Known Subclasses:
AbstractMacroProcessor, RefAliasProcessor

public abstract class MacroProcessorBase<T extends MacroContextBase> extends Object
  • Field Details

    • START

      protected static final org.qubership.atp.dataset.macros.processor.MacroProcessorBase.Start START
    • END

      protected static final org.qubership.atp.dataset.macros.processor.MacroProcessorBase.End END
    • state

      protected T extends MacroContextBase state
  • Constructor Details

    • MacroProcessorBase

      public MacroProcessorBase()
  • Method Details

    • reevaluateRootLevel

      protected abstract boolean reevaluateRootLevel(@Nonnull T root) throws CtxEvalException
      Invoked on the end of root macro processing. Should drop text into tail and parse again. Returns true if text has changed after extra processing step.
      Throws:
      CtxEvalException
    • reduce

      protected abstract void reduce(@Nonnull T parent, @Nonnull T child) throws CtxEvalException
      Child will be thrown away. Child is evaluated - content in it's text. Parent may has an arguments, which should be reevaluated too. Sample: this.tail.append(parent.args).append(child.text).append(")"); parent.args.clear();
      Throws:
      CtxEvalException
    • read

      protected void read(Token token) throws CtxEvalException
      Throws:
      CtxEvalException
    • reduceTreeLevel

      public boolean reduceTreeLevel() throws CtxEvalException
      Invoked on the end of siblings processing. End of macros tree level processing. Should union edge with parent, push the union result into tokens, return new edge. Or return false if no parent to union with and this is a root level.
      Throws:
      CtxEvalException
    • assertEvaluationEnded

      public void assertEvaluationEnded() throws CtxEvalException
      Evaluation result will be in state text.
      Throws:
      CtxEvalException
    • createChildContext

      protected abstract T createChildContext(@Nonnull T parent, @Nonnull String macro)
    • toString

      public String toString()
      Overrides:
      toString in class Object