jcreek.representation.constraints
Class ConstraintObject

java.lang.Object
  extended byjcreek.representation.constraints.ConstraintObject
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CardinalityConstraintObject, ConcreteValueConstraintObject, GeneralConstraintObject, ValueClassConstraintObject, ValueRangeConstraintObject

public abstract class ConstraintObject
extends java.lang.Object
implements java.io.Serializable

Super class for the constraint object classes.
Constraint object is the object describing the behaviour of the constraints. The behaviour of the constraint is defined by the check method

Author:
Martin Stige
See Also:
Serialized Form

Field Summary
protected  KnowledgeModel km
           
protected  java.lang.String rel
           
 
Constructor Summary
ConstraintObject()
           
 
Method Summary
abstract  ConstraintCheckResult check(Entity from)
          Checks whether the constraint is violated or not.
 RelationType getRelation()
          Returns the relation type that the constraint constrains
abstract  Constraint newConstraintInstance(KnowledgeModel km, ConstraintData data)
          Creates a Constraint object of a specific type
 void setKnowledgeModel(KnowledgeModel km)
          Sets the knowledge model the constraint shal bellong to
 void setRelation(RelationType relType)
          Sets the relation type the constraint shall constrain
abstract  java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

km

protected transient KnowledgeModel km

rel

protected java.lang.String rel
Constructor Detail

ConstraintObject

public ConstraintObject()
Method Detail

check

public abstract ConstraintCheckResult check(Entity from)
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.

Returns:
true if everyting is ok, false if the constraint is violated

newConstraintInstance

public abstract Constraint newConstraintInstance(KnowledgeModel km,
                                                 ConstraintData data)
Creates a Constraint object of a specific type

Parameters:
km - the knowledge model that the constraint shall bellong to
data - the ConstraintData object to be contained by the constriant

toString

public abstract java.lang.String toString()

setRelation

public void setRelation(RelationType relType)
Sets the relation type the constraint shall constrain

Parameters:
relType - the relation type

setKnowledgeModel

public void setKnowledgeModel(KnowledgeModel km)
Sets the knowledge model the constraint shal bellong to

Parameters:
km - the KnowledgeModel

getRelation

public RelationType getRelation()
Returns the relation type that the constraint constrains

Returns:
a RelationType


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