public class SimilarityCondition extends Condition
SimilarityField.| Modifier and Type | Field | Description |
|---|---|---|
static int |
CONDITION_ACCEPTING_DOMINATED_VALUES |
Possible value of condition type for
create method |
static int |
CONDITION_ACCEPTING_DOMINATING_VALUES |
Possible value of condition type for
create method |
static int |
CONDITION_ACCEPTING_EQUAL_VALUES |
Possible value of condition type for
create method |
static int |
CONDITION_ACCEPTING_STRICTLY_DOMINATED_VALUES |
Possible value of condition type for
create method |
static int |
CONDITION_ACCEPTING_STRICTLY_DOMINATING_VALUES |
Possible value of condition type for
create method |
static int |
numberOfSimilarityDecimalPlaces |
Number of decimal places in text representation of this field, concerning only floating-point similarity
(i.e. similarity of type
FloatField.) |
CONDITIONAL, DECISION| Constructor | Description |
|---|---|
SimilarityCondition(AttributeInfo attributeInfo,
Relation similarityRelation,
RelationEqual referenceValueRelation) |
Constructs similarity condition with specified information about the attribute, similarity relation and reference value relation.
|
| Modifier and Type | Method | Description |
|---|---|---|
static SimilarityCondition |
create(AttributeInfo attributeInfo,
SimilarityField value,
int conditionType) |
Creates and returns similarity condition for given information about attribute and condition type,
created on the basis of given similarity field value
|
Condition |
duplicate() |
Returns duplicate of this condition.
|
boolean |
equals(java.lang.Object object) |
Checks if given object is a similarity condition equal to this condition.
|
boolean |
fulfilledBy(Example example) |
Checks if given example (from learning / test memory container) fulfills this condition.
|
AttributeInfoWithSimilarityFunction |
getAttributeInfoForTestAttribute() |
Gets information about an attribute from test memory container (with
SimpleField fields)
to which decision rule containing this condition can be applied. |
RelationEqual |
getReferenceValueRelation() |
Gets reference value relation associated with this similarity condition
|
Relation |
getSimilarityRelation() |
Gets similarity relation associated with this similarity condition
|
void |
setAttributeInfoForTestAttribute(AttributeInfoWithSimilarityFunction attributeInfoForTestAttribute) |
Sets information about an attribute from test memory container (with
SimpleField fields)
to which decision rule containing this condition can be applied. |
void |
setReferenceValueRelation(RelationEqual referenceValueRelation) |
Sets reference value relation associated with this similarity condition.
|
void |
setSimilarityRelation(Relation similarityRelation) |
Sets similarity relation associated with this similarity condition.
|
java.lang.String |
toString() |
Gets textual form of this condition.
|
getAttributeInfopublic static int numberOfSimilarityDecimalPlaces
FloatField.)
Used only if not less than zero. Otherwise default precision is used.public static final int CONDITION_ACCEPTING_DOMINATING_VALUES
create methodpublic static final int CONDITION_ACCEPTING_STRICTLY_DOMINATING_VALUES
create methodpublic static final int CONDITION_ACCEPTING_DOMINATED_VALUES
create methodpublic static final int CONDITION_ACCEPTING_STRICTLY_DOMINATED_VALUES
create methodpublic static final int CONDITION_ACCEPTING_EQUAL_VALUES
create methodpublic SimilarityCondition(AttributeInfo attributeInfo, Relation similarityRelation, RelationEqual referenceValueRelation)
attributeInfo - information about the attribute for which this condition is being definedsimilarityRelation - similarity relation for this condition (i.e. relation defined for similarity part of an object of type SimilarityField)referenceValueRelation - reference value relation for this condition (i.e. relation defined for reference value part of an object of type SimilarityField)InvalidValueException - when attribute is not active or not conditional / not decision,
when attribute for which similarity condition with similarity relation >=, <=, > or < is being defined has no preference type assigned
or when attribute for which similarity condition with similarity relation = is being defined has preference type assignedInvalidTypeException - when attribute for which this similarity condition is being defined is not of type SimilarityField,
when similarity relation is none of RelationAtLeast, RelationAtMost, RelationGreaterThan, RelationLessThan or RelationEqual,
when type of similarity of attribute's initial value (see SimilarityField.getSimilarityType method)
is different than type of similarity relation reference value
or when type of reference value of attribute's initial value (see SimilarityField.getReferenceValueType method)
is different than type of reference value relation reference valuejava.lang.NullPointerException - when any of given two relations is nullpublic Relation getSimilarityRelation()
public RelationEqual getReferenceValueRelation()
public void setSimilarityRelation(Relation similarityRelation)
similarityRelation - similarity relation which will be associated with this similarity conditionjava.lang.NullPointerException - when similarity relation is nullInvalidTypeException - when type of new similarity relation is different than type of old similarity relation
or when type of reference value for new similarity relation is different than type of reference value for old similarity relationpublic void setReferenceValueRelation(RelationEqual referenceValueRelation)
referenceValueRelation - reference value relation which will be associated with this similarity conditionjava.lang.NullPointerException - when reference value relation is nullInvalidTypeException - when type of reference value for new reference value relation is different than type of reference value for old reference value relationpublic boolean fulfilledBy(Example example)
Condition.fulfilledBy abstract method.fulfilledBy in class Conditionexample - example to checktrue if given example fulfills this condition, false otherwisejava.lang.NullPointerException - when example is null
or when example's field for an attribute from test memory container for which this condition is defined
is of type SimpleField and there is no similarity function for that attribute
stored in this condition's attributeInfoForTestAttribute objectjava.lang.IndexOutOfBoundsException - when attribute's number defined in condition is too big for given exampleInvalidTypeException - when example's field for attribute for which this condition is defined
is of wrong type - neither SimilarityField nor SimpleFieldpublic java.lang.String toString()
Condition.toString method.
Uses information about the meaning of the attribute for which this condition is defined.
Takes into account SimilarityCondition.numberOfSimilarityDecimalPlaces, if not less than zero
and if similarity relation's reference value is of type FloatField.public Condition duplicate()
Condition.duplicate method.
Duplicates both relations, but only copies reference to AttributeInfo object.
Also copies to new condition information about an attribute from test memory container
(with SimpleField fields) to which decision rule containing this condition can be applied.public boolean equals(java.lang.Object object)
nullSimilarityConditionattributeInfoForTestAttribute fields.public static SimilarityCondition create(AttributeInfo attributeInfo, SimilarityField value, int conditionType)
attributeInfo - information about the attribute for which similarity condition is being createdvalue - similarity field valueconditionType - type of created similarity condition. Can be CONDITION_ACCEPTING_DOMINATING_VALUES,
CONDITION_ACCEPTING_STRICTLY_DOMINATING_VALUES, CONDITION_ACCEPTING_DOMINATED_VALUES,
CONDITION_ACCEPTING_STRICTLY_DOMINATED_VALUES or CONDITION_ACCEPTING_EQUAL_VALUES.java.lang.NullPointerException - when information about the attribute for which similarity condition is being created is null
or when given value is nullInvalidValueException - when condition type is none of CONDITION_ACCEPTING_DOMINATING_VALUES,
CONDITION_ACCEPTING_STRICTLY_DOMINATING_VALUES, CONDITION_ACCEPTING_DOMINATED_VALUES,
CONDITION_ACCEPTING_STRICTLY_DOMINATED_VALUES and CONDITION_ACCEPTING_EQUAL_VALUES,
when condition type involves values dominance check while attribute for which similarity condition is being created
has no preference type assigned,
when condition type involves values equality check while attribute for which similarity condition is being created
has preference type assigned,
when attribute is not active (thrown by called SimilarityCondition constructor)
or when attribute is not conditional nor decision (thrown by called SimilarityCondition constructor)InvalidTypeException - when type of value of the attribute for which similarity condition is being created
is different than SimilarityField,
when type of similarity of attribute's initial value (see SimilarityField.getSimilarityType method)
is different than type of similarity of given value
or when type of reference value of attribute's initial value (see SimilarityField.getReferenceValueType method)
is different than type of reference value of given valuepublic AttributeInfoWithSimilarityFunction getAttributeInfoForTestAttribute()
SimpleField fields)
to which decision rule containing this condition can be applied.SimpleField fields)
to which decision rule containing this condition can be applied.
Can be null, when such information is unset.public void setAttributeInfoForTestAttribute(AttributeInfoWithSimilarityFunction attributeInfoForTestAttribute)
SimpleField fields)
to which decision rule containing this condition can be applied.attributeInfoForTestAttribute - information about an attribute from test memory container
(with SimpleField fields) to which decision rule containing this condition can be applied.
Can be null, when such information should be unset.