SmartFrog 3.10.000

org.smartfrog.sfcore.languages.csf.constraints
Class Constraint

java.lang.Object
  extended by org.smartfrog.sfcore.languages.csf.constraints.Constraint
All Implemented Interfaces:
Copying

public class Constraint
extends java.lang.Object
implements Copying

Defines the basic Constraint implementation. The class is basically a holder for the query string (#suchThat#...#), the theory string (#where#...#) and the component to which the constraint applies. In addition, the constraint can hold arbitrary data (an Object) to represent state the solver may require to associate with this specific constraint.

It also contains the logic for deciding which solver should be used - this is static and is common to all contraints. It is not possible to use a different solver for each constraint.


Field Summary
protected  Reference name
          the Name of the component
 
Constructor Summary
Constraint(java.lang.String query)
          Constructor for a Constraint, passing the query string, the theory string and the component to which it is bound.
 
Method Summary
 java.lang.Object clone()
          Creates a shallow copy of the implementor.
 java.lang.Object copy()
          Create a deep copy of object.
 java.util.Hashtable getBindings()
          Get the bindings - state used by the solvers
 ComponentDescription getComponent()
          Get the ComponentDescription - state used by the solvers
 java.lang.String getQuery()
          Get the query string #suchThat#...#
 java.lang.Object getSolverState()
          Get the solver state associated with this constraint
 void setBindings(java.util.Hashtable bindings)
          Get the bindings - state used by the solvers
 void setComponent(ComponentDescription cd)
          Get the ComponentDescription - state used by the solvers
 void setQuery(java.lang.String query)
          Get the query string #suchThat#...#
 void setSolverState(java.lang.Object s)
          Set the solver state for this constraint
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected Reference name
the Name of the component

Constructor Detail

Constraint

public Constraint(java.lang.String query)
Constructor for a Constraint, passing the query string, the theory string and the component to which it is bound. Also has a number of useful get/set methods for the solvers to store state associated with the constraint: a hastable of bindings of variables defininig the context for the solver the component description on which this conatrsint is deifned an object representing any other solver specific state

Parameters:
query - the query string #suchThat#...#
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getSolverState

public java.lang.Object getSolverState()
Get the solver state associated with this constraint

Returns:
the state

setSolverState

public void setSolverState(java.lang.Object s)
Set the solver state for this constraint

Parameters:
s - the state

getComponent

public ComponentDescription getComponent()
Get the ComponentDescription - state used by the solvers

Returns:
the ComponentDescription

setComponent

public void setComponent(ComponentDescription cd)
Get the ComponentDescription - state used by the solvers

Parameters:
cd - the ComponentDescription

getBindings

public java.util.Hashtable getBindings()
Get the bindings - state used by the solvers

Returns:
the ComponentDescription

setBindings

public void setBindings(java.util.Hashtable bindings)
Get the bindings - state used by the solvers

Parameters:
bindings - the ComponentDescription

getQuery

public java.lang.String getQuery()
Get the query string #suchThat#...#

Returns:
the query string

setQuery

public void setQuery(java.lang.String query)
Get the query string #suchThat#...#

Parameters:
query - the query string

copy

public java.lang.Object copy()
Description copied from interface: Copying
Create a deep copy of object.

Specified by:
copy in interface Copying
Returns:
deep copy of object

clone

public java.lang.Object clone()
Description copied from interface: Copying
Creates a shallow copy of the implementor.

Specified by:
clone in interface Copying
Overrides:
clone in class java.lang.Object
Returns:
shallow copy

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP