org.thewonderlemming.c4plantuml.graphml

## Class C4GraphParseTreeListener

- java.lang.Object
- - org.thewonderlemming.c4plantuml.graphml.C4GraphParseTreeListener

- All Implemented Interfaces:
    org.antlr.v4.runtime.tree.ParseTreeListener, C4L1ParserListenerDecorator, C4L2ParserListenerDecorator, C4L3ParserListenerDecorator, org.thewonderlemming.c4plantuml.grammars.generated.C4L1ParserListener, org.thewonderlemming.c4plantuml.grammars.generated.C4L2ParserListener, org.thewonderlemming.c4plantuml.grammars.generated.C4L3ParserListener

      public class C4GraphParseTreeListener
      extends Object
      implements C4L1ParserListenerDecorator, C4L2ParserListenerDecorator, C4L3ParserListenerDecorator

  An implementation of the ANTLR 4 `ParseTreeListener` that translates the C4 syntax tree to a JAXB model..
  Author:
    thewonderlemming

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `C4GraphParseTreeListener(GraphMLModel model)` A constructor that turns off the failing of the process on syntax errors.
    `C4GraphParseTreeListener(GraphMLModel model, boolean throwOnParseError)` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `enterEveryRule(org.antlr.v4.runtime.ParserRuleContext ctx)` Does nothing.
    `void` | `exitEveryRule(org.antlr.v4.runtime.ParserRuleContext ctx)` Does nothing.
    `org.thewonderlemming.c4plantuml.grammars.generated.C4L1ParserListener` | `getDecoratedC4L1ParserListener()` returns the instance of the `C4L1ParserListener` being decorated.
    `org.thewonderlemming.c4plantuml.grammars.generated.C4L2ParserListener` | `getDecoratedC4L2ParserListener()` returns the instance of the `C4L2ParserListener` being decorated.
    `org.thewonderlemming.c4plantuml.grammars.generated.C4L3ParserListener` | `getDecoratedC4L3ParserListener()` returns the instance of the `C4L3ParserListener` being decorated.
    `void` | `parseTree(org.antlr.v4.runtime.tree.ParseTree tree, Path currentPath)` Initializes the inner parsers and walks through the given `ParseTree` to fill in the `GraphMLModel`.
    `void` | `visitErrorNode(org.antlr.v4.runtime.tree.ErrorNode node)` Logs syntax errors and throws a `C4ParseException` if the `throwOnParseError` flag is truned on.
    `void` | `visitTerminal(org.antlr.v4.runtime.tree.TerminalNode node)` Does nothing.
    `void` | `wrapUp()` Merges the computes graphs into the given `GraphMLModel` instance.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.thewonderlemming.c4plantuml.grammars.C4L1ParserListenerDecorator

      `enterBoundary, enterCloud, enterComma, enterDiagram, enterEnterprise_boundary, enterFooter, enterInclude, enterL1_title, enterLayout, enterPerson_ext, enterPerson, enterRelationship, enterStatement, enterSystem_ext, enterSystem, enterTitle, exitBoundary, exitCloud, exitComma, exitDiagram, exitEnterprise_boundary, exitFooter, exitInclude, exitL1_title, exitLayout, exitPerson_ext, exitPerson, exitRelationship, exitStatement, exitSystem_ext, exitSystem, exitTitle`

    - ### Methods inherited from interface org.thewonderlemming.c4plantuml.grammars.C4L2ParserListenerDecorator

      `enterBoundary, enterCloud, enterComma, enterContainer, enterDiagram, enterEnterprise_boundary, enterFooter, enterInclude, enterL2_title, enterLayout, enterPerson_ext, enterPerson, enterRelationship, enterStatement, enterSystem_boundary, enterSystem_ext, enterSystem, enterTitle, exitBoundary, exitCloud, exitComma, exitContainer, exitDiagram, exitEnterprise_boundary, exitFooter, exitInclude, exitL2_title, exitLayout, exitPerson_ext, exitPerson, exitRelationship, exitStatement, exitSystem_boundary, exitSystem_ext, exitSystem, exitTitle`

    - ### Methods inherited from interface org.thewonderlemming.c4plantuml.grammars.C4L3ParserListenerDecorator

      `enterBoundary, enterCloud, enterComma, enterComponent, enterContainer_boundary, enterContainer, enterDiagram, enterEnterprise_boundary, enterFooter, enterInclude, enterL3_title, enterLayout, enterPerson_ext, enterPerson, enterRelationship, enterStatement, enterSystem_ext, enterSystem, enterTitle, exitBoundary, exitCloud, exitComma, exitComponent, exitContainer_boundary, exitContainer, exitDiagram, exitEnterprise_boundary, exitFooter, exitInclude, exitL3_title, exitLayout, exitPerson_ext, exitPerson, exitRelationship, exitStatement, exitSystem_ext, exitSystem, exitTitle`

- - ### Constructor Detail

    - #### C4GraphParseTreeListener

          public C4GraphParseTreeListener(GraphMLModel model)

      A constructor that turns off the failing of the process on syntax errors.
      Parameters:
        `model` - the empty JAXB model instance to fill in.

    - #### C4GraphParseTreeListener

          public C4GraphParseTreeListener(GraphMLModel model,
                                          boolean throwOnParseError)

      Default constructor.
      Parameters:
        `model` - the empty JAXB model instance to fill in.
        `throwOnParseError` - a flag that tells whether or not the process should stop and throw on syntax errors.

  - ### Method Detail

    - #### enterEveryRule

          public void enterEveryRule(org.antlr.v4.runtime.ParserRuleContext ctx)

      Does nothing.

      Specified by:
        `enterEveryRule` in interface `org.antlr.v4.runtime.tree.ParseTreeListener`

    - #### exitEveryRule

          public void exitEveryRule(org.antlr.v4.runtime.ParserRuleContext ctx)

      Does nothing.

      Specified by:
        `exitEveryRule` in interface `org.antlr.v4.runtime.tree.ParseTreeListener`

    - #### getDecoratedC4L1ParserListener

          public org.thewonderlemming.c4plantuml.grammars.generated.C4L1ParserListener getDecoratedC4L1ParserListener()

      returns the instance of the `C4L1ParserListener` being decorated.
      Specified by:
        `getDecoratedC4L1ParserListener` in interface `C4L1ParserListenerDecorator`
      Returns:
        the decorated `C4L1ParserListener`.

    - #### getDecoratedC4L2ParserListener

          public org.thewonderlemming.c4plantuml.grammars.generated.C4L2ParserListener getDecoratedC4L2ParserListener()

      returns the instance of the `C4L2ParserListener` being decorated.
      Specified by:
        `getDecoratedC4L2ParserListener` in interface `C4L2ParserListenerDecorator`
      Returns:
        the decorated `C4L2ParserListener`.

    - #### getDecoratedC4L3ParserListener

          public org.thewonderlemming.c4plantuml.grammars.generated.C4L3ParserListener getDecoratedC4L3ParserListener()

      returns the instance of the `C4L3ParserListener` being decorated.
      Specified by:
        `getDecoratedC4L3ParserListener` in interface `C4L3ParserListenerDecorator`
      Returns:
        the decorated `C4L3ParserListener`.

    - #### parseTree

          public void parseTree(org.antlr.v4.runtime.tree.ParseTree tree,
                                Path currentPath)

      Initializes the inner parsers and walks through the given `ParseTree` to fill in the `GraphMLModel`.
      Parameters:
        `tree` - the `ParseTree` instance that represents the current C4 source file (an AST).
        `currentPath` - the path to the current C4 source file.

    - #### visitErrorNode

          public void visitErrorNode(org.antlr.v4.runtime.tree.ErrorNode node)

      Logs syntax errors and throws a `C4ParseException` if the `throwOnParseError` flag is truned on.

      Specified by:
        `visitErrorNode` in interface `org.antlr.v4.runtime.tree.ParseTreeListener`

    - #### visitTerminal

          public void visitTerminal(org.antlr.v4.runtime.tree.TerminalNode node)

      Does nothing.

      Specified by:
        `visitTerminal` in interface `org.antlr.v4.runtime.tree.ParseTreeListener`

    - #### wrapUp

          public void wrapUp()
                      throws Throwable

      Merges the computes graphs into the given `GraphMLModel` instance.
      Throws:
        `Throwable` - if any exception was collected during the process.

Copyright © 2020. All rights reserved.