public class NumberValueDiscriminator extends ValueDiscriminator implements DiscriminatorState
Discriminator for a rule that applies based on
a comparison of two numeric values.
For example, you could use this Discriminator to specify
that a DiscriminatorRule should apply to data values greater
than 500,000.
This Discriminator compares an internal
double value to a value that
is in the RuleContext that describes the item to be displayed.
In the comparison, the left operand comes from the RuleContext,
and the right operand is the value stored in this Discriminator.| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
a_number |
static java.lang.String |
NAME_NUM_VAL_DISC |
protected static java.lang.String |
S_NAME_NUM_VAL_DISC |
protected static java.lang.String |
s_number |
a_relOperator, eq, EQ, ge, GE, gt, GT, le, LE, lt, LT, m_relOperator, ne, NE, s_relOperator| Constructor and Description |
|---|
NumberValueDiscriminator()
Constructor that does not specify a number or a relational operator.
|
NumberValueDiscriminator(double number,
int relationalOperator)
Constructor that specifies the number and relational operator.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
applies(RuleContext context)
Specifies whether the value from the
DataView item meets
the conditions specified in this Discriminator. |
java.lang.Object |
clone()
Clones this
NumberValueDiscriminator. |
boolean |
equals(java.lang.Object o)
Indicates whether the specified object is equivalent to this
NumberValueDiscriminator. |
double |
getNumber()
Retrieves the number for this
NumberValueDiscriminator. |
oracle.dss.util.xml.ObjectNode |
getStateAsObjectNode(java.util.List memberContext,
DiscriminatorState baseState) |
oracle.dss.util.xml.ObjectNode |
getXML(boolean allProperties,
ComponentTypeConverter converter,
boolean emptyElement)
Retrieves XML that represents properties and their values in the form
of and
ObjectNode. |
void |
setNumber(double d)
Specifies the number value for this
NumberValueDiscriminator. |
void |
setStateAsObjectNode(java.util.List context,
oracle.dss.util.xml.ObjectNode node,
DiscriminatorState baseState) |
boolean |
setXML(oracle.dss.util.xml.ObjectNode node,
ComponentTypeConverter converter,
java.lang.String version,
int reset)
Specifies XML that represents properties and values.
|
convertRelOperatorToInt, convertRelOperatorToString, getRelOperator, setRelOperatorprotected static final java.lang.String S_NAME_NUM_VAL_DISC
protected static final java.lang.String s_number
public static final java.lang.String NAME_NUM_VAL_DISC
protected static final java.lang.String a_number
public NumberValueDiscriminator()
setNumber method to
specify a number to compare with.
Call setRelOperator to specify the way the numbers
should compare, remembering that the left operand comes from the
RuleContext and the right operand is the number that you
set for this Discriminator.public NumberValueDiscriminator(double number,
int relationalOperator)
number - The value for this Discriminator. This number
becomes the right operand in the comparison.relationalOperator - The relationship that the value from the
RuleContext should have with number, in
order for this Discriminator to apply. Valid constants
are listed in the See Also section.ValueDiscriminator.EQ,
ValueDiscriminator.GE,
ValueDiscriminator.GT,
ValueDiscriminator.LE,
ValueDiscriminator.LT,
ValueDiscriminator.NEpublic java.lang.Object clone()
NumberValueDiscriminator.clone in interface Discriminatorclone in class ValueDiscriminatorNumberValueDiscriminator.public void setNumber(double d)
NumberValueDiscriminator.d - The number that the number from the DataView item
must compare to in order to apply. The relationship that the
two numbers must have is specified by the
RelOperator property of the superclass.public double getNumber()
NumberValueDiscriminator.DataView item
will be compared. The relationship that the two numbers must
have is specified by the RelOperator property of
the superclass.public boolean applies(RuleContext context)
DataView item meets
the conditions specified in this Discriminator.
For example, if the number for this NumberValueDiscriminator
is 500,000 and the RelOperator is GT (>), then
this method returns true if the value in the specified
RuleContext is greater than 500,000.applies in interface Discriminatorcontext - The context of the item to be painted.true if the double value from
context has the specified relationship with the
number in this Discriminator,
false if not.public boolean equals(java.lang.Object o)
NumberValueDiscriminator.
They are equivalent if the numbers are equal and if the
RelOperator values are equal.equals in class java.lang.Objecto - The object to compare with this
NumberValueDiscriminator.true if both objects have the same number and
RelOperator
false if not or if o is not a
NumberValueDiscriminator.public boolean setXML(oracle.dss.util.xml.ObjectNode node,
ComponentTypeConverter converter,
java.lang.String version,
int reset)
DiscriminatorXMLDiscriminatorXML.setXML in interface DiscriminatorXMLnode - ObjectNode that has the properties and their values.converter - A converter that converts component strings to integers
and vice versa.version - The XML version.reset - A constant that indicates how much to reset when XML
is applied. Valid values are listed in the See Also section.true if XML is properly applied,
false if the XML cannot be applied.Rule.RESET_NONE,
Rule.RESET_XML_PROPERTIES,
Rule.RESET_EVERYTHINGpublic oracle.dss.util.xml.ObjectNode getXML(boolean allProperties,
ComponentTypeConverter converter,
boolean emptyElement)
DiscriminatorXMLObjectNode.getXML in interface DiscriminatorXMLallProperties - true to store all property values in XML,
false to store only values that are different
from default values.converter - A converter that converts component strings to integers
and integers to strings.emptyElement - true if an empty element needs to be returned
when none of the property values have changed from default.
false if null should should be returned when
none of the property values have changed from default.
This argument is considered only if
allProperties is false.public void setStateAsObjectNode(java.util.List context,
oracle.dss.util.xml.ObjectNode node,
DiscriminatorState baseState)
setStateAsObjectNode in interface DiscriminatorStatepublic oracle.dss.util.xml.ObjectNode getStateAsObjectNode(java.util.List memberContext,
DiscriminatorState baseState)
getStateAsObjectNode in interface DiscriminatorState