Package jadex.bdi.model
Class AbstractAsmBdiClassGenerator
java.lang.Object
jadex.bdi.model.AbstractAsmBdiClassGenerator
- All Implemented Interfaces:
IBDIClassGenerator
- Direct Known Subclasses:
ASMBDIClassGenerator
ASM Generator base class
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classStore which beliefs are accessed in a method. -
Field Summary
FieldsFields inherited from interface jadex.bdi.model.IBDIClassGenerator
AGENT_FIELD_NAME, DYNAMIC_BELIEF_UPDATEMETHOD_PREFIX, GLOBALNAME_FIELD_NAME, INIT_EXPRESSIONS_METHOD_PREFIX, INITARGS_FIELD_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddBeliefEventsToConditions(org.objectweb.asm.tree.ClassNode cn, ClassLoader dummycl, List<MCondition> conditions, jadex.collection.MultiCollection<String, AbstractAsmBdiClassGenerator.MethodBeliefs> methodbeliefs, jadex.collection.MultiCollection<String, AbstractAsmBdiClassGenerator.MethodBeliefs> methodparams, BDIModel model) protected abstract voidenhanceSetter(String iclname, org.objectweb.asm.tree.MethodNode setter, String belname) Enhance setter method with unobserve oldvalue at the beginning and event call at the endfindBeliefs(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, Map<String, org.objectweb.asm.tree.ClassNode> others) Find the beliefs used in a method.findMethodBelief(Collection<AbstractAsmBdiClassGenerator.MethodBeliefs> mbs, Method m, Constructor<?> c) findParameters(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, Map<String, org.objectweb.asm.tree.ClassNode> others, MGoal mgoal) Find the beliefs used in a method.generateBDIClass(String clname, BDIModel micromodel, ClassLoader cl) Generate class, including inner classes.protected MGoalgetGoal(org.objectweb.asm.tree.ClassNode cn, BDIModel model, ClassLoader cl) Get a goal per class node.protected booleanisAgentClass(org.objectweb.asm.tree.ClassNode classNode) Check whether a given ClassNode is an Agent (or Capability) class.protected booleanisAgentOrCapa(String annotationDescription) Check whether a given Annotation marks an Agent or Capability.protected booleanCheck whether a given Annotation marks a goal.protected booleanisGoalClass(org.objectweb.asm.tree.ClassNode classNode) protected booleanCheck whether a given Annotation marks a plan.protected booleanisPlanClass(org.objectweb.asm.tree.ClassNode classNode) protected booleanisPlanMethod(org.objectweb.asm.tree.MethodNode methodNode) protected abstract voidreplaceNativeGetter(String iclname, org.objectweb.asm.tree.MethodNode nativeGetter, String belname) Replace native getter for abstract belief.protected abstract voidreplaceNativeSetter(String iclname, org.objectweb.asm.tree.MethodNode nativeSetter, String belname) Replace native setter for abstract belief.protected abstract voidtransformArrayStores(org.objectweb.asm.tree.MethodNode mn, BDIModel model, String iclname) protected voidtransformClassNode(org.objectweb.asm.tree.ClassNode cn, String iclname, BDIModel model, ClassLoader dummycl, Map<String, org.objectweb.asm.tree.ClassNode> others) protected abstract voidtransformConstructor(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, List<String> tododyn, Map<String, org.objectweb.asm.tree.ClassNode> others)
-
Field Details
-
ophelper
-
nodehelper
-
-
Constructor Details
-
AbstractAsmBdiClassGenerator
public AbstractAsmBdiClassGenerator()
-
-
Method Details
-
generateBDIClass
public abstract List<Class<?>> generateBDIClass(String clname, BDIModel micromodel, ClassLoader cl) throws JadexBDIGenerationException Description copied from interface:IBDIClassGeneratorGenerate class, including inner classes.- Specified by:
generateBDIClassin interfaceIBDIClassGenerator- Returns:
- the List of classes generated.
- Throws:
JadexBDIGenerationException
-
transformClassNode
protected void transformClassNode(org.objectweb.asm.tree.ClassNode cn, String iclname, BDIModel model, ClassLoader dummycl, Map<String, org.objectweb.asm.tree.ClassNode> others) - Parameters:
cn-iclname-model-
-
getGoal
Get a goal per class node.- Parameters:
cn-- Returns:
-
addBeliefEventsToConditions
protected void addBeliefEventsToConditions(org.objectweb.asm.tree.ClassNode cn, ClassLoader dummycl, List<MCondition> conditions, jadex.collection.MultiCollection<String, AbstractAsmBdiClassGenerator.MethodBeliefs> methodbeliefs, jadex.collection.MultiCollection<String, AbstractAsmBdiClassGenerator.MethodBeliefs> methodparams, BDIModel model) - Parameters:
cn-dummycl-conditions-methodbeliefs-model-
-
findMethodBelief
protected AbstractAsmBdiClassGenerator.MethodBeliefs findMethodBelief(Collection<AbstractAsmBdiClassGenerator.MethodBeliefs> mbs, Method m, Constructor<?> c) - Parameters:
mbs-m-c-- Returns:
-
transformArrayStores
-
transformConstructor
protected abstract void transformConstructor(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, List<String> tododyn, Map<String, org.objectweb.asm.tree.ClassNode> others) - Parameters:
cn- the class which contains the constructormn- The Constructor method nodemodel-tododyn- list of dynamic beliefs
-
replaceNativeGetter
protected abstract void replaceNativeGetter(String iclname, org.objectweb.asm.tree.MethodNode nativeGetter, String belname) Replace native getter for abstract belief.- Parameters:
iclname-belname-nativeSetter-
-
replaceNativeSetter
protected abstract void replaceNativeSetter(String iclname, org.objectweb.asm.tree.MethodNode nativeSetter, String belname) Replace native setter for abstract belief.- Parameters:
iclname-nativeSetter-belname-
-
enhanceSetter
protected abstract void enhanceSetter(String iclname, org.objectweb.asm.tree.MethodNode setter, String belname) Enhance setter method with unobserve oldvalue at the beginning and event call at the end- Parameters:
iclname-setter-belname-
-
findBeliefs
protected abstract Set<String> findBeliefs(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, Map<String, org.objectweb.asm.tree.ClassNode> others) Find the beliefs used in a method. -
findParameters
protected abstract Set<String> findParameters(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, Map<String, org.objectweb.asm.tree.ClassNode> others, MGoal mgoal) Find the beliefs used in a method. -
isAgentClass
protected boolean isAgentClass(org.objectweb.asm.tree.ClassNode classNode) Check whether a given ClassNode is an Agent (or Capability) class.- Parameters:
classNode-- Returns:
- true, if the given classNode is an Agent or Capability class.
-
isAgentOrCapa
Check whether a given Annotation marks an Agent or Capability.- Parameters:
annotationDescription- description of the annotation- Returns:
- true, if the given annotationDescription marks an Agent or Capability class.
-
isGoal
Check whether a given Annotation marks a goal.- Parameters:
annotationDescription- description of the annotation- Returns:
- true, if the given annotationDescription marks a goal.
-
isPlan
Check whether a given Annotation marks a plan.- Parameters:
annotationDescription- description of the annotation- Returns:
- true, if the given annotationDescription marks a plan.
-
isPlanClass
protected boolean isPlanClass(org.objectweb.asm.tree.ClassNode classNode) - Parameters:
classNode-- Returns:
-
isGoalClass
protected boolean isGoalClass(org.objectweb.asm.tree.ClassNode classNode) - Parameters:
classNode-- Returns:
-
isPlanMethod
protected boolean isPlanMethod(org.objectweb.asm.tree.MethodNode methodNode) - Parameters:
methodNode-- Returns:
-