public abstract class AbstractAsmBdiClassGenerator extends java.lang.Object implements IBDIClassGenerator
Modifier and Type | Class and Description |
---|---|
static class |
AbstractAsmBdiClassGenerator.MethodBeliefs
Store which beliefs are accessed in a method.
|
Modifier and Type | Field and Description |
---|---|
protected NodeHelper |
nodehelper |
protected OpcodeHelper |
ophelper |
AGENT_FIELD_NAME, DYNAMIC_BELIEF_UPDATEMETHOD_PREFIX, GLOBALNAME_FIELD_NAME, INIT_EXPRESSIONS_METHOD_PREFIX
Constructor and Description |
---|
AbstractAsmBdiClassGenerator() |
Modifier and Type | Method and Description |
---|---|
protected void |
addBeliefEventsToConditions(ClassNode cn,
java.lang.ClassLoader dummycl,
java.util.List<MCondition> conditions,
MultiCollection<java.lang.String,AbstractAsmBdiClassGenerator.MethodBeliefs> methodbeliefs,
MultiCollection<java.lang.String,AbstractAsmBdiClassGenerator.MethodBeliefs> methodparams,
BDIModel model) |
static void |
checkEnhanced(java.lang.Class<?> clazz)
Check if a bdi agent class was enhanced.
|
protected abstract void |
enhanceSetter(java.lang.String iclname,
MethodNode setter,
java.lang.String belname)
Enhance setter method with unobserve oldvalue at the beginning and event call at the end
|
protected abstract java.util.Set<java.lang.String> |
findBeliefs(ClassNode cn,
MethodNode mn,
BDIModel model,
java.util.Map<java.lang.String,ClassNode> others)
Find the beliefs used in a method.
|
protected AbstractAsmBdiClassGenerator.MethodBeliefs |
findMethodBelief(java.util.Collection<AbstractAsmBdiClassGenerator.MethodBeliefs> mbs,
java.lang.reflect.Method m,
java.lang.reflect.Constructor<?> c) |
protected abstract java.util.Set<java.lang.String> |
findParameters(ClassNode cn,
MethodNode mn,
BDIModel model,
java.util.Map<java.lang.String,ClassNode> others,
MGoal mgoal)
Find the beliefs used in a method.
|
abstract java.util.List<java.lang.Class<?>> |
generateBDIClass(java.lang.String clname,
BDIModel micromodel,
java.lang.ClassLoader cl)
Generate class, including inner classes.
|
protected MGoal |
getGoal(ClassNode cn,
BDIModel model,
java.lang.ClassLoader cl)
Get a goal per class node.
|
protected boolean |
isAgentClass(ClassNode classNode)
Check whether a given ClassNode is an Agent (or Capability) class.
|
protected boolean |
isAgentOrCapa(java.lang.String annotationDescription)
Check whether a given Annotation marks an Agent or Capability.
|
static boolean |
isEnhanced(java.lang.Class<?> clazz)
Returns whether a class is already enhanced.
|
protected boolean |
isGoal(java.lang.String annotationDescription)
Check whether a given Annotation marks a goal.
|
protected boolean |
isGoalClass(ClassNode classNode) |
protected boolean |
isPlan(java.lang.String annotationDescription)
Check whether a given Annotation marks a plan.
|
protected boolean |
isPlanClass(ClassNode classNode) |
protected boolean |
isPlanMethod(MethodNode methodNode) |
protected abstract void |
replaceNativeGetter(java.lang.String iclname,
MethodNode nativeGetter,
java.lang.String belname)
Replace native getter for abstract belief.
|
protected abstract void |
replaceNativeSetter(java.lang.String iclname,
MethodNode nativeSetter,
java.lang.String belname)
Replace native setter for abstract belief.
|
protected abstract void |
transformArrayStores(MethodNode mn,
BDIModel model,
java.lang.String iclname) |
protected void |
transformClassNode(ClassNode cn,
java.lang.String iclname,
BDIModel model,
java.lang.ClassLoader dummycl,
java.util.Map<java.lang.String,ClassNode> others) |
protected abstract void |
transformConstructor(ClassNode cn,
MethodNode mn,
BDIModel model,
java.util.List<java.lang.String> tododyn,
java.util.Map<java.lang.String,ClassNode> others) |
protected OpcodeHelper ophelper
protected NodeHelper nodehelper
public abstract java.util.List<java.lang.Class<?>> generateBDIClass(java.lang.String clname, BDIModel micromodel, java.lang.ClassLoader cl) throws JadexBDIGenerationException
IBDIClassGenerator
generateBDIClass
in interface IBDIClassGenerator
JadexBDIGenerationException
protected void transformClassNode(ClassNode cn, java.lang.String iclname, BDIModel model, java.lang.ClassLoader dummycl, java.util.Map<java.lang.String,ClassNode> others)
cn
- iclname
- model
- protected MGoal getGoal(ClassNode cn, BDIModel model, java.lang.ClassLoader cl)
cn
- protected void addBeliefEventsToConditions(ClassNode cn, java.lang.ClassLoader dummycl, java.util.List<MCondition> conditions, MultiCollection<java.lang.String,AbstractAsmBdiClassGenerator.MethodBeliefs> methodbeliefs, MultiCollection<java.lang.String,AbstractAsmBdiClassGenerator.MethodBeliefs> methodparams, BDIModel model)
cn
- dummycl
- conditions
- methodbeliefs
- model
- protected AbstractAsmBdiClassGenerator.MethodBeliefs findMethodBelief(java.util.Collection<AbstractAsmBdiClassGenerator.MethodBeliefs> mbs, java.lang.reflect.Method m, java.lang.reflect.Constructor<?> c)
mbs
- m
- c
- protected abstract void transformArrayStores(MethodNode mn, BDIModel model, java.lang.String iclname)
protected abstract void transformConstructor(ClassNode cn, MethodNode mn, BDIModel model, java.util.List<java.lang.String> tododyn, java.util.Map<java.lang.String,ClassNode> others)
cn
- the class which contains the constructormn
- The Constructor method nodemodel
- tododyn
- list of dynamic beliefsprotected abstract void replaceNativeGetter(java.lang.String iclname, MethodNode nativeGetter, java.lang.String belname)
iclname
- nativeSetter
- belname
- protected abstract void replaceNativeSetter(java.lang.String iclname, MethodNode nativeSetter, java.lang.String belname)
iclname
- nativeSetter
- belname
- protected abstract void enhanceSetter(java.lang.String iclname, MethodNode setter, java.lang.String belname)
iclname
- setter
- belname
- protected abstract java.util.Set<java.lang.String> findBeliefs(ClassNode cn, MethodNode mn, BDIModel model, java.util.Map<java.lang.String,ClassNode> others)
protected abstract java.util.Set<java.lang.String> findParameters(ClassNode cn, MethodNode mn, BDIModel model, java.util.Map<java.lang.String,ClassNode> others, MGoal mgoal)
protected boolean isAgentClass(ClassNode classNode)
classNode
- protected boolean isAgentOrCapa(java.lang.String annotationDescription)
annotationDescription
- description of the annotationprotected boolean isGoal(java.lang.String annotationDescription)
annotationDescription
- description of the annotationprotected boolean isPlan(java.lang.String annotationDescription)
annotationDescription
- description of the annotationprotected boolean isPlanClass(ClassNode classNode)
classNode
- protected boolean isGoalClass(ClassNode classNode)
classNode
- protected boolean isPlanMethod(MethodNode methodNode)
methodNode
- public static boolean isEnhanced(java.lang.Class<?> clazz)
clazz
- public static void checkEnhanced(java.lang.Class<?> clazz)
java.lang.RuntimeException
- if was not enhanced.