Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## UI.Run
Class GEVAStreamParser<E extends GEVAStreamParser.Event>

    java.lang.Object
      UI.Run.GEVAStreamParser<E>

All Implemented Interfaces:
  GEVAStreamReader.Listener

Direct Known Subclasses:
  GEVAConfigurationStreamParser, GEVAErrorStreamParser, GEVAGlobalStreamParser, GEVAGraphStreamParser.DataStreamParser, GEVAGraphStreamParser.LabelStreamParser, GEVALSystemStreamParser, GEVAStandardStreamParser

    public abstract class GEVAStreamParser<E extends GEVAStreamParser.Event>

extends java.lang.Object
implements GEVAStreamReader.Listener

Base class from which all parsers are derived. This also handles dispatching the event to the listeners of the event as well as contains the base Event class. Inheriting classes should also fill the E template with the type of events it generates when it parses. Note. all the parsers that inherit from this need to be registered with the GEVAStreamReader through the addListener method and this is currently (2008y08M08d) done in GEVARun under the comment '//[BEGIN_STREAM_LISTENER[' To create a new parser, first create a new class that extends from this class. In the new class, add a new nested Event class that extends from this class's nested Event class and pass the event class name as the template parameter when extending this class in the format ClassName.EventName. All current (2008y08M08d) extended classes of this class use a singleton pattern, so this could be added too. Implement the abstract parseLine which takes in a Line object (defined as nested class within this class). This can be used to get the line text as well as communicate with other parsers (all parsers receive the same Line object which is mutable). Parse the line text and if it's something that the parser understands, generate an event for it by calling super.fireParserListener passing as instance of the nested Event class and it will be dispatched to all listeners. To add listeners to the new parser, this is currently (2008y08M08d) done in GEVARun under the comment '//[BEGIN_STREAM_LISTENER[' Note. if adding a new parser to parse the output GEVA writes about its configuration, instead, update the GEVAConfigurationStreamParser's Event and parseLine details. GEVAConfigurationStreamParser is set up to parse all these details, and only generate one event after they've all been parsed, rather than one event per line like most other parsers. The end of the configuration is determined by watching for the line containing Constants.GRAPH_DATA_BEGIN (currently (2008y08M08d) "#---Data---")

Author:
  eliott bartley

Nested Class Summary
`protected static class` | `GEVAStreamParser.Event` Base listen event class.
`static class` | `GEVAStreamParser.Extension` Base from which all extensions inherit
`protected class` | `GEVAStreamParser.Line` Proxy to GEVAStreamReader.Event to pass on to inheriting classes so they don't have to deal with the Reader directly.
`protected static class` | `GEVAStreamParser.LineEvent` Base listen event class, which simply gives the listener the line that was (or wasn't, as the case may be when using this event) parsed
`protected static interface` | `GEVAStreamParser.Listener<E>` Listener interface which inheriting classes must extend, even if just to an empty type, so that listeners can listen on the specific listener for a given class

Field Summary
`static int` | `ID_ERR_OUT` Write using error formatting
`static int` | `ID_STD_OUT` Write using output formatting

Constructor Summary
`GEVAStreamParser()`

Method Summary
`void` | `addParserListener(GEVAStreamParser.Listener<E> listener)` Add a class to listen to parsing events by the inheriting parser
`static void` | `begin()`
`static void` | `end()`
`protected void` | `fireParserListener(E event)` Called by inheriting classes when they have to say lineParsed to any listening listeners.
`void` | `injectLine(java.lang.String text)` Fake a stream reader event causing all listeners to be notified of the line passed in as if it came from ID_STD_OUT
`void` | `injectLine(java.lang.String text, int streamId)` Fake a stream reader event causing all listeners to be notified of the line passed in as if it came from the given streamId
`protected abstract void` | `parseLine(GEVAStreamParser.Line line)` Parse the line and generate the necessary events by calling fireParserListener.
`void` | `removeParserListener(GEVAStreamParser.Listener<E> listener)` Remove a class from listen to parsing events
`void` | `streamListener(GEVAStreamReader.Event event)` Listens to the stream reader for new lines to be parsed and sends them on to the inheriting class for parsing.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ID_STD_OUT

    public static final int ID_STD_OUT

  Write using output formatting

  See Also:
    Constant Field Values

### ID_ERR_OUT

    public static final int ID_ERR_OUT

  Write using error formatting

  See Also:
    Constant Field Values

Constructor Detail

### GEVAStreamParser

    public GEVAStreamParser()

Method Detail

### begin

    public static void begin()

### end

    public static void end()

### streamListener

    public final void streamListener(GEVAStreamReader.Event event)

  Listens to the stream reader for new lines to be parsed and sends them on to the inheriting class for parsing. This will not pass on line containing null values

  Specified by:
    `streamListener` in interface `GEVAStreamReader.Listener`

### injectLine

    public void injectLine(java.lang.String text,
                           int streamId)

  Fake a stream reader event causing all listeners to be notified of the line passed in as if it came from the given streamId

### injectLine

    public void injectLine(java.lang.String text)

  Fake a stream reader event causing all listeners to be notified of the line passed in as if it came from ID_STD_OUT

### parseLine

    protected abstract void parseLine(GEVAStreamParser.Line line)

  Parse the line and generate the necessary events by calling fireParserListener. This will not be called for end-of-stream events

### addParserListener

    public void addParserListener(GEVAStreamParser.Listener<E> listener)

  Add a class to listen to parsing events by the inheriting parser

### removeParserListener

    public void removeParserListener(GEVAStreamParser.Listener<E> listener)

  Remove a class from listen to parsing events

### fireParserListener

    protected void fireParserListener(E event)

  Called by inheriting classes when they have to say lineParsed to any listening listeners. Inheriting classes must determine the E template

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD