|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object PIRL.PVL.Selection
public class Selection
A Selection implements a Selector for use with a Parameter or Value wherever selective comparison of Parameters and/or Values is needed.
For example, both the Parameter and Value Find
methods
use a Selector when making object comparisons, and use this
Selection class when no other Selector is specified. A Selection can
be used to specify the criteria to be used in comparing all, or any
part, of two Parameters or Values.
The criteria are specified as the characteristics of the Parameter and/or Value to use in making a selection, and the combinatorial boolean logic to apply to the characteristics when comparing one object against another. The Selector interface defines the criteria symbols. The Selection class provides the definition of the criteria and comparison methods.
Field Summary | |
---|---|
static String |
ID
Class name and version identification. |
Fields inherited from interface PIRL.PVL.Selector |
---|
AND, ANY, ANY_PARAMETER, ANY_VALUE, BASE, CLASSIFICATION, COMMENTS, DATA, EQUAL, GREATER_THAN, LESS_THAN, LOGIC, MODIFIERS, NAME, PARAMETER_MATCH, PARAMETER_SELECTION, PATTERN_MATCH, SPECIFIC, TYPE, UNITS, VALUE, VALUE_MATCH, VALUE_SELECTION |
Constructor Summary | |
---|---|
Selection()
Creates a Selection using ANY criteria. |
|
Selection(int criteria)
Creates a Selection using the specified criteria. |
|
Selection(Selector selector)
Creates a Selection using the criteria from the specified Selector. |
Method Summary | |
---|---|
boolean |
And()
Tests if logical AND for multiple criteria is enabled. |
Selector |
And(boolean mode)
Enables or disables logical AND when matching with multiple criteria. |
boolean |
Any_Parameter()
Tests if any Parameter characteristic will match. |
Selector |
Any_Parameter(boolean mode)
Enables or disables using any Parameter characteristic to match. |
boolean |
Any_Value()
Tests if any Value characteristic will match. |
Selector |
Any_Value(boolean mode)
Enables or disables using any Value characteristic to match. |
boolean |
Base()
Tests if the Value integer base criteria is enabled. |
Selector |
Base(boolean mode)
Enables or disables the Value integer base criteria. |
boolean |
Bases_Match(Value this_value,
Value that_value)
Tests if the integer radix base values of two Values match. |
boolean |
Classification()
Tests if the Parameter classification criteria is enabled. |
Selector |
Classification(boolean mode)
Enables or disables the Parameter classification criteria. |
boolean |
Classifications_Match(Parameter this_parameter,
Parameter that_parameter)
Tests if the classifications of two Parameters match. |
boolean |
Comments_Match(Parameter this_parameter,
Parameter that_parameter)
Tests if the comments of two Parameters match. |
boolean |
Comments()
Tests if the Parameter comments criteria is enabled. |
Selector |
Comments(boolean mode)
Enables or disables the Parameter comments criteria. |
int |
Criteria()
Gets the current Selection criteria code. |
Selector |
Criteria(int criteria)
Sets Selection criteria to the specified code. |
boolean |
Data_Match(Value this_value,
Value that_value)
Tests if the data of two Values match. |
boolean |
Data()
Tests if the data of a Value is a criteria. |
Selector |
Data(boolean mode)
Enables or disables using the data of a Value as a criteria. |
boolean |
Equal()
Tests if equality matching logic is enabled. |
Selector |
Equal(boolean mode)
Enables or disables using equality logic for comparing Values with NUMERIC data. |
boolean |
Greater_Than()
Tests if greater-than matching logic is enabled. |
Selector |
Greater_Than(boolean mode)
Enables or disables using greater-than logic for comparing Values with NUMERIC data. |
boolean |
Less_Than()
Tests if less-than matching logic is enabled. |
Selector |
Less_Than(boolean mode)
Enables or disables using less-than logic for comparing Values with NUMERIC data. |
int |
Logic()
Gets the logic settings of the current Selection criteria code. |
int |
Modifiers()
Gets the modifiers of the current Selection criteria code. |
boolean |
Name()
Tests if the Parameter name criteria is enabled. |
Selector |
Name(boolean mode)
Enables or disables the Parameter name criteria. |
boolean |
Names_Match(Parameter this_parameter,
Parameter that_parameter)
Tests if the names of two Parameters match. |
int |
Parameter_Criteria()
Gets the current Parameter Selection criteria code. |
boolean |
Parameter_Values_Match(Parameter this_parameter,
Parameter that_parameter)
Tests if the data values of two Parameters match. |
int |
Parameters_Criteria_Match(Parameter this_parameter,
Parameter that_parameter)
Gets the matching criteria for two Parameters. |
int |
Parameters_Match()
Gets the selection criteria that resulted from the last Parameters_Match comparison of two Parameters. |
boolean |
Parameters_Match(Parameter this_parameter,
Parameter that_parameter)
Tests if two Parameters match. |
boolean |
Pattern_Match()
Tests if regular expression pattern matching is enabled. |
Selector |
Pattern_Match(boolean mode)
Enables or disables using regular expression pattern matching for String comparisons. |
boolean |
Specific()
Tests if specific criteria matching is enabled. |
Selector |
Specific(boolean mode)
Enables or disables specific criteria matching. |
String |
toString()
Gets a description of the Selection criteria. |
boolean |
Type()
Tests if the Value type criteria is enabled. |
Selector |
Type(boolean mode)
Enables or disables the Value type criteria. |
boolean |
Types_Match(Value this_value,
Value that_value)
Tests if the types of two Values match. |
boolean |
Units_Match(Value this_value,
Value that_value)
Tests if the units descriptions of two Values match. |
boolean |
Units()
Tests if the Value units description criteria is enabled. |
Selector |
Units(boolean mode)
Enables or disables the Value units description criteria. |
int |
Value_Criteria()
Gets the current Value Selection criteria code. |
boolean |
Value()
Tests if the Parameter Value criteria is enabled. |
Selector |
Value(boolean mode)
Enables or disables the Parameter Value criteria. |
int |
Values_Criteria_Match(Value this_value,
Value that_value)
Gets the matching criteria for two Values. |
int |
Values_Match()
Gets the selection criteria that resulted from the last Values_Match comparison of two Values. |
boolean |
Values_Match(Value this_value,
Value that_value)
Tests if two Values match. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ID
Constructor Detail |
---|
public Selection()
ANY
criteria.
This Selection will match anything; i.e. any two Parameters or Values will always match with this Selection.
public Selection(int criteria)
The criteria code may be any combination of Selector criteria.
criteria
- A Selector criteria code value.Selector
public Selection(Selector selector)
selector
- The Selector from which to get the criteria to use.Method Detail |
---|
public Selector Criteria(int criteria)
Criteria
in interface Selector
criteria
- The Selector criteria to use.
Selector
public int Criteria()
Criteria
in interface Selector
public int Parameter_Criteria()
Only that portion of the current Selection criteria code for the
PARAMETER_SELECTION
is returned; all other criteria
are masked out.
Parameter_Criteria
in interface Selector
PARAMETER_SELECTION
section of the
current Selection criteria.Selector.PARAMETER_SELECTION
public int Value_Criteria()
Only that portion of the current Selection criteria code for the
VALUE_SELECTION
is returned; all other criteria are
masked out.
Value_Criteria
in interface Selector
VALUE_SELECTION
section of the current
Selection criteria.Selector.VALUE_SELECTION
public int Modifiers()
Only that portion of the current Selection criteria code for the
MODIFIERS
is returned; all other criteria are
masked out.
Modifiers
in interface Selector
MODIFIERS
section of the current
Selection criteria.Selector.MODIFIERS
public int Logic()
Only that portion of the current Selection criteria code for the
LOGIC
is returned; all other criteria are
masked out.
Logic
in interface Selector
LOGIC
section of the current
Selection criteria.Selector.LOGIC
public String toString()
toString
in interface Selector
toString
in class Object
public Selector Name(boolean mode)
Name
in interface Selector
mode
- true to enable the use of the Parameter name as a
match criteria; false to disable this criteria.
Selector.NAME
public boolean Name()
Name
in interface Selector
Name(boolean)
public Selector Classification(boolean mode)
Classification
in interface Selector
mode
- true to enable the use of the Parameter
classification as a match criteria; false to disable this
criteria.
Selector.CLASSIFICATION
public boolean Classification()
Classification
in interface Selector
Classification(boolean)
public Selector Value(boolean mode)
Value
in interface Selector
mode
- true to enable the use of the Parameter Value as a
match criteria; false to disable this criteria.
Selector.VALUE
public boolean Value()
Value
in interface Selector
Value(boolean)
public Selector Comments(boolean mode)
Comments
in interface Selector
mode
- true to enable the use of the Parameter comments as
a match criteria; false to disable this criteria.
Selector.COMMENTS
public boolean Comments()
Comments
in interface Selector
Comments(boolean)
public Selector Any_Parameter(boolean mode)
Enabling this mode will disable all Parameter criteria, which is a
special case interpreted to mean that any Parameter characteristic
matches with those of another Parameter. If, however,
AND
logic is enabled then the Value matching criteria
must still be met. Disabling this mode has no effect; specific
Parameter criteria must be enabled once Any_Parameter
has been used.
Any_Parameter
in interface Selector
mode
- true to enable any Parameter characteristics
to match; false leaves the current criteria unchanged.
Selector.PARAMETER_SELECTION
public boolean Any_Parameter()
Any_Parameter
in interface Selector
Any_Parameter(boolean)
public Selector Data(boolean mode)
Data
in interface Selector
mode
- true to enable the use of Value data as a match
criteria; false to disable this criteria.
Selector.DATA
public boolean Data()
Data
in interface Selector
Data(boolean)
public Selector Type(boolean mode)
Type
in interface Selector
mode
- true to enable the use of the Value type as
a match criteria; false to disable this criteria.
Selector.TYPE
public boolean Type()
Type
in interface Selector
Type(boolean)
public Selector Base(boolean mode)
Base
in interface Selector
mode
- true to enable the use of the Value integer base as
a match criteria; false to disable this criteria.
Selector.BASE
public boolean Base()
Base
in interface Selector
Base(boolean)
public Selector Units(boolean mode)
Units
in interface Selector
mode
- true to enable the use of the Value units
description as a match criteria; false to disable this
criteria.
Selector.UNITS
public boolean Units()
Units
in interface Selector
Units(boolean)
public Selector Any_Value(boolean mode)
Enabling this mode will disable all Value criteria, which is a
special case interpreted to mean that any Value characteristic
matches with those of another Value. Disabling this mode has no
effect; specific Value criteria must be enabled once
Any_Value
has been used.
Any_Value
in interface Selector
mode
- true to enable any Value characteristics to match;
false leaves the current criteria unchanged.
Selector.VALUE_SELECTION
public boolean Any_Value()
Any_Value
in interface Selector
Any_Value(boolean)
public Selector Pattern_Match(boolean mode)
Pattern_Match
in interface Selector
mode
- true to enable pattern matching; false otherwise.
Selector.PATTERN_MATCH
public boolean Pattern_Match()
Pattern_Match
in interface Selector
Pattern_Match(boolean)
public Selector Specific(boolean mode)
When specific matching is enabled Parameter classifications and
Value types must match exactly; when disabled only the general
categories need to be the same for their criteria to be met. When
specific matching is enabled Strings are compared using their
equals
methods; when disabled their
equalsIgnoreCase
methods are used. When specific
matching is enabled aggregate Parameter lists are compared in their
entirerty; when disabled END
Parameters are recognized
as the end of a list and an END_PVL
Parameter marks
the end of all nested lists.
Specific
in interface Selector
mode
- true to require criteria to match exactly; false
will allow criteria to match when the characteristics are
generally the same.
Selector.SPECIFIC
public boolean Specific()
Specific
in interface Selector
Specific(boolean)
public Selector Equal(boolean mode)
NUMERIC
data.
Equal
in interface Selector
mode
- true to use equality logic when comparing numeric
data values.
Selector.SPECIFIC
public boolean Equal()
Equal
in interface Selector
Specific(boolean)
public Selector Less_Than(boolean mode)
NUMERIC
data.
If Equal
is also enabled, then <= logic will be used.
Note: This method disables Greater_Than
logic.
Less_Than
in interface Selector
mode
- true to use less-than logic when comparing numeric
data values.
Selector.LESS_THAN
public boolean Less_Than()
Less_Than
in interface Selector
Less_Than(boolean)
public Selector Greater_Than(boolean mode)
NUMERIC
data.
If Equal
is also enabled, then >= logic will be used;
however, Less_Than
takes precedence if they are both
enabled. Note: This method disables Less_Than
logic.
Greater_Than
in interface Selector
mode
- true to use less-than logic when comparing numeric
data values.
Selector.LESS_THAN
public boolean Greater_Than()
Greater_Than
in interface Selector
Greater_Than(boolean)
public Selector And(boolean mode)
Note: When disabled, logical OR is used when matching with multiple criteria.
And
in interface Selector
mode
- true to use logical AND when matching with multiple
criteria; false to use logical OR.
Selector.AND
public boolean And()
And
in interface Selector
And(boolean)
public boolean Parameters_Match(Parameter this_parameter, Parameter that_parameter)
If both arguments are null, they match; but if one or the other is null, they do not match.
When Any_Parameter
is enabled, a match occurs. However,
if And
is also enabled and Any_Value
is
not enabled, then a match only occurs if both Parameters are the
ASSIGNMENT
classification and their
Values_Match
.
The following criteria are tested in the order listed:
Classification
- Classifications_Match
Value
- Parameter_Values_Match
Comments
- Comments_Match
Name
- Names_Match
When And
logic is enabled, all of these criteria tests
must match for the Parameters to match (the first one that does not
match stops further testing); otherwise any criteria test that
matches produces a match for the Parameters (the first one that
matches stops further testing).
N.B.: When the associativity of comparison testing matters - e.g. - the associativity is this_parameter op that_parameter. For example, when a Parameter name is being compared against a regular expression pattern the comparison is this_parameter.Name ().matches (that_parameter.Name ()); i.e. the second Parameter (that_parameter) is expected to contain the pattern to be matched.
N.B.: Parameter matching of Aggregates is only recursive
for Value
matching, and in this case only the Values
of the Parameter lists are compared.
Parameters_Match
in interface Selector
this_parameter
- The first of a pair of Parameters to be matched.that_parameter
- The second of a pair of Parameters to be matched.
And(boolean)
,
Any_Parameter(boolean)
,
Any_Value(boolean)
,
Parameter.ASSIGNMENT
,
Values_Match(Value, Value)
,
Classification(boolean)
,
Classifications_Match(Parameter, Parameter)
,
Value(boolean)
,
Parameter_Values_Match(Parameter, Parameter)
,
Comments(boolean)
,
Comments_Match(Parameter, Parameter)
,
Name(boolean)
,
Names_Match(Parameter, Parameter)
public int Parameters_Match()
Parameters_Match
comparison of two Parameters.
The Selector criteria code that is returned flags the criteria that
were matched during the last use of the
method with this Selection object. If
no match occured the return value will be zero.
Parameters_Match
Parameters_Match
in interface Selector
public int Parameters_Criteria_Match(Parameter this_parameter, Parameter that_parameter)
The same matching logic as used in the Parameters_Match
method is applied here, except that all criteria are tested. Thus
the Selector criteria code that is returned indicates all matching
criteria. When the Value
criteria is enabled and the
Parameters are the ASSIGNMENT
classification, then the
Values_Criteria_Match
method is used to also get the
matching criteria for the Parameters' Values. If no criteria match
the return value will be zero.
Parameters_Criteria_Match
in interface Selector
this_parameter
- The first of a pair of Parameters to be matched.that_parameter
- The second of a pair of Parameters to be matched.
Parameters_Match(Parameter, Parameter)
,
Values_Criteria_Match(Value, Value)
public boolean Names_Match(Parameter this_parameter, Parameter that_parameter)
If Pattern_Match
ing is enabled, then the Name of
this_parameter is compared against the regular expression pattern
in the Name of that_parameter. If the regular expression syntax is
invalid a normal String comparision is done. If
Specific
matching is enabled, then the String
equals
method is used; otherwise the
equalsIgnoreCase
method is used.
N.B.: If either Parameter is null the match is false.
Names_Match
in interface Selector
this_parameter
- The first of a pair of Parameters to be matched.that_parameter
- The second of a pair of Parameters to be matched.
String.matches(String)
public boolean Classifications_Match(Parameter this_parameter, Parameter that_parameter)
If Specific
matching is enabled, then the classifications
must be identical to match; otherwise general classifications
(i.e. AGGREGATE
) will also match.
N.B.: If either Parameter is null the match is false.
Classifications_Match
in interface Selector
this_parameter
- The first of a pair of Parameters to be matched.that_parameter
- The second of a pair of Parameters to be matched.
public boolean Parameter_Values_Match(Parameter this_parameter, Parameter that_parameter)
If both Parameters have null data values, they match; but if one or the other is null, they do not match.
For an ASSIGNMENT
, Values_Match
determines
the match.
For AGGREGATE
Parameters, all of the Parameters in the
aggregate lists must match, using the current Selection criteria,
for a match to occur. However, if Specific
matching is
not enabled, then END
Parameters are recognized as
ending lists, and an END_PVL
Parameter will stop any
further comparisons for all nested aggregate lists. If the
Value
criteria applies then the match is recursive for
all Aggregate Parameters. TOKEN
and
UNKNOWN
Parameter Values always match when their
classifications are the same.
N.B.: If either Parameter is null the match is false.
Parameter_Values_Match
in interface Selector
this_parameter
- The first of a pair of Parameters to be matched.that_parameter
- The second of a pair of Parameters to be matched.
Values_Match(Value, Value)
,
Specific(boolean)
public boolean Comments_Match(Parameter this_parameter, Parameter that_parameter)
If both Parameters do not have comments, they match; but if one or
the other does not have comments, they do not match. If
Specific
matching is enabled, then the String
equals
method is used; otherwise the
equalsIgnoreCase
method is used.
N.B.: If either Parameter is null the match is false.
Comments_Match
in interface Selector
this_parameter
- The first of a pair of Parameters to be matched.that_parameter
- The second of a pair of Parameters to be matched.
public boolean Values_Match(Value this_value, Value that_value)
When Any_Value
is enabled, a match always occurs.
If both arguments are null, they match; but if one or the other is null, they do not match.
The following criteria are tested in the order listed:
Type
- Types_Match
Base
- Bases_Match
Units
- Units_Match
Data
- Data_Match
When And
logic is enabled, all of the enabled criteria
tests must match for the Values to match (the first one that does
not match stops further testing); otherwise any criteria test that
matches produces a match for the Values (the first one that matches
stops further testing).
N.B.: Value matching of Arrays is only recursive for
Data
matching, and in this case only the data values of
the Array elements are compared.
Values_Match
in interface Selector
this_value
- The first of a pair of Values to be matched.that_value
- The second of a pair of Values to be matched.
And(boolean)
,
Type(boolean)
,
Types_Match(Value, Value)
,
Base(boolean)
,
Bases_Match(Value, Value)
,
Units(boolean)
,
Units_Match(Value, Value)
,
Data(boolean)
,
Data_Match(Value, Value)
public int Values_Match()
Values_Match
comparison of two Values.
The Selector criteria code that is returned flags the criteria that
were matched during the last use of the
method
with this Selection object. If no match occured the return value
will be zero.
Values_Match
Values_Match
in interface Selector
public int Values_Criteria_Match(Value this_value, Value that_value)
The same matching logic as used in the Values_Match
method is applied here, except that all criteria are tested. Thus
the Selector criteria code that is returned indicates all matching
criteria. If no criteria match the return value will be zero.
Values_Criteria_Match
in interface Selector
this_value
- The first of a pair of Values to be matched.that_value
- The second of a pair of Values to be matched.
Values_Match(Value, Value)
public boolean Types_Match(Value this_value, Value that_value)
If Specific
matching is enabled, then the types must
be identical to match; otherwise gneral classifications (i.e.
NUMERIC
,STRING
, or ARRAY
)
will also match.
N.B.: If either Value is null the match is false.
Types_Match
in interface Selector
this_value
- The first of a pair of Values to be matched.that_value
- The second of a pair of Values to be matched.
public boolean Bases_Match(Value this_value, Value that_value)
When the two Values do not have INTEGER
data, a match
always occurs. Otherwise the radix base values are compared
numerically using the Equal
and/or
Less_Than
or Greater_Than
logic of this
Selection.
N.B.: If either Value is null the match is false.
Bases_Match
in interface Selector
this_value
- The first of a pair of Values to be matched.that_value
- The second of a pair of Values to be matched.
Equal(boolean)
,
Less_Than(boolean)
,
Greater_Than(boolean)
public boolean Units_Match(Value this_value, Value that_value)
If both Values do not have units descriptions, they match; but if
one or the other does not have a units description, they do not
match. If Pattern_Match
ing is enabled, the the units
String of this_value is matched against the regular expression
pattern of that_value's units String. If the regular expression
syntax is invalid a normal String comparision is done. If
Specific
matching is enabled, then the String
equals
method is used; otherwise the
equalsIgnoreCase
method is used.
N.B.: If either Value is null the match is false.
Units_Match
in interface Selector
this_value
- The first of a pair of Values to be matched.that_value
- The second of a pair of Values to be matched.
String.matches(String)
public boolean Data_Match(Value this_value, Value that_value)
If both Values have null data, they match; but if one or the other is null, they do not match.
If the Values are NUMERIC
type the data are compared
numerically using the Equal
and/or
Less_Than
or Greater_Than
logic of this
Selection.
For STRING
types, if Pattern_Match
ing is
enabled the String data of this_value is matched against the regular
expression pattern of that_value's String data. If the regular
expression syntax is invalid a normal String comparision is done. If
Specific
matching is enabled, then the String
equals
method is used; otherwise the
equalsIgnoreCase
method is used.
For ARRAY
types the data of all Values in the data
Vector must match, using the current Selection criteria, for a match
to occur. If the Data
criteria applies then the match
is recursive for all Array Values.
When both Values are of UNKNONW
type, they match.
N.B.: If either Value is null the match is false.
Data_Match
in interface Selector
this_value
- The first of a pair of Values to be matched.that_value
- The second of a pair of Values to be matched.
String.matches(String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |