public class Condition extends Object implements Cloneable
Contact: Don Brutzman (web.nps.navy.mil/~brutzman) brutzman@nps.navy.mil
Modifier and Type | Class and Description |
---|---|
protected class |
Condition.ParameterPair
Class representing a single condition parameter name/value pair
Names and values are case-independent (e.g., "VALUE" == "value")
|
Constructor and Description |
---|
Condition(String name,
boolean value)
Creates a new instance of Condition
|
Modifier and Type | Method and Description |
---|---|
void |
addParameter(Condition.ParameterPair newParam)
Adds a parameter pair to the list of parameters if it doesn't already exist
|
void |
addParameter(String paramName,
String paramValue)
Adds a parameter pair to the list of parameters if it doesn't already exist
|
Object |
clone()
Generates a (deep) copy of the condition
|
String |
getName()
Returns the name of the condition
|
protected Condition.ParameterPair |
getParameter(int index)
Returns a parameter pair from the parameter list (specified by index)
|
String |
getParameterValue(String name)
Returns the value of a parameter specified by name
|
boolean |
getValue()
Returns the truth value of the condition
|
boolean |
hasParameter(Condition.ParameterPair testParameter)
Returns true if the condition contains a parameter with a name/value pair
|
boolean |
hasParameter(String testName,
String testValue)
Returns true if the condition contains a parameter with a name/value pair
|
boolean |
match(Condition testCondition)
Returns true if this Condition object has all of the same values as the parameter
|
Condition |
negation()
Generates a negation of the condition
|
int |
numParameters()
Returns the number of parameters that apply to this condition
|
String |
toString()
Converts the condition to a String
|
public Condition(String name, boolean value)
name
- String identifier.value
- value of this condition.public String getName()
public boolean getValue()
public int numParameters()
protected Condition.ParameterPair getParameter(int index)
index
- Condition.ParameterPair
public String getParameterValue(String name)
name
- the specified name of the parameter whose value is soughtpublic void addParameter(String paramName, String paramValue)
paramName
- the specified name of the parameter to be addedparamValue
- the specified value of the parameter to be addedpublic void addParameter(Condition.ParameterPair newParam)
newParam
- public boolean hasParameter(String testName, String testValue)
testName
- name of the parameter being tested fortestValue
- value of the parameter being tested forpublic boolean hasParameter(Condition.ParameterPair testParameter)
testParameter
- name and value of the parameter being tested forpublic Condition negation()
public Object clone()
public boolean match(Condition testCondition)
testCondition
-