jcreek.representation.constraints
Class ValueClassConstraintObject

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

public class ValueClassConstraintObject
extends ConstraintObject

Handles the behaviour of Value class constraints.

Offers the ability to state that the value of the relations of a given type from a given entity must be subclasses of some class/entity.

It is probably a good idea to make a negative counterpart of this one, ore include the negative value class in this constraint. But that is defered...

Author:
Martin Stige
See Also:
Serialized Form

Field Summary
 
Fields inherited from class jcreek.representation.constraints.ConstraintObject
km, rel
 
Constructor Summary
ValueClassConstraintObject(RelationType rel, Entity supercl)
          Creates a new instance of Value Class Constraint
from must be a subclass of supercl
 
Method Summary
 ConstraintCheckResult check(Entity from)
          Checks whether the constraint is violated or not.
protected  Entity getSuperEntity()
           
 Constraint newConstraintInstance(KnowledgeModel km, ConstraintData data)
          Creates a Constraint object of a specific type
protected  void setSuperEntity(Entity e)
           
 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

ValueClassConstraintObject

public ValueClassConstraintObject(RelationType rel,
                                  Entity supercl)
Creates a new instance of Value Class Constraint
from must be a subclass of supercl

Parameters:
rel - the relation being restricted
supercl - the entity that target of the relation must be an instance of
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

getSuperEntity

protected Entity getSuperEntity()

setSuperEntity

protected void setSuperEntity(Entity e)

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

toString

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


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