|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectaminePlatform.engines.synergy.interpreter.Interpreter
Titre : Interpreter of Synergy Description : Synergy is a visual multi-paradigm programming language based on executable Conceptual Graph (CG). Execution is based on a CG-activation mechanism for which concept lifecycle, relation propagation rules and referent instantiation constitute the key elements. Synergy has been designed and developed by Adil Kabbaj in his Ph.D. thesis (1992-1996). First implementation of Synergy has been done in C++ by Khalid Rouane and Adil Kabbaj. A reformulation of Synergy interpreter in Java has been done by Adil in the period 1998-2000. During one month in summer 2004, Said Ladib worked with Adil on the integration of Synergy in Amine Platform: Said worked with Adil on the adaptation of the early formulation of the interpreter in Java to suite the current implementation of Amine. Some bugs have been fixed by Said. Copyright: Copyright (c) Adil KABBAJ, 2004-2008
Field Summary | |
(package private) ActivePrimitives |
activePrimitives
|
(package private) java.util.ArrayList |
assignementRecords
|
(package private) ActivationRecords |
newActivationRecords
|
Constructor Summary | |
Interpreter()
|
|
Interpreter(Lexicon lexicon)
|
|
Interpreter(Lexicon lexicon,
Concept workingMemory,
boolean stepByStep)
|
Method Summary | |
boolean |
activate()
This is the main method of Synergy Interpreter. |
boolean |
activate(Concept workingMemory)
Activate the specified Working Memory. |
protected boolean |
canPropagateBackward(Relation rel)
A Relation rel allows a backward propagation if it doesn't specify the property of "blocking backward propagation" which is specified in our case as a suffix "|<"; BLOCK_BACKWARD_PROPAGATION |
(package private) boolean |
canPropagateForward(Relation rel)
|
protected boolean |
canTriggerPrecond(Relation relation,
Concept sourceConc,
Concept targetConc,
ActivationRecord actRecord)
|
(package private) static void |
checkCondition(boolean cond,
java.lang.String msgErreur)
Object doNewOper(ArrayList incomeArgs, int outcomeArgsSize, ActivationRecord actRecord) throws Exception { String classPath = (String) incomeArgs.get(0); ComposedType composedType = new ComposedType(classPath, NEW_IDENT); incomeArgs.remove(0); // remove the name of the class from the incomeArgs return doCallJavaMethod(composedType, incomeArgs, outcomeArgsSize, actRecord); } |
(package private) void |
checkPostConditions(Concept concept,
ActivationRecord actRecord)
|
(package private) void |
closeConcFrame(CG cg)
|
(package private) CG |
createInstance(java.lang.Object obj,
ActivationRecord actRecord)
|
(package private) java.lang.Object |
doCallJavaMethod(ComposedType cmpsdType,
java.util.ArrayList incomeArgs,
int outcomeArgsSize,
ActivationRecord actRecord)
|
(package private) java.lang.Object |
doDivOper(java.util.ArrayList incomeArgs,
java.util.ArrayList outcomArgs)
|
(package private) static AmineBoolean |
doNegationOperation(java.util.ArrayList incomeArgs)
|
(package private) java.lang.Object |
doOperation(Type type,
java.util.ArrayList incomeArgs)
|
(package private) java.lang.Object |
doOperationOnBoolean(Type type,
boolean value1,
boolean value2)
|
(package private) java.lang.Object |
doOperationOnDouble(Type type,
double value1,
double value2)
|
(package private) java.lang.Object |
doOperationOnInt(Type type,
int value1,
int value2)
|
(package private) java.lang.Object |
doOperationOnString(Type type,
java.lang.String value1,
java.lang.String value2)
|
(package private) java.lang.Object |
doOperationRead(java.lang.Object outArgConcept)
|
(package private) java.lang.Object |
doSqrtOper(java.util.ArrayList incomeArgs,
java.util.ArrayList outcomArgs)
|
void |
endInterpreter()
endInterpreter: stop the interpretation |
protected void |
evalDescr(Concept concept,
ActivationRecord actRecord)
|
void |
execute(CG request)
New: Adil 02/07/08 |
(package private) void |
executePrimitive(java.lang.Object primitiveType,
PrimitiveActivationRecord primActRecord,
java.util.ArrayList incomeArgs,
java.util.ArrayList outcomeArgs,
int period)
|
void |
finalize()
destroy all the elements in memory at the end of execution |
void |
functionalDependencySetting()
|
(package private) static boolean |
getBoolean(java.lang.Object value)
|
boolean |
getCanJoinSituation()
|
(package private) Relation |
getCorrespondingRelation(Concept conceptParameter,
ActivationRecord actRecord)
|
(package private) CG |
getDefinition(java.lang.Object obj,
ActivationRecord bindInf)
|
(package private) static double |
getDouble(java.lang.Object value)
|
(package private) static int |
getInt(java.lang.Object value)
|
Lexicon |
getLexicon()
Get the lexicon of the current activation |
(package private) static double |
getNumber(java.lang.Object value)
|
Ontology |
getOntology()
Get the ontology of the current activation |
(package private) static int |
getRangeOfParameter(Concept concept)
|
(package private) int |
getRangeOfRelation(Relation relation)
|
(package private) Concept |
getReferedConcept(Concept concept,
ActivationRecord actRecord)
|
protected java.lang.Object |
getReferedConceptValue(Concept concept,
ActivationRecord actRecord)
|
(package private) boolean |
getStepSyStep()
Get the activation mode of the interpreter |
(package private) static java.lang.String |
getString(java.lang.Object value)
|
(package private) SynergyGUIFrame |
getSynergyGUIFrame()
|
(package private) static boolean |
getValueAsBoolean(Concept concept)
|
(package private) static CG |
getValueAsCG(Concept concept)
|
(package private) static Concept |
getValueAsConcept(Concept concept)
|
Concept |
getWorkingMemory()
Get the WorkingMemory which is the main active context. |
(package private) void |
initiateAssignment(Concept concept,
ActivationRecord actRec)
|
(package private) void |
initiateEvalCG(Concept concept,
ActivationRecord actRecord)
|
void |
initiateInterpreter()
It set the appropriate context for starting the interpretation of the content of the WorkingMemory (which is a (set of) CGs): initiate global variables and put the workingMemory in the activationRecords list; it becomes the first active context to interpret. |
void |
initiateInterpreter(Lexicon lexicon,
Ontology ontology,
SynergyGUIFrame synergyGUIFrame,
Concept workingMemory,
boolean stepByStep)
It set the appropriate context for starting the interpretation of the content of the WorkingMemory (which is a (set of) CGs): initiate global variables and put the workingMemory in the activationRecords list; it becomes the first active context to interpret. |
(package private) void |
initiatePrimitiveExec(Concept concept,
ActivationRecord actRecord,
java.util.ArrayList incomeArgs,
java.util.ArrayList outcomeArgs)
|
(package private) void |
interpretStateCheckPreCd(Concept concept,
ActivationRecord actRecord)
|
protected void |
interpretStateTrigger(Concept concept,
ActivationRecord actRecord)
interpretStateTrigger: interpret the specified concept which is at state TRIGGER according to the specified active context actRecord. |
(package private) void |
interpretStateWaitForAssignment(Concept concept,
ActivationRecord actRecord)
|
(package private) boolean |
isActiveContext(ActivationRecord activationRecord,
Concept concept)
|
(package private) static boolean |
isBoolean(java.lang.Object value)
|
(package private) static boolean |
isConceptParameter(Concept concept)
|
(package private) boolean |
isCondVerified(Concept sourceConcept,
Relation relation,
Concept concept,
ActivationRecord actRecord)
|
(package private) boolean |
isDefinedOperation(Type Pcd_Fun_Laz,
Concept concept,
ActivationRecord actRecord)
|
protected boolean |
isDefinedType(java.lang.Object obj,
ActivationRecord bindInf)
|
(package private) boolean |
isDescrBoolean(Concept concept)
|
(package private) static boolean |
isDouble(java.lang.Object value)
|
(package private) boolean |
isEffectiveStateTrigger(Concept concept,
ActivationRecord actRecord)
|
(package private) static boolean |
isFunctional(Relation relation)
|
(package private) boolean |
isInArg(Concept concept)
|
(package private) static boolean |
isInParameter(java.lang.String mode)
|
(package private) static boolean |
isInt(java.lang.Object value)
|
(package private) static boolean |
isNumber(java.lang.Object value)
|
(package private) boolean |
isOutArg(Concept concept)
|
(package private) boolean |
isOutOfActor(Concept concept)
|
(package private) static boolean |
isOutParameter(java.lang.String mode)
|
(package private) boolean |
isPrimitiveData(java.lang.Object obj,
ActivationRecord bindInf)
|
(package private) boolean |
isPrimitiveData(Type type)
|
(package private) boolean |
isPrimitiveFunction(java.lang.Object obj,
ActivationRecord bindInf)
|
(package private) boolean |
isPrimitiveFunction(Type type)
|
protected boolean |
isPrimitiveOperation(java.lang.Object obj,
ActivationRecord bindInf)
|
(package private) boolean |
isPrimitiveOperation(Type type)
|
(package private) static boolean |
isString(java.lang.Object value)
|
(package private) void |
joinBestSituation(Concept concept,
ActivationRecord actRecord)
For the moment, we look only at situations that are indexed under the type of the specified concept. |
(package private) void |
manageAssignments()
|
(package private) static boolean |
member(java.lang.Object elem,
java.lang.Object[] lst)
|
(package private) java.lang.Object[] |
message(Term message,
java.lang.Object bindInf,
boolean inAffectation)
|
(package private) void |
propagateForward(Concept concept,
ActivationRecord actRecord)
|
static boolean |
reactivate(CG cg)
Check if there is still some concepts at the state: "Trigger" , "in_activation" or "check Preconditions" |
(package private) void |
reDrawConcept(Concept concept,
CG cg)
|
(package private) Type |
relType(Identifier ident)
|
(package private) Type |
relType(Type type)
|
(package private) void |
repaint(CG cg)
public void repaint() { if (this.synergyGUIFrame ! |
(package private) ResMatchCG |
selectBestSituation(Type type,
Concept triggeredConc,
CG cg,
ActivationRecord actRecord)
|
void |
setCanJoinSituation(boolean b)
|
void |
setLexicon(Lexicon lexicon)
Set the specified lexicon as the lexicon of the current interpreter |
void |
setOntology(Ontology ontology)
Set the specified ontology as the ontology of the current interpreter |
protected void |
setState(Concept concept,
ActivationRecord actRecord,
byte state)
|
protected void |
setState(Concept concept,
ActivationRecord actRecord,
byte state,
byte oper_mode)
|
(package private) void |
setStateDemand(Concept concept,
ActivationRecord actRecord)
|
void |
setStepByStep(boolean stepByStep)
Set the mode of the interpretation to the specified stepByStep. |
void |
setSynergyGUIFrame(SynergyGUIFrame synergyGUIFrame)
|
void |
setWorkingMemory(Concept workingMemory)
Set the specified concept as the WorkingMemory of the interpreter |
(package private) void |
terminationOfActiveContexts()
|
(package private) void |
terminationOfActivePrimitives()
|
void |
updateCGDrawing(CG cg)
|
(package private) void |
updateConcDrawing(Concept concept,
CG cg)
|
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
ActivationRecords newActivationRecords
ActivePrimitives activePrimitives
java.util.ArrayList assignementRecords
Constructor Detail |
public Interpreter()
public Interpreter(Lexicon lexicon)
public Interpreter(Lexicon lexicon, Concept workingMemory, boolean stepByStep)
Method Detail |
public void finalize()
public Lexicon getLexicon()
public Ontology getOntology()
public Concept getWorkingMemory()
boolean getStepSyStep()
public void setStepByStep(boolean stepByStep)
stepByStep
- A BooleanSynergyGUIFrame getSynergyGUIFrame()
public void setLexicon(Lexicon lexicon)
lexicon
- A Lexiconpublic void setOntology(Ontology ontology)
ontology
- An Ontologypublic void setWorkingMemory(Concept workingMemory)
workingMemory
- A Concept that represents the WorkingMemory of the interpreterpublic void setSynergyGUIFrame(SynergyGUIFrame synergyGUIFrame)
public boolean getCanJoinSituation()
public void setCanJoinSituation(boolean b)
public void functionalDependencySetting()
boolean isInArg(Concept concept)
boolean isOutArg(Concept concept)
public void initiateInterpreter()
public void execute(CG request)
request
- CGpublic void initiateInterpreter(Lexicon lexicon, Ontology ontology, SynergyGUIFrame synergyGUIFrame, Concept workingMemory, boolean stepByStep)
lexicon
- The Lexicon to considerontology
- The Ontology to considersynergyGUIFrame
- A SynergyGUIFrameworkingMemory
- The Concept that represents the first active contextstepByStep
- The mode of the interpretationpublic void endInterpreter()
public boolean activate(Concept workingMemory) throws java.lang.Exception
workingMemory
- A Concept that corresponds to the main active context.
This context contains request that will be activated/interpreted by this method.
java.lang.Exception
public boolean activate() throws java.lang.Exception
java.lang.Exception
public static boolean reactivate(CG cg)
protected void interpretStateTrigger(Concept concept, ActivationRecord actRecord) throws java.lang.Exception
concept
- The Concept to interpretactRecord
- The active context to consider for the interpretation of concept
java.lang.Exception
Type relType(Identifier ident)
Type relType(Type type)
void joinBestSituation(Concept concept, ActivationRecord actRecord)
concept
- actRecord
- ResMatchCG selectBestSituation(Type type, Concept triggeredConc, CG cg, ActivationRecord actRecord)
boolean isOutOfActor(Concept concept)
protected boolean canPropagateBackward(Relation rel)
rel
- A Relation
boolean canPropagateForward(Relation rel)
protected boolean canTriggerPrecond(Relation relation, Concept sourceConc, Concept targetConc, ActivationRecord actRecord)
protected void evalDescr(Concept concept, ActivationRecord actRecord) throws java.lang.Exception
java.lang.Exception
void repaint(CG cg)
static boolean isFunctional(Relation relation)
static boolean isConceptParameter(Concept concept)
static boolean isInParameter(java.lang.String mode)
static boolean isOutParameter(java.lang.String mode)
void initiateEvalCG(Concept concept, ActivationRecord actRecord)
CG createInstance(java.lang.Object obj, ActivationRecord actRecord)
void initiatePrimitiveExec(Concept concept, ActivationRecord actRecord, java.util.ArrayList incomeArgs, java.util.ArrayList outcomeArgs)
void manageAssignments()
void interpretStateCheckPreCd(Concept concept, ActivationRecord actRecord) throws java.lang.Exception
java.lang.Exception
boolean isCondVerified(Concept sourceConcept, Relation relation, Concept concept, ActivationRecord actRecord)
void interpretStateWaitForAssignment(Concept concept, ActivationRecord actRecord)
void initiateAssignment(Concept concept, ActivationRecord actRec)
void checkPostConditions(Concept concept, ActivationRecord actRecord)
void propagateForward(Concept concept, ActivationRecord actRecord)
boolean isDescrBoolean(Concept concept)
void terminationOfActiveContexts()
void terminationOfActivePrimitives()
boolean isActiveContext(ActivationRecord activationRecord, Concept concept)
protected void setState(Concept concept, ActivationRecord actRecord, byte state)
protected void setState(Concept concept, ActivationRecord actRecord, byte state, byte oper_mode)
void setStateDemand(Concept concept, ActivationRecord actRecord)
boolean isEffectiveStateTrigger(Concept concept, ActivationRecord actRecord)
static Concept getValueAsConcept(Concept concept)
Concept getReferedConcept(Concept concept, ActivationRecord actRecord)
protected java.lang.Object getReferedConceptValue(Concept concept, ActivationRecord actRecord)
static CG getValueAsCG(Concept concept)
static boolean member(java.lang.Object elem, java.lang.Object[] lst)
protected boolean isPrimitiveOperation(java.lang.Object obj, ActivationRecord bindInf)
boolean isPrimitiveOperation(Type type)
boolean isPrimitiveData(java.lang.Object obj, ActivationRecord bindInf)
boolean isPrimitiveData(Type type)
boolean isPrimitiveFunction(java.lang.Object obj, ActivationRecord bindInf)
boolean isPrimitiveFunction(Type type)
boolean isDefinedOperation(Type Pcd_Fun_Laz, Concept concept, ActivationRecord actRecord)
protected boolean isDefinedType(java.lang.Object obj, ActivationRecord bindInf)
CG getDefinition(java.lang.Object obj, ActivationRecord bindInf)
static int getRangeOfParameter(Concept concept)
int getRangeOfRelation(Relation relation)
Relation getCorrespondingRelation(Concept conceptParameter, ActivationRecord actRecord)
static boolean getValueAsBoolean(Concept concept)
void closeConcFrame(CG cg)
void reDrawConcept(Concept concept, CG cg)
public void updateCGDrawing(CG cg)
void updateConcDrawing(Concept concept, CG cg)
void executePrimitive(java.lang.Object primitiveType, PrimitiveActivationRecord primActRecord, java.util.ArrayList incomeArgs, java.util.ArrayList outcomeArgs, int period) throws java.lang.Exception
java.lang.Exception
static boolean isInt(java.lang.Object value)
static int getInt(java.lang.Object value)
static boolean isDouble(java.lang.Object value)
static double getDouble(java.lang.Object value)
static boolean isString(java.lang.Object value)
static java.lang.String getString(java.lang.Object value)
static boolean isNumber(java.lang.Object value)
static double getNumber(java.lang.Object value)
static boolean isBoolean(java.lang.Object value)
static boolean getBoolean(java.lang.Object value)
java.lang.Object doOperationOnInt(Type type, int value1, int value2)
java.lang.Object doOperationOnDouble(Type type, double value1, double value2)
java.lang.Object doOperationOnBoolean(Type type, boolean value1, boolean value2)
java.lang.Object doOperationOnString(Type type, java.lang.String value1, java.lang.String value2)
java.lang.Object doOperationRead(java.lang.Object outArgConcept)
java.lang.Object doOperation(Type type, java.util.ArrayList incomeArgs)
java.lang.Object doDivOper(java.util.ArrayList incomeArgs, java.util.ArrayList outcomArgs)
java.lang.Object doSqrtOper(java.util.ArrayList incomeArgs, java.util.ArrayList outcomArgs)
static AmineBoolean doNegationOperation(java.util.ArrayList incomeArgs)
java.lang.Object doCallJavaMethod(ComposedType cmpsdType, java.util.ArrayList incomeArgs, int outcomeArgsSize, ActivationRecord actRecord) throws java.lang.Exception
java.lang.Exception
java.lang.Object[] message(Term message, java.lang.Object bindInf, boolean inAffectation) throws java.lang.Exception
java.lang.Exception
static void checkCondition(boolean cond, java.lang.String msgErreur)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |