com.phoenix_int.aserver.util
Class Hierarchy
Parser
Declaration
- This class works by remembering what things have changed, but not actually performing the changes until the file is written out. This prevents changes to one place in the file from messing up something elsewhere.
- Note however that there is a requirement that no changes overlap or are repeated. For example, you may not set the value of one token twice (the results of which are undefined). Neither may you change a token, then change the delimiters and change another token that includes part of the first. The same holds true for adding and removing lines. You may not add or remove lines to sections of the file previously altered.
Nested Class Summary
Field Summary
Constructor Summary
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail
RESIZE_DISALLOW
RESIZE_ROWS
LAST
RANDOM_ACCESS
Parser.Mode.RANDOM
BUFFERED
Parser.Mode.BUFFERED
AUTOMATIC
Parser.Mode.AUTOMATIC
FILE_SIZE_LIMIT
Parser.Mode.FILE_SIZE_LIMIT cut-off limit of file size to use buffers for row files
See Also:
Constructor Detail
PHXFileParser
java.io.IOException
PHXFileParser
fileName- the file to load
java.io.IOException- if there is a problem opening the file
PHXFileParser
java.io.IOException
PHXFileParser
java.io.IOException
PHXFileParser
java.io.IOException
PHXFileParser
java.io.IOException
PHXFileParser
PHXFileParser(String, Parser.Mode)
Parameters:
fileName- the file to loadmethod- the method used to parse the file.RANDOM_ACCESSwill scan the data file as needed.BUFFEREDwill read the file into a buffer prior to parsing.RANDOM_ACCESSis better for large files, but will be slower for small (<50k) files.BUFFEREDis also preferable for parsing many variables from a file or for performing large numbers of searches.
java.io.IOException- if there is a problem opening the file
PHXFileParser
store- The source of lines for the file parser.fileName- The name of the file for errors and advisories. This parameter is not used for any actual processing
Method Detail
getLineStore
- the line store used by the parser
getFileName
- the name of the file
writeTo
java.io.IOException
writeTo
java.io.IOException
writeTo
java.io.IOException
writeTo
writeToin interfaceParser
fw- the stream to save to
java.io.IOException- thrown if the file cannot be written to
close
Parser
Close the parser
Specified by:
closein interfaceParser
closeFile
PHXRandomAccessFileLineStore
resetDelimiters
getDelimiters
setDelimiters
delimiters- the delimiters to use for parsing
getDecimalSeparator
- decimal separator character
setDecimalSeparator
separator- decimal separator to use when parsing floating point literals
markBeginning
row- the row where the new beginning will occur. This row becomes row 1.
PHXNoSuchTokenException- thrown if the token is not found
markEnd
row- the row where the new ending will occur. This row becomes the last row.
PHXNoSuchTokenException- thrown if the token is not found
markBeginningOffset
offset- the offset from the current starting line
java.lang.IllegalArgumentException- thrown if the specified offset moves past the end or beginning of the file
markBeginning
markBeginning with an occurrence value of 1
Parameters:
string- the pattern that marks the new first lineisRegex- iftrue, the pattern is a regular expression
PHXNoSuchTokenException- thrown if the token is not found
markBeginning
markBeginning where the pattern is a regex and occurrence value is 1
Parameters:
string- the pattern that marks the new first line
PHXNoSuchTokenException- thrown if the token is not found
markBeginning
string- the search patternoccurrence- the number of times to search for the pattern. may be negative to search from endisRegex- iftrue, the string is a regular expression.
PHXNoSuchTokenException- thrown if the token is not found
markBeginning
string- the search patternoccurrence- the number of times to search for the pattern. may be negative to search from end
PHXNoSuchTokenException- thrown if the token is not found
markEndOffset
offset- the offset from the current starting line
java.lang.IllegalArgumentException- thrown if the specified offset moves past the end or beginning of the file
markEnd
markEnd with an occurrence value of 1
Parameters:
string- the pattern that marks the new first lineisRegex- iftrue, the pattern is a regular expression
PHXNoSuchTokenException- thrown if the token is not found
markEnd
string- the pattern that marks the new last lineisRegex- iftrue, the pattern is a regular expressionoccurrence- the number of times to search for regex value may be negative to search from beginning
PHXNoSuchTokenException- thrown if the token is not found
markEnd
string- the pattern that marks the new last lineoccurrence- the number of times to search for regex value may be negative to search from end
PHXNoSuchTokenException- thrown if the token is not found
markBeginningFromEnd
string- the pattern that marks the new first lineisRegex- iftrue, the pattern is a regular expression
PHXNoSuchTokenException- thrown if the token is not found
markEndFromEnd
string- the pattern that marks the new first lineisRegex- iftrue, the pattern is a regular expression
PHXNoSuchTokenException- thrown if the token is not found
clearMarks
getToken
string- the value to search foroccurrence- the number of times to match the searchrowOffset- row relative to the search results where the token is foundfield- the field in the specified row for the token
- the token found
PHXNoSuchTokenException- thrown if the token is not found
getToken
string- the value to search forrowOffset- row relative to the search results where the token is foundfield- the field in the specified row for the token
- the token found
PHXNoSuchTokenException- thrown if the token is not found
getToken
row- the row that the token is onfield- the field in the specified row for the token
- the token found at
row, field
PHXNoSuchTokenException- thrown if the token is not found
getToken
row- the row that the token is onstartCol- the start columnendCol- the end column
- the token between
startColandendColon row row
PHXNoSuchTokenException- thrown if the token is not found
getToken
getToken(row, 2, 4, " \t,=") would return [1.5,2.5,3.5].
Parameters:
row- the row that the tokens are onstartField- the start field (inclusive)endField- the end field (inclusive)delimiter- the delimiters
- the token between
startFieldandendField(all inclusive) on rowrow
PHXNoSuchTokenException- thrown if the token is not found
setToken
string- the value to search foroccurrence- the number of times to match the searchrowOffset- row relative to the search results where the token is foundfield- the field in the specified row for the tokenreplacement- the string to substitute into the field
PHXNoSuchTokenException- thrown if the token is not found
setToken
string- the value to search forrowOffset- row relative to the search results where the token is foundfield- the field in the specified row for the tokenreplacement- the string to substitute into the field
PHXNoSuchTokenException- thrown if the token is not found
setToken
row- the row that the token is onfield- the field in the specified row for the tokenreplacement- the string to substitute into the field
PHXNoSuchTokenException- thrown if the token is not found
setToken
row- the row that the token is onstartCol- the start columnendCol- the end columnreplacement- the string to substitute into the field
PHXNoSuchTokenException- thrown if the token is not found
addLines
addLines
removeLines
countTokens
row- the row to count tokens
- the number of tokens on the specified row
PHXNoSuchTokenException- thrown if the row specified is invalid
getColumnArray
startRow- the row for the first element in the arrayendRow- the row for the last element in the arrayfield- the field in the specified row for the token
- an array of String tokens
PHXNoSuchTokenException- thrown if a token is not found
getRowArray
startCol- the field for the first element in the arrayendCol- the field for the last element in the arrayrow- the row to extract tokens from
- an array of String tokens
PHXNoSuchTokenException- thrown if a token is not found
getMatrixArray
startRow- the row for the first element in the arraystartField- the field for the first element in the arrayendRow- the row for the last element in the arrayendField- the field for the last element in the array
- an array of String tokens
PHXNoSuchTokenException- thrown if a token is not found
getMatrixArray2d
startRow- the row for the first element in the arraystartField- the field for the first element in the arrayendRow- the row for the last element in the arrayendField- the field for the last element in the array
- an array of String tokens
PHXNoSuchTokenException- thrown if a token is not found
getMatrixArray
startRow- the row for the first element in the arraystartCol- the column for the first element in the arrayendRow- the row for the last element in the arrayendCol- the column for the last element in the arrayfieldWidth- UNUSED. How wide one field is.
- an array of String tokens
PHXNoSuchTokenException- thrown if a token is not found
setMatrixArray
startRow- the row for the first element in the arraystartCol- the field for the first element in the arrayendRow- the row for the last element in the arrayendCol- the field for the last element in the arrayarray- the values
PHXNoSuchTokenException- thrown if a token is not found
setMatrixArray
startRow- the row for the first element in the arraystartCol- the field for the first element in the arrayendRow- the row for the last element in the arrayendCol- the field for the last element in the arrayarray- the valuesresizeStyle- How to resize (RESIZE_DISALLOW,RESIZE_ROWS)
PHXNoSuchTokenException- thrown if a token is not found
setMatrixArray2d
startRow- the row for the first element in the arraystartCol- the field for the first element in the arrayendRow- the row for the last element in the arrayendCol- the field for the last element in the arrayarray- the valuesresizeStyle- How to resize (RESIZE_DISALLOW,RESIZE_ROWS)
PHXNoSuchTokenException- thrown if a token is not found
setMatrixArray
startRow- the row for the first element in the arraystartCol- the field for the first element in the arrayendRow- the row for the last element in the arrayendCol- the field for the last element in the arrayfieldWidth- UNUSED. How wide one field is.array- the values
PHXNoSuchTokenException- thrown if a token is not found
setMatrixArray
startRow- the row for the first element in the arraystartCol- the field for the first element in the arrayendRow- the row for the last element in the arrayendCol- the field for the last element in the arrayfieldWidth- UNUSED. How wide one field is.array- the valuesresizeStyle- How to resize (RESIZE_DISALLOW,RESIZE_ROWS)
PHXNoSuchTokenException- thrown if a token is not found