sjm.parse
Class Sequence

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

public class Sequence
extends CollectionParser

A Sequence object is a collection of parsers, all of which must in turn match against an assembly for this parser to successfully match.

Version:
1.0
Author:
Steven J. Metsker

Fields inherited from class sjm.parse.CollectionParser
subparsers
 
Fields inherited from class sjm.parse.Parser
assembler, name
 
Constructor Summary
Sequence()
          Constructs a nameless sequence.
Sequence(java.lang.String name)
          Constructs a sequence with the given name.
 
Method Summary
 void accept(ParserVisitor pv, java.util.Vector visited)
          Accept a "visitor" and a collection of previously visited parsers.
 java.util.Vector match(java.util.Vector in)
          Given a set of assemblies, this method matches this sequence against all of them, and returns a new set of the assemblies that result from the matches.
protected  java.util.Vector randomExpansion(int maxDepth, int depth)
           
protected  java.lang.String toStringSeparator()
          Helps to textually describe this CollectionParser.
 
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

Sequence

public Sequence()
Constructs a nameless sequence.

Sequence

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

accept

public void accept(ParserVisitor pv,
                   java.util.Vector visited)
Accept a "visitor" and a collection of previously visited parsers.
Overrides:
accept in class Parser
Parameters:
ParserVisitor - the visitor to accept
Vector - a collection of previously visited parsers

match

public java.util.Vector match(java.util.Vector in)
Given a set of assemblies, this method matches this sequence against all of them, and returns a new set of the assemblies that result from the matches.
Overrides:
match in class Parser
Parameters:
Vector - a vector of assemblies to match against
Returns:
a Vector of assemblies that result from matching against a beginning set of assemblies

randomExpansion

protected java.util.Vector randomExpansion(int maxDepth,
                                           int depth)
Overrides:
randomExpansion in class Parser

toStringSeparator

protected java.lang.String toStringSeparator()
Description copied from class: CollectionParser
Helps to textually describe this CollectionParser.
Overrides:
toStringSeparator in class CollectionParser