jcreek.representation.constraints
Class ValueRangeConstraintObject

java.lang.Object
  extended byjcreek.representation.constraints.ConstraintObject
      extended byjcreek.representation.constraints.ValueRangeConstraintObject
All Implemented Interfaces:
java.io.Serializable

public class ValueRangeConstraintObject
extends ConstraintObject

Handles the behaviour of Value range constraints

. Offers the ability to constrain the value of nummerical slots. You can either define an allowed range of values or a range that is not allowed

Author:
Martin Stige
See Also:
Serialized Form

Field Summary
 
Fields inherited from class jcreek.representation.constraints.ConstraintObject
km, rel
 
Constructor Summary
ValueRangeConstraintObject(RelationType rel, java.lang.Number valueMin, java.lang.Number valueMax, boolean allowed)
          Creates a new instance of ValueRangeConstraint Constrains the values of relations pointing to nummerical values.
 
Method Summary
 ConstraintCheckResult check(Entity from)
          Checks whether the constraint is violated or not.
protected  boolean getAllowed()
           
protected  java.lang.Number getMax()
           
protected  java.lang.Number getMin()
           
 Constraint newConstraintInstance(KnowledgeModel km, ConstraintData data)
          Creates a Constraint object of a specific type
protected  void setAllowed(boolean b)
           
protected  void setMax(java.lang.Number n)
           
protected  void setMin(java.lang.Number n)
           
 java.lang.String toString()
           
 
Methods inherited from class jcreek.representation.constraints.ConstraintObject
getRelation, setKnowledgeModel, setRelation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueRangeConstraintObject

public ValueRangeConstraintObject(RelationType rel,
                                  java.lang.Number valueMin,
                                  java.lang.Number valueMax,
                                  boolean allowed)
Creates a new instance of ValueRangeConstraint

Constrains the values of relations pointing to nummerical values. You can either define an allowed or disallowed range of values.

Parameters:
rel - the RelationType being constraind
valueMin - the minimum number of values
valueMax - the maximum number of values
allowed - whether the range (valueMax - valueMin) is allowed or disallowed
Method Detail

check

public ConstraintCheckResult check(Entity from)
Description copied from class: ConstraintObject
Checks whether the constraint is violated or not.

Should be augmented to offer some feedback about the violations. Until that is made, feedback is just printed to System.out.

Specified by:
check in class ConstraintObject
Returns:
true if everyting is ok, false if the constraint is violated

newConstraintInstance

public Constraint newConstraintInstance(KnowledgeModel km,
                                        ConstraintData data)
Description copied from class: ConstraintObject
Creates a Constraint object of a specific type

Specified by:
newConstraintInstance in class ConstraintObject
Parameters:
km - the knowledge model that the constraint shall bellong to
data - the ConstraintData object to be contained by the constriant

getMax

protected java.lang.Number getMax()

getMin

protected java.lang.Number getMin()

getAllowed

protected boolean getAllowed()

setMax

protected void setMax(java.lang.Number n)

setMin

protected void setMin(java.lang.Number n)

setAllowed

protected void setAllowed(boolean b)

toString

public java.lang.String toString()
Specified by:
toString in class ConstraintObject


Created at IDI, NTNU by the Artificial Intelligence and Learning group