Class Fragment

java.lang.Object
org.kigalisim.lang.fragment.Fragment
Direct Known Subclasses:
AboutStanzaFragment, ApplicationFragment, DuringFragment, OperationFragment, PolicyFragment, ProgramFragment, ScenarioFragment, ScenariosFragment, StringFragment, SubstanceFragment, UnitFragment

public abstract class Fragment extends Object
Description of a part of a parsed QubecTalk program.

Description of a part of a parsed QubecTalk program that provides a type which can be used to facilitate the ANTLR visitor.

  • Constructor Details

    • Fragment

      public Fragment()
      Constructs a new Fragment.
  • Method Details

    • getString

      public String getString()
      Get the string parsed from the source of this fragment.
      Returns:
      The string found on this fragment.
    • getOperation

      public Operation getOperation()
      Get the calculation parsed from the source of this fragment.
      Returns:
      Operation which can be resolved to an EngineNumber at runtime.
    • getUnit

      public String getUnit()
      Get the units that should be applied to the result of a calculation or to an EngineNumber.
      Returns:
      Parsed units as a string.
    • getDuring

      public ParsedDuring getDuring()
      Get the during that should be applied in filtering if an operation should be applied.
      Returns:
      Parsed during.
    • getProgram

      public ParsedProgram getProgram()
      Get the program parsed from the source of this fragment.
      Returns:
      Parsed program.
    • getPolicy

      public ParsedPolicy getPolicy()
      Get the policy parsed from the source of this fragment.
      Returns:
      Parsed policy.
    • getScenario

      public ParsedScenario getScenario()
      Get the scenario parsed from the source of this fragment.
      Returns:
      Parsed scenario.
    • getApplication

      public ParsedApplication getApplication()
      Get the application parsed from the source of this fragment.
      Returns:
      Parsed application.
    • getSubstance

      public ParsedSubstance getSubstance()
      Get the substance parsed from the source of this fragment.
      Returns:
      Parsed substance.
    • getScenarios

      public ParsedScenarios getScenarios()
      Get the scenarios parsed from the source of this fragment.
      Returns:
      The parsed scenarios.
    • getIsStanzaScenarios

      public boolean getIsStanzaScenarios()
      Check if this fragment is a scenarios stanza.
      Returns:
      True if this fragment is a scenarios stanza, false if another stanza.
      Throws:
      RuntimeException - Thrown if requested on a non-stanza.
    • getIsStanzaPolicyOrDefault

      public boolean getIsStanzaPolicyOrDefault()
      Check if this fragment is a policy stanza (or default).
      Returns:
      True if policy stanza, false if another stanza.
      Throws:
      RuntimeException - Thrown if requested on a non-stanza.