aminePlatform.util
Interface BindingContext

All Known Implementing Classes:
PPCGBindingContext, SynergyBindingContext

public interface BindingContext

Title : util.BindingContext Interface

Description : This interface concerns variable binding. Collection (AmineList and AmineSet) and complex structures (Term, Concept and CG) of Amine, as well as any Java class that is used in the context of Amine, can contain variables. Of course, the basic feature of a variable is its binding with a value. The modality of this binding relation depends on the programming context where the structures (with variables) are used. For instance, Prolog+CG has an unification-based programming context with unification stack and variables renaming (or variables indices) as binding information related to each variable. Synergy has another programming context and various other programming contexts can be defined and used with their proper binding resolution mechanism.

See aminePlatform.test.util.SimpleBindingContext for a simple example of binding context.

To enable this genericity and independence (independence of the structures and operations toward bindingContext), we provide this interface and the binding information object as two kind of parameters related to operations of AmineObject interface.

Copyright: Copyright (c) Adil KABBAJ, 2004-2009


Method Summary
 void clearCGConstrs()
          Clear the set of constraints that was formed during a CG unification
 CGOperations getCGOperations()
           
 ObjectWithBindInf getValue(java.lang.Object obj, java.lang.Object bindInf)
          This method should return the value of the variable obj, according to the current binding context.
 boolean isBoundVariable(java.lang.Object obj, java.lang.Object bindInf)
           
 boolean isFreeVariable(java.lang.Object obj, java.lang.Object bindInf)
           
 void removeCGUnifConstrs()
          remove the binding that occurred during unification of two CGs
 void setCGUnification(boolean state)
          Is the unification applies inside an (embeeded) CG or not ?
 void setValue(java.lang.Object obj1, java.lang.Object bindInfObj1, java.lang.Object obj2, java.lang.Object bindInfObj2)
          Associate value to variable in this binding context
 

Method Detail

getValue

public ObjectWithBindInf getValue(java.lang.Object obj,
                                  java.lang.Object bindInf)
This method should return the value of the variable obj, according to the current binding context. If obj is not a variable, it should be returned.

Parameters:
obj - An object that corresponds in general to a variable
bindInf - The binding information for the parameter obj
Returns:
an ObjectWithBindInf object which is composed of an object (the value of the variable) and its binding information.

setValue

public void setValue(java.lang.Object obj1,
                     java.lang.Object bindInfObj1,
                     java.lang.Object obj2,
                     java.lang.Object bindInfObj2)
Associate value to variable in this binding context

Parameters:
obj1 - It corresponds in general to a variable (Variable). But in some case, it can be any object that should be set to obj2 which corresponds to the variable.
bindInfObj1 - The binding information for obj1
obj2 - It corresponds in general to a value, an (Amine) Object. But in some case, it can be a variable.
bindInfObj2 - The binding information for obj2

isFreeVariable

public boolean isFreeVariable(java.lang.Object obj,
                              java.lang.Object bindInf)

isBoundVariable

public boolean isBoundVariable(java.lang.Object obj,
                               java.lang.Object bindInf)

getCGOperations

public CGOperations getCGOperations()

setCGUnification

public void setCGUnification(boolean state)
Is the unification applies inside an (embeeded) CG or not ?

Parameters:
state -

removeCGUnifConstrs

public void removeCGUnifConstrs()
remove the binding that occurred during unification of two CGs


clearCGConstrs

public void clearCGConstrs()
Clear the set of constraints that was formed during a CG unification