fipaos.skill.constraint.ccl.object
Class CSP

java.lang.Object
  |
  +--fipaos.skill.constraint.ccl.object.CSP

public class CSP
extends java.lang.Object


This class represents a CSP Object as described in the
"CCL Language specification v2.01" section 4.1.1.1, p5.

A CSP object represents a choice problem.
For a CSP object to be well defined, the items in the Exclusion and Relations
slots must only refer to variables which are present in the Variables slot.
7/3/00


Field Summary
static int CONTENT
           
static java.lang.String CSP
          String used to reference a CSP object when represented as a Content object.
static java.lang.String CSPEXCLUSION
          String CSP-exclusion objects are always referenced with when stored in Content objects.
static java.lang.String CSPREF
          String used to reference the variable containing the name of the CSP.
static java.lang.String CSPRELATION
          String CSP-relation objects are always referenced with when stored in Content objects.
static java.lang.String CSPVARIABLE
          String CSP-variable objects are always referenced with when stored in Content objects.
static int LIST
           
static int LONG
           
static int STRING
           
 
Constructor Summary
CSP()
          
Constructs an empty CSP object.
CSP(Content content)
          
Constructs a new CSP object.
 
Method Summary
 void addRelationship(CSPRelation relation)
          
Adds a new CSPRelation.
 void addVariable(CSPVariable variable)
          Adds a Variable to the CSP.
 CSP copy()
          Returns a copy of this CSP.
 java.util.Vector getRelations()
          Returns a Vector of all the Relations contained in the CSP.
 java.util.Vector getVariables()
          Retrieves a Vector of all the variables in this CSP.
 void identify(java.lang.String str)
          Adds a unique name with which to identify this CSP.
 java.lang.String identity()
          Returns the identifier to this CSP.
static void main(java.lang.String[] args)
          
With no variables the main method constructs and tests a CSP object.
 Content toContent()
          
Returns a Content object populated with Data representing the information
held in this CSP object.
 java.lang.String toString()
          Returns a String representation of the CSP.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CSPVARIABLE

public static final java.lang.String CSPVARIABLE
String CSP-variable objects are always referenced with when stored in Content objects.

CSPRELATION

public static final java.lang.String CSPRELATION
String CSP-relation objects are always referenced with when stored in Content objects.

CSPEXCLUSION

public static final java.lang.String CSPEXCLUSION
String CSP-exclusion objects are always referenced with when stored in Content objects.

CSPREF

public static final java.lang.String CSPREF
String used to reference the variable containing the name of the CSP.

CSP

public static final java.lang.String CSP
String used to reference a CSP object when represented as a Content object.

CONTENT

public static final int CONTENT

LIST

public static final int LIST

LONG

public static final int LONG

STRING

public static final int STRING
Constructor Detail

CSP

public CSP()

Constructs an empty CSP object.
This will then be ready to be populated so it represents a
Constraint Satisfaction Problem.

CSP

public CSP(Content content)

Constructs a new CSP object.
This will then be populated using the Data passed in the Content object.
Method Detail

identify

public void identify(java.lang.String str)
Adds a unique name with which to identify this CSP.

identity

public java.lang.String identity()
Returns the identifier to this CSP.

addVariable

public void addVariable(CSPVariable variable)
Adds a Variable to the CSP.

getVariables

public java.util.Vector getVariables()
Retrieves a Vector of all the variables in this CSP.

addRelationship

public void addRelationship(CSPRelation relation)

Adds a new CSPRelation.
This identifies a relationship between variables in this CSP.

getRelations

public java.util.Vector getRelations()
Returns a Vector of all the Relations contained in the CSP.

toString

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

copy

public CSP copy()
Returns a copy of this CSP.

toContent

public Content toContent()

Returns a Content object populated with Data representing the information
held in this CSP object.

main

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

With no variables the main method constructs and tests a CSP object.
If a String is specified as a command line argument it will read it in,
parse it and try to form a CSP object using a Content object.