|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectplatypus.Infile
public class Infile
Handles input file I/O functions. Note that in Platypus, all input files are read into memory (into an array of lines) when opened. They are then closed. And we work from the array of lines.
| Field Summary | |
|---|---|
(package private) int |
commentLines
used only for unit testing purposes |
(package private) int |
currLineNumber
the line number in the original input file (from ReadLine) |
private java.lang.String |
filename
the name of the input file |
(package private) GDD |
gdd
|
(package private) GID |
gid
|
private static int |
textLineIndex
this is the index to the textLines ArrayList that holds the lines of text. |
(package private) java.util.ArrayList<ReadLine> |
textLines
array of ReadLines into which Infile is parsed |
| Constructor Summary | |
|---|---|
Infile(java.lang.String name)
|
|
| Method Summary | |
|---|---|
(package private) java.lang.String |
composeEndOfComment(int start,
java.lang.String textline)
Accepts a line of text and an index of the first character of an opening comment block. |
boolean |
doesExist()
Verifies the existence of a specific file. |
java.lang.String |
getFilename()
|
int |
getLine()
Gets the next line in the ArrayList of parsed lines from the input file. |
int |
getLineCount()
used primarily (exclusively?) in unit tests |
int |
getLineNumber()
returns the current line number being handled by Infile |
java.util.ArrayList<ReadLine> |
getTextLines()
|
void |
incrementLineCount()
convenience function for incrementing the pointer to the next line in the input stream |
boolean |
isReadable()
Verifies that the file can be read. |
int |
readFile()
Reads the input file on a line basis, adding each line to an ArrayList for later processing. |
(package private) boolean |
startsWithEndOfBlockComment(java.lang.String line)
Determines whether a line that starts with %% is part of a closing comment block. |
int |
stripBlockComments()
Remove block comments from textLines array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String filename
java.util.ArrayList<ReadLine> textLines
int currLineNumber
int commentLines
GID gid
GDD gdd
private static int textLineIndex
| Constructor Detail |
|---|
public Infile(java.lang.String name)
| Method Detail |
|---|
public int readFile()
boolean startsWithEndOfBlockComment(java.lang.String line)
line - the line to check
public int stripBlockComments()
java.lang.String composeEndOfComment(int start,
java.lang.String textline)
start - index into textline that points to where the opening marker beginstextline - the line of text with the opening block comment marker embedded
public int getLine()
public boolean doesExist()
public boolean isReadable()
public void incrementLineCount()
public java.lang.String getFilename()
public java.util.ArrayList<ReadLine> getTextLines()
public int getLineNumber()
public int getLineCount()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||