Building Parsers with Java

sjm.examples.track
Class Track

java.lang.Object
  |
  +--sjm.parse.Parser
        |
        +--sjm.parse.CollectionParser
              |
              +--sjm.parse.Sequence
                    |
                    +--sjm.examples.track.Track

public class Track
extends Sequence

A Track is a sequence that throws a TrackException if the sequence begins but does not complete.


Fields inherited from class sjm.parse.CollectionParser
subparsers
 
Fields inherited from class sjm.parse.Parser
assembler, name
 
Constructor Summary
Track()
          Constructs a nameless Track.
Track(java.lang.String name)
          Constructs a Track with the given name.
 
Method Summary
 java.util.Vector match(java.util.Vector in)
          Given a collection of assemblies, this method matches this track against all of them, and returns a new collection of the assemblies that result from the matches.
protected  void throwTrackException(java.util.Vector previousState, Parser p)
           
 
Methods inherited from class sjm.parse.Sequence
accept, randomExpansion, toStringSeparator
 
Methods inherited from class sjm.parse.CollectionParser
add, getSubparsers, unvisitedString
 
Methods inherited from class sjm.parse.Parser
accept, add, best, bestMatch, completeMatch, elementClone, getName, matchAndAssemble, randomInput, setAssembler, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Track

public Track()
Constructs a nameless Track.

Track

public Track(java.lang.String name)
Constructs a Track with the given name.
Parameters:
name - a name to be known by
Method Detail

match

public java.util.Vector match(java.util.Vector in)
Given a collection of assemblies, this method matches this track against all of them, and returns a new collection of the assemblies that result from the matches. If the match begins but does not complete, this method throws a TrackException.
Overrides:
match in class Sequence
Parameters:
Vector - a vector of assemblies to match against
Returns:
a Vector of assemblies that result from matching against a beginning set of assemblies

throwTrackException

protected void throwTrackException(java.util.Vector previousState,
                                   Parser p)

by Steve Metsker