org.sc3d.apt.sss.v3
Class Match

java.lang.Object
  extended by org.sc3d.apt.sss.v3.Match

public class Match
extends java.lang.Object

Represents a bracket matching analysis of a Sentence.


Field Summary
 int numTokens
          The number of Tokens in 'sentence', after all Tokens inside brackets have been grouped into instances of Bracket.
 Sentence sentence
          The sentence of which this is a bracket matching analysis.
 
Method Summary
 Token getToken(int index)
          Returns the Token with index 'index'.
static void main(java.lang.String[] args)
          Takes one argument: a filename.
static Match make(Lex lex)
          Tries to construct and return a Match for 'lex.sentence'.
 Token[] toArray()
          Returns all the Tokens in a fresh array of length 'numTokens'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sentence

public final Sentence sentence
The sentence of which this is a bracket matching analysis.


numTokens

public final int numTokens
The number of Tokens in 'sentence', after all Tokens inside brackets have been grouped into instances of Bracket.

Method Detail

make

public static Match make(Lex lex)
Tries to construct and return a Match for 'lex.sentence'. If the brackets don't match, this method attaches appropriate error messages to the Sentence and returns 'null'.


getToken

public Token getToken(int index)
Returns the Token with index 'index'.

Parameters:
index - a number from '0' to 'numTokens-1'.

toArray

public Token[] toArray()
Returns all the Tokens in a fresh array of length 'numTokens'.


main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Takes one argument: a filename.

Throws:
java.io.IOException