Package source

Class SourceOutput


  • public final class SourceOutput
    extends java.lang.Object
    The SourceOutput class is used to store the output of the compilation process.

    The output can be retrieved in two forms: its raw String form, or in the form of a TextFlow object. The former is used for internal used (e.g. testing), whilst the latter is used for the GUI.

    Note that depending on how the compiler was run and the input passed to it, no values may be returned by the Evaluator and therefore by this class.

    Since:
    1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      SourceOutput​(Evaluator evaluator, ErrorHandler errorHandler)
      Constructs a SourceOutput object initialised with the result calculated by the Evaluator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javafx.scene.text.TextFlow getOutput()
      Return the compilation output as a TextFlow object.
      java.lang.String getRawOutput()
      Return the compilation output as a String.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SourceOutput

        public SourceOutput​(Evaluator evaluator,
                            ErrorHandler errorHandler)
        Constructs a SourceOutput object initialised with the result calculated by the Evaluator.

        On creation, the Evaluator is immediately called to evaluate and return the compilation result.

        Parameters:
        evaluator - The Evaluator used to generate the output
        errorHandler - The ErrorHandler used to report any errors that occurred during compilation
    • Method Detail

      • getOutput

        public javafx.scene.text.TextFlow getOutput()
        Return the compilation output as a TextFlow object.

        If any errors occurred during compilation, they will be returned instead.

        This method is intended to be used by the GUI.

        Returns:
        the output as a TextFlow
      • getRawOutput

        public java.lang.String getRawOutput()
        Return the compilation output as a String.

        If any errors occurred during compilation, they will be returned instead.

        This method is intended for internal use.

        Returns:
        the output as a String