jcreek.representation.constraints
Class Constraint

java.lang.Object
  extended byjcreek.representation.constraints.Constraint
Direct Known Subclasses:
CardinalityConstraint, ConcreteValueConstraint, GeneralConstraint, ValueClassConstraint, ValueRangeConstraint

public abstract class Constraint
extends java.lang.Object

Super class for all the different Constraint classes

Author:
Martin Stige

Field Summary
protected  ConstraintData constraintData
           
protected  KnowledgeModel knowledgeModel
           
 
Constructor Summary
Constraint(KnowledgeModel knowledgeModel, ConstraintData constraintData)
          Creates a new instance of CardinalityConstraint from a constraint data object
Constraint(KnowledgeModel knowledgeModel, java.lang.String description)
          Creates a new instance of Constraint
 
Method Summary
 ConstraintCheckResult check(Entity e)
          Checks the constraint, met or violated
 boolean equals(java.lang.Object obj)
          Descides whether two constraints are equal
 ConstraintData getConstraintData()
          Returns the constraint data
 java.lang.String getDescription()
          Returns the description of the constraint
 java.lang.Integer getID()
          Returns the ID of the constraint
 RelationType getRelation()
          Returns the relation type
 void setDescription(java.lang.String description)
          Sets the description of this constraint.
 void setKnowledgeModel(KnowledgeModel knowledgeModel)
          Sets the knowledge model that this constraint contains
 void setRelation(RelationType rel)
          Sets the relation type constrained by the constraint
 java.lang.String toString()
          Returns a string describing the constraint
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

knowledgeModel

protected transient KnowledgeModel knowledgeModel

constraintData

protected transient ConstraintData constraintData
Constructor Detail

Constraint

public Constraint(KnowledgeModel knowledgeModel,
                  java.lang.String description)
Creates a new instance of Constraint

Parameters:
knowledgeModel - the knowledge model
description - a description of the constraint

Constraint

public Constraint(KnowledgeModel knowledgeModel,
                  ConstraintData constraintData)
Creates a new instance of CardinalityConstraint from a constraint data object

Parameters:
knowledgeModel - the knowledge model
constraintData - the constraint data to be contained in the constraint
Method Detail

check

public ConstraintCheckResult check(Entity e)
Checks the constraint, met or violated

Parameters:
e - the entity to be checked with this constraint

setDescription

public void setDescription(java.lang.String description)
Sets the description of this constraint.

Parameters:
description - the description of the constraint

getDescription

public java.lang.String getDescription()
Returns the description of the constraint


setRelation

public void setRelation(RelationType rel)
Sets the relation type constrained by the constraint

Parameters:
rel - the relation

getRelation

public RelationType getRelation()
Returns the relation type


getConstraintData

public ConstraintData getConstraintData()
Returns the constraint data


setKnowledgeModel

public void setKnowledgeModel(KnowledgeModel knowledgeModel)
Sets the knowledge model that this constraint contains

Parameters:
knowledgeModel - the knowledge model

equals

public boolean equals(java.lang.Object obj)
Descides whether two constraints are equal

Parameters:
obj - the constraint to be compared with this

getID

public java.lang.Integer getID()
Returns the ID of the constraint


toString

public java.lang.String toString()
Returns a string describing the constraint



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