|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--pds.ruleset.PPIRuleset
PPIRuleset is a class that contians methods for parsing and running rulesets and generating output which defined by the ruleset. A ruleset can be defined in a file or be generated by external applications. Templates are used to determine the form and structure of any output generated.
Field Summary | |
java.util.ArrayList |
mActionList
The list of elements in the label |
int |
mLineCount
Tracks which line in a file (or list) is currently being processed |
int |
mOptionEqualAt
Indicates the alignment position of the equal sign following a keyword. |
boolean |
mOptionForceUpper
Indicates that file names will be forced to uppercase |
int |
mOptionIndent
Indicates the number of spaces to pad the beginning of a line which has been wrapped. |
boolean |
mOptionPadFile
Indicates whether to pad the output file. |
int |
mOptionPadWidth
Indicates tThe width in characters to pad each line in a file. |
int |
mOptionWrapLine
Indicates the width in characters that each line will be wrapped |
java.lang.String |
mOutputName
The name for the output file |
java.lang.String |
mSourceName
The name of the ruleset source |
pds.label.PDSLabel |
mTemplate
The current label template |
java.util.ArrayList |
mVariableList
The list of variables defined during the execution of a rule set |
boolean |
mWriteOutput
The name of the ruleset source |
Constructor Summary | |
PPIRuleset()
Creates an instance of a Ruleset |
Method Summary | |
java.util.ArrayList |
argSplit(java.lang.String buffer)
Split a string into one or more substrings by parsing on whitespace. |
boolean |
convertYesNo(java.lang.String value)
Converts a string to a boolean state. |
void |
dump(boolean doAction)
Prints out the current rule set in tokenized form. |
boolean |
evalCondition(java.util.ArrayList stack)
Evaluate a condition that is coded into a array. |
boolean |
findAndSet(pds.ruleset.PPIVariable variable)
Finds a variable in the variable list and set its value. |
boolean |
findAndSet(java.lang.String name,
java.lang.String value)
Finds a variable in the variable list and set its value. |
java.lang.String |
getValue(java.lang.String name)
Finds a variable in the variable list and returns its value. |
java.lang.String |
getValue(java.lang.String name,
boolean blank)
Finds a variable in the variable list and returns its value. |
java.lang.String |
makeRegex(java.lang.String pattern)
Converts a string to a regular expression pattern. |
static java.lang.String |
makeRule(int type,
java.lang.String arg1,
java.lang.String arg2)
Creates a syntactically correct rule with the parameters passed. |
void |
output()
Writes the template to the output files. |
boolean |
parse(java.lang.String pathName)
Parses a file containing a ruleset into its constitute elments. |
boolean |
parseLine(java.lang.String buffer)
Parses a string containing a single ruleset into its constitute elments. |
java.lang.String |
readLine(java.io.FileInputStream file)
Parses the next line from a file stream. |
java.lang.String |
replaceVariable(java.lang.String buffer)
Searches the passed string for variables and replaces each variable with its current value. |
void |
reset()
Clear all variables, rules and states in the ruleset. |
boolean |
run(java.lang.String pathname)
Run the current rule set. |
void |
setOption(java.lang.String name,
java.lang.String value)
Sets the value of an option. |
static void |
show(java.lang.String message)
Prints text to the display. |
void |
showMessage(boolean location,
java.lang.String message)
Prints and error message to the display. |
static void |
showRule(int type,
java.lang.String arg1)
Prints text to the display. |
static void |
showRule(int type,
java.lang.String arg1,
java.lang.String arg2)
Prints text to the display. |
java.lang.String |
unquote(java.lang.String buffer)
Removes quotes from a string if the string starts with and ends with a quote character ("). |
void |
update()
Update the current template by replacing all variables with the defined values. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public java.util.ArrayList mActionList
public java.util.ArrayList mVariableList
public pds.label.PDSLabel mTemplate
public boolean mOptionPadFile
public int mOptionPadWidth
public int mOptionIndent
public int mOptionEqualAt
public int mOptionWrapLine
public boolean mOptionForceUpper
public java.lang.String mOutputName
public int mLineCount
public java.lang.String mSourceName
public boolean mWriteOutput
Constructor Detail |
public PPIRuleset()
Method Detail |
public boolean parse(java.lang.String pathName)
pathName
- the fully qualified path and name of the file to parse.
true
if the file could be opened;
false
otherwise.public boolean parseLine(java.lang.String buffer)
buffer
- the line of text to parse.
true
if the file could be opened;
false
otherwise.public boolean run(java.lang.String pathname)
pathname
- the pathname of the file to run the rule set on.
true
if an variable was set or added;
false
if error occured.
The variable mWriteOutput is set to
true
if output is to generated,
false
otherwise.- Since:
- 1.0
public boolean evalCondition(java.util.ArrayList stack)
stack
- the array containing the tokens for the condition
to check.
true
if an variable was set or added;
false
if unable to add the variable.public java.lang.String makeRegex(java.lang.String pattern)
pattern
- the string containing "nice" tokens for wild cards.
public void dump(boolean doAction)
doAction
- the type of list to dump. If true then the
action list will be dumped, otherwise the variable
list will be dumped.public java.util.ArrayList argSplit(java.lang.String buffer)
buffer
- the string to parse.
ArrayList
an array of arguments.public boolean convertYesNo(java.lang.String value)
true
. If it
is anything else then false
is returned.
value
- the string to convert.
true
if the string is "YES";
false
if string is anything else.public void setOption(java.lang.String name, java.lang.String value)
name
- the name of the variable to set.value
- the value to set for the variable.public boolean findAndSet(pds.ruleset.PPIVariable variable)
variable
- the name of the variable to set.
true
if an variable was set or added;
false
if unable to add the variable.public boolean findAndSet(java.lang.String name, java.lang.String value)
name
- the name of the variable to set.value
- the value to set for the variable.
true
if an variable was set or added;
false
if unable to add the variable.public java.lang.String getValue(java.lang.String name)
name
- the name of the variable to set.
null
if an variable does not exist;
the value assigned to the variable if it does.public java.lang.String getValue(java.lang.String name, boolean blank)
name
- the name of the variable to set.blank
- indicates whether to return a blank string if not
the variable is not found. If true
a
blank is returned.
null
if an variable does not exist and
blank
is false
. Returns a blank string
if blank
is true;
the value assigned to the variable if it does.public java.lang.String readLine(java.io.FileInputStream file)
file
- the input file stream
true
if an element was parsed from the stream;
false
if the end of file or an error was encountered.FileInputStream
public void reset()
public java.lang.String replaceVariable(java.lang.String buffer)
buffer
- the string to search for variables.
public void showMessage(boolean location, java.lang.String message)
location
- indicates whether location information should be
displayed before the message.message
- the text of the message to display.public static void show(java.lang.String message)
message
- the text of the message to display.public static void showRule(int type, java.lang.String arg1)
type
- the type of rule to create. See PPIAction
for valid types.arg1
- the first argument for the rule. If argument is not
set pass null
.public static void showRule(int type, java.lang.String arg1, java.lang.String arg2)
null
as the
value.
type
- the type of rule to create. See PPIAction
for valid types.arg1
- the first argument for the rule. If argument is not
set pass null
.arg2
- the second argument for the rule. If argument is not
set pass null
.public void update()
public void output()
public java.lang.String unquote(java.lang.String buffer)
buffer
- the string to remove the quotes from.
public static java.lang.String makeRule(int type, java.lang.String arg1, java.lang.String arg2)
type
- the type of rule to create. See PPIAction
for valid types.arg1
- the first argument for the rule. If argument is not
set pass null
.arg2
- the second argument for the rule. If argument is not
set pass null
.
null
if the type is unknown.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |