|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.sc3d.apt.sss.v3.Sentence
public class Sentence
Represents a sequence of characters that need to be parsed, and allows error messages to be attached to it.
| Field Summary | |
|---|---|
int |
length
The number of characters in this Sentence. |
| Constructor Summary | |
|---|---|
Sentence(char[] cs)
Constructs a Sentence given an array of characters. |
|
| Method Summary | |
|---|---|
void |
addError(java.lang.String message,
int index,
int length)
Attaches an error message to part of this Sentence. |
void |
addErrorAtEnd(java.lang.String message)
Equivalent to 'addError(message, length, 0). |
int |
countErrors()
Returns the number of errors attached to this Sentence. |
char |
get(int index)
Returns the character at 'index'. |
java.lang.String |
getString(int index,
int length)
Returns part of this Sentence as a String. |
static void |
main(java.lang.String[] args)
Takes one argument: a filename. |
void |
printErrorReport(java.io.PrintStream out,
int maxErrors)
Prints an error report to 'out'. |
static Sentence |
readFile(java.lang.String filename)
Reads the named file and returns it as a Sentence. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final int length
| Constructor Detail |
|---|
public Sentence(char[] cs)
| Method Detail |
|---|
public char get(int index)
public java.lang.String getString(int index,
int length)
index - the index at which the desired String starts.length - the length of the desired String.
public void addError(java.lang.String message,
int index,
int length)
message - the error message.index - the index of the first character to which the error message applies. Must be in the range from '0' to 'this.length' inclusive.length - the number of characters to which this error message applies.public void addErrorAtEnd(java.lang.String message)
public int countErrors()
public void printErrorReport(java.io.PrintStream out,
int maxErrors)
out - a PrintStream to which to print the error report.maxErrors - the maximum number of errors to print.
public static Sentence readFile(java.lang.String filename)
throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args)
throws java.io.IOException
java.io.IOException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||