fipaos.skill.constraint.ccl.constraint
Class CSPRelation

java.lang.Object
  |
  +--fipaos.skill.constraint.ccl.constraint.CSPRelation

public class CSPRelation
extends java.lang.Object


This class represents the object "CSP-relation" as described in the document
"CCL Language Specification v2.01" section 4.2.3.2, p14.

This object represents a relation between two variables. Any varibles named
in the Relation-body must appear in the set of Varibles of the relation.
The set of index-pairs identifies which slots in a tuple valued variable are
covered by the relation. For example, for an equality relation between two
variables with 3 tuples as values (e.g. (x, y, z)), setting the set of indices
to {(2,2), (3,3)} indicates that only the 2nd and 3rd slot of the value tuples
need ever be equal- the constraint is not violated even if the values in the
1st slots are unequal.


Field Summary
static java.lang.String CSPRELATION
          String that a CSPRelation will be referenced with when represented as a Content object.
static java.lang.String EMPTY
          
This specifies that there are no allowed combinations of values for these variables.
static java.lang.String EQUALITY
          
This specifies that all the variables listed in the Variables list of the
relevant CSP-constraint object must take equal values in any instantiation.
static java.lang.String GREATER_THAN
          
This specifies that the variables in the Variables list of the relevant
CSP-constraint object are related by a "greater than" relationship ">" such
that the order of the tuple defines the order in the relationship- the first
variable in the list is strictly greater than the second, which is strictly
greater than the third etc.
static java.lang.String GREATER_THAN_EQUAL
          
Similar to greaterThan described above but using a "greater than or equals" relation.
static java.lang.String INDICES
          
String that a Set of Indices will be referenced with when represented as an Attribute
of a Content object.
static java.lang.String INEQUALITY
          
This specifies that all the variables list in the Variables list of the
relevant CSP-constraint object must take strictly different values in any
instantiation.
static java.lang.String LESS_THAN
          
This specifies that the variables in the Variables list of the relevant
CSP-constraint object are related by a "less than" relationship "<" such that
that order of the tuple defines the order in the relationship- the first variable
in the list is strictly less than the second, which is strictly less than the
third, etc.
static java.lang.String LESS_THAN_EQUAL
          
Similar to lessThan described above but using a "less than or equals" relation.
static java.lang.String NAME
          The only Attribute stored in a Content object representing "Tags" information.
static java.lang.String RELATION_TYPE
          
String that the relation type is referenced with when represented as an Attribute of
of a Content object.
static java.lang.String TAGS
          
String that a collection of tags is referenced with when represented as an Attribute
of a Content object.
static java.lang.String VARIABLES
          
String that a set of variables are referenced with when represented as an Attribute
of a Content object.
 
Constructor Summary
CSPRelation()
          Constructs an empty CSPRelation object.
CSPRelation(Content content)
          
Constructs a new CSPRelation object and populates it with the data
passed in the content object
 
Method Summary
 void addIndexPair(IndexPair indices)
          Adds a new IndexPair.
 void addTag(java.lang.String str)
          Adds a new Tag.
 CSPRelation copy()
          Returns a copy of the CSPRelation object.
 java.util.Vector getIndexPairs()
          Returns a Vector of the IndexPairs stored in the CSPRelation.
 java.lang.String getRelationType()
          
Returns a String indicating the relationship between the two variables
this CSPRelation concerns.
 java.util.Vector getTags()
          Returns a Vector of the Tags stored in the CSPRelation.
 java.lang.String getVariableNameOne()
          Returns the name of the first variable this CSPRelation concerns.
 java.lang.String getVariableNameTwo()
          Returns the name of the second variable this CSPRelation concerns.
static void main(java.lang.String[] args)
          Used for testing.
 void setRelationType(java.lang.String str)
          
Sets the nature of the relationship between the two variables this
CSPRelation concerns.
 void setVariableNameOne(java.lang.String str)
          Sets a value for the first variable this CSPRelation concerns.
 void setVariableNameTwo(java.lang.String str)
          Sets a value for the second variable this CSPRelation concerns.
 Content toContent()
          Returns a Content object representing this class populated with the Data it contains.
 java.lang.String toString()
          Returns a String representation of the CSPRelation object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EQUALITY

public static final java.lang.String EQUALITY

This specifies that all the variables listed in the Variables list of the
relevant CSP-constraint object must take equal values in any instantiation.

INEQUALITY

public static final java.lang.String INEQUALITY

This specifies that all the variables list in the Variables list of the
relevant CSP-constraint object must take strictly different values in any
instantiation.

GREATER_THAN

public static final java.lang.String GREATER_THAN

This specifies that the variables in the Variables list of the relevant
CSP-constraint object are related by a "greater than" relationship ">" such
that the order of the tuple defines the order in the relationship- the first
variable in the list is strictly greater than the second, which is strictly
greater than the third etc.

This relation is only valid for variable types which have an ordering relation
defined in the domain ontology.

LESS_THAN

public static final java.lang.String LESS_THAN

This specifies that the variables in the Variables list of the relevant
CSP-constraint object are related by a "less than" relationship "<" such that
that order of the tuple defines the order in the relationship- the first variable
in the list is strictly less than the second, which is strictly less than the
third, etc.

This relation is only valid for variable types which have an ordering relation
defined in the domain ontology.

GREATER_THAN_EQUAL

public static final java.lang.String GREATER_THAN_EQUAL

Similar to greaterThan described above but using a "greater than or equals" relation.

LESS_THAN_EQUAL

public static final java.lang.String LESS_THAN_EQUAL

Similar to lessThan described above but using a "less than or equals" relation.

EMPTY

public static final java.lang.String EMPTY

This specifies that there are no allowed combinations of values for these variables.

CSPRELATION

public static final java.lang.String CSPRELATION
String that a CSPRelation will be referenced with when represented as a Content object.

INDICES

public static final java.lang.String INDICES

String that a Set of Indices will be referenced with when represented as an Attribute
of a Content object.

RELATION_TYPE

public static final java.lang.String RELATION_TYPE

String that the relation type is referenced with when represented as an Attribute of
of a Content object.

TAGS

public static final java.lang.String TAGS

String that a collection of tags is referenced with when represented as an Attribute
of a Content object.

NAME

public static final java.lang.String NAME
The only Attribute stored in a Content object representing "Tags" information.

VARIABLES

public static final java.lang.String VARIABLES

String that a set of variables are referenced with when represented as an Attribute
of a Content object.
Constructor Detail

CSPRelation

public CSPRelation()
Constructs an empty CSPRelation object.

CSPRelation

public CSPRelation(Content content)

Constructs a new CSPRelation object and populates it with the data
passed in the content object
Method Detail

addTag

public void addTag(java.lang.String str)
Adds a new Tag.

getTags

public java.util.Vector getTags()
Returns a Vector of the Tags stored in the CSPRelation.

addIndexPair

public void addIndexPair(IndexPair indices)
Adds a new IndexPair.

getIndexPairs

public java.util.Vector getIndexPairs()
Returns a Vector of the IndexPairs stored in the CSPRelation.

setVariableNameOne

public void setVariableNameOne(java.lang.String str)
Sets a value for the first variable this CSPRelation concerns.

getVariableNameOne

public java.lang.String getVariableNameOne()
Returns the name of the first variable this CSPRelation concerns.

setVariableNameTwo

public void setVariableNameTwo(java.lang.String str)
Sets a value for the second variable this CSPRelation concerns.

getVariableNameTwo

public java.lang.String getVariableNameTwo()
Returns the name of the second variable this CSPRelation concerns.

setRelationType

public void setRelationType(java.lang.String str)

Sets the nature of the relationship between the two variables this
CSPRelation concerns.
Should be set using the constants this class provides.

getRelationType

public java.lang.String getRelationType()

Returns a String indicating the relationship between the two variables
this CSPRelation concerns.

copy

public CSPRelation copy()
Returns a copy of the CSPRelation object.

toString

public java.lang.String toString()
Returns a String representation of the CSPRelation object.
Overrides:
toString in class java.lang.Object

toContent

public Content toContent()
Returns a Content object representing this class populated with the Data it contains.

main

public static void main(java.lang.String[] args)
Used for testing.