Skip to main content
Package:
  • com.phoenix_int.aserver.util.scriptwrapper.api
Class Hierarchy
Implemented Interfaces
Declaration
Class implements the parsing capabilities of the RowField type files from the fileWrapper facility. Typical use would be to write a function which creates an instance of this class and implements the parsing using the transferVar() function. Then, a mode can be passed in which specifies whether the function should read the template file, generate an input file, or parse an output file. You will want to read the documentation on the fileWrapper utility for more specifics on how exactly the file parsing and options work. Example usage from a java scriptwrapper (Comments show fileWrapper equivalents):

Nested Class Summary

Nested classes/interfaces inherited from interface com.phoenix_int.aserver.util.scriptwrapper.api.ParseableFile

ParseableFile.Mode

Field Summary

Fields inherited from class com.phoenix_int.aserver.util.scriptwrapper.api.AbstractFile

encoding, fileName, mode, parser, templateFileName, wrapper

Constructor Summary

Method Summary

Methods inherited from class com.phoenix_int.aserver.util.scriptwrapper.api.AbstractFile

actionByMode, backup, close, delete, getEncoding, getRealFile, readTemplate, setEncoding, setEncoding, setFileToGenerateOrParse, setTempEmbedded, setTemplateFile, setVariable

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.phoenix_int.aserver.util.scriptwrapper.api.ParseableFile

backup, close, delete, readTemplate, setFileToGenerateOrParse, setTempEmbedded, setTemplateFile, setVariable

Field Detail

GENERATE

Deprecated in favor of ParseableFile.Mode.GENERATE This mode makes the row field file prepare to generate the output file by reading the template file, then replacing the specified values passed to transferVar().

PARSE

Deprecated in favor of ParseableFile.Mode.PARSE This mode makes the row field file read in values from the fileToParse when transferVar() is called.

READ_TEMPLATE

Deprecated in favor of ParseableFile.Mode.READ_TEMPLATE This mode makes the row field file read in values from the template file when transferVar() is called.

Constructor Detail

PHXRowFieldFile

Defaults to ParseableFile.Mode.GENERATE Parameters:
  • wrapper - script-wrapper object

PHXRowFieldFile

PHXRowFieldFile

Deprecated in favor of PHXRowFieldFile(PHXScriptWrapperObject, ParseableFile.Mode) Parameters:
  • wrapper - The row field file will find files relative to the run directory specified in this wrapper object.
  • mode - parser mode

PHXRowFieldFile

Legacy (pre-QW) constructor. Note: Using this constructor will make the resultant object incompatible with certain methods. This was necessary for compatibility with QuickWrap. The new constructors accept PHXScriptWrapperObject. This constructor passes null instead. Parameters:
  • baseDirectory - All files will be relative to this directory
  • mode - parser mode

Method Detail

generate

Generate the input file Specified by:
  • generate in interface InputFile
Throws:

setFileToGenerate

Set the file to be generated Specified by:
  • setFileToGenerate in interface InputFile
Parameters:
  • fileName - file name

parse

Parse the output file Specified by:
  • parse in interface OutputFile
  • parse in interface OutputFile2
Throws:

setFileToParse

Set the file to be parsed Specified by:
  • setFileToParse in interface OutputFile
  • setFileToParse in interface OutputFile2
Parameters:
  • fileName - file name

newParser

Generate a new parser for the given file and mode Specified by:
  • newParser in class AbstractFile
Parameters:
  • rFile - The file to open
  • pmode - caching mode for underlying parser
Throws:
  • java.io.IOException

ensureFileParser

Ensure there is a valid parser Overrides:
  • ensureFileParser in class AbstractFile
Parameters:
  • mode - parser mode in current context
Throws:
  • java.io.IOException

defineSection

Throws:
  • com.phoenix_int.aserver.util.PHXNoSuchBookmarkException

defineBookmark

defineVar

Throws:

defineVar

Throws:

defineVar

Throws:

transferVars

Note that if wrapper is null, variable collection should be empty, and there should be no harm in calling this method. Transfer values for variables that have been defined using methods from the concrete implementation, i.e. defineVar(String, String, boolean, String) Variables defined using PHXScriptWrapperObject.addVariable(String, String, boolean) must be explicitly transferred using methods of the concrete implementation class. Specified by:
  • transferVars in class AbstractFile
Throws:

transferVar

Transfers the data for a particular variable. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable. Parameters:
  • var - The variable to read or write
  • row - The row in the file to read/write from/to.
  • field - The field within the row to read/write from/to.
Throws:

transferVar

Throws:

transferVar

Transfers the data for a particular variable. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable. Parameters:
  • var - The variable to read or write
  • row - The row in the file to read/write from/to.
  • field - The field within the row to read/write from/to.
  • fformat - The fortran style format string to apply. Pass null for standard formatting.
Throws:

transferVar

Throws:

transferArray

Transfers the data for a particular array. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable. Parameters:
  • var - The array to read or write
  • rowstart - The starting row in the file to read/write from/to
  • rowend - The ending row in the file to read/write from/to
  • fieldstart - The starting field within the row to read/write from/to
  • fieldend - The ending field within the row to read/write from/to
Throws:

transferArray

Transfers the data for a particular array. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable. Parameters:
  • var - The array to read or write
  • rowstart - The starting row in the file to read/write from/to
  • rowend - The ending row in the file to read/write from/to
  • fieldstart - The starting field within the row to read/write from/to
  • fieldend - The ending field within the row to read/write from/to
  • numDimensions - Either 1 or 2 to read/write 1 or 2-d arrays.
Throws:

transferArray

Transfers the data for a particular array. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable. Parameters:
  • var - The array to read or write
  • rowstart - The starting row in the file to read/write from/to
  • rowend - The ending row in the file to read/write from/to
  • fieldstart - The starting field within the row to read/write from/to
  • fieldend - The ending field within the row to read/write from/to
  • resizable - Whether or not the array is resizable when using ParseableFile.Mode.GENERATE.
  • fformat - The fortran style format string to apply. Pass null for standard formatting.
Throws:

transferArray

Transfers the data for a particular array. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable. Parameters:
  • var - The array to read or write
  • rowstart - The starting row in the file to read/write from/to
  • rowend - The ending row in the file to read/write from/to
  • fieldstart - The starting field within the row to read/write from/to
  • fieldend - The ending field within the row to read/write from/to
  • resizable - Whether or not the array is resizable when using ParseableFile.Mode.GENERATE.
  • fformat - The fortran style format string to apply. Pass null for standard formatting.
  • numDimensions - The number of dimensions to read the array as. Must be 1 or 2.
Throws:

transferKeyVar

Transfers the data for a particular variable. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable. Parameters:
  • var - The variable to read or write
  • key - The string to search for that identifies the variable in the file.
Throws:

transferKeyVar

Transfers the data for a particular variable. If mode is ParseableFile.Mode.GENERATE, data is read from the var and put into the file, otherwise data is read from the file into the variable. Parameters:
  • var - The variable to read or write
  • key - The string to search for that identifies the variable in the file.
  • occurrence - (default 1). Which occurrence of string to find.
  • rowOffset - (default 0). Once the string is found, offset by this many rows
  • field - (default 1). Once the string is found, offset by this many fields. If a negative number is used, it will count from the end of the row backwards, but will not count past the key variable.
  • fformat - The fortran style format string to apply. Pass null for standard formatting.
Throws:

readValue

Reads a value out of the input file. If mode is ParseableFile.Mode.PARSE, the input file is the fileToParse, otherwise it is the template file. Parameters:
  • row - The row of the file to read from
  • field - The field of the file to read from.
Throws:

readLong

Reads a value out of the input file. If mode is ParseableFile.Mode.PARSE, the input file is the fileToParse, otherwise it is the template file. Returns it as a long value. Parameters:
  • row - The row of the file to read from
  • field - The field of the file to read from.
Throws:

readDouble

Reads a value out of the input file. If mode is ParseableFile.Mode.PARSE, the input file is the fileToParse, otherwise it is the template file. Returns it as a double value. Parameters:
  • row - The row of the file to read from
  • field - The field of the file to read from.
Throws:

writeValue

Writes a token out to the output file. This is only useful if mode is ParseableFile.Mode.GENERATE. Parameters:
  • row - The row of the file to read from
  • field - The field of the file to read from.
  • val - The string to write
Throws:
  • java.lang.IllegalArgumentException- This function does not work if setDelimiters("columns") has been specified.
  • java.io.IOException
  • PHXNoSuchTokenException

setDelimiters

Sets the delimiters which should be used for parsing lines into fields. Acceptable values:
  • “columns” - Fortran style column based fields.
  • null - default delimiters (whitespace)
  • “whitespace” - default delimiters (whitespace)
  • “default” - default delimiters (whitespace)
  • "" - default delimiters (whitespace)
  • “none” - No delimiters (entire line as single field)
  • Any other string is taken as a list of character delimiters
Throws:
  • java.io.IOException

setDecimalSeparator

Set decimal separator for floating point value literals. Parameters:
  • separator - character to be used as a decimal separator

clearMarks

Removes effects of any previous markAsBeginning() or markAsEnd() calls Throws:
  • java.io.IOException

markAsBeginning

Searches for the specified string and makes the row where the string was found act as row 1 for all subsequent calls until another markAsBeginning or clearMarks call. Throws:

markAsBeginning

Searches for the specified string and makes the row where the string was found act as row 1 for all subsequent calls until another markAsBeginning or clearMarks call. Parameters:
  • find - The string to search for.
  • occurrence - Search for the Nth occurrence of string (default 1)
  • offset - After finding string, move down offset rows. May be negative to move up. (default 0)
  • regex - If true, the find parameter is a regular expression. (default false)
Throws:

markAsBeginning

Makes the specified row act as row 1 for all subsequent calls until another markAsBeginning or clearMarks call. Parameters:
  • row - The row to set
Throws:

markAsEnd

Searches for the specified string, starting from the end of the file and working towards the beginning, and makes the row where the string was found act as row -1 (end of file) for all subsequent calls until another markAsEnd or clearMarks call. Parameters:
  • find - The string to search for.
Throws:

markAsEnd

Searches for the specified string and makes the row where the string was found act as row -1 (end of file) for all subsequent calls until another markAsEnd or clearMarks call. Parameters:
  • find - The string to search for.
  • occurrence - Search for the Nth occurrence of string (default 1)
  • offset - After finding string, move down offset rows. May be negative to move up. (default 0)
  • regex - If true, the find parameter is a regular expression. (default false)
Throws:

markAsEnd

Makes the specified row act as row -1 (end of file) for all subsequent calls until another markAsBeginning or clearMarks call. Parameters:
  • row - The row to set
Throws: