Package jadex.bdiv3
Class AbstractAsmBdiClassGenerator
- java.lang.Object
-
- jadex.bdiv3.AbstractAsmBdiClassGenerator
-
- All Implemented Interfaces:
IBDIClassGenerator
- Direct Known Subclasses:
ASMBDIClassGenerator
public abstract class AbstractAsmBdiClassGenerator extends java.lang.Object implements IBDIClassGenerator
ASM Generator base class
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractAsmBdiClassGenerator.MethodBeliefs
Store which beliefs are accessed in a method.
-
Field Summary
Fields Modifier and Type Field Description protected NodeHelper
nodehelper
protected OpcodeHelper
ophelper
-
Fields inherited from interface jadex.bdiv3.IBDIClassGenerator
AGENT_FIELD_NAME, DYNAMIC_BELIEF_UPDATEMETHOD_PREFIX, GLOBALNAME_FIELD_NAME, INIT_EXPRESSIONS_METHOD_PREFIX, INITARGS_FIELD_NAME
-
-
Constructor Summary
Constructors Constructor Description AbstractAsmBdiClassGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addBeliefEventsToConditions(org.objectweb.asm.tree.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)
protected abstract void
enhanceSetter(java.lang.String iclname, org.objectweb.asm.tree.MethodNode setter, java.lang.String belname)
Enhance setter method with unobserve oldvalue at the beginning and event call at the endprotected abstract java.util.Set<java.lang.String>
findBeliefs(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, java.util.Map<java.lang.String,org.objectweb.asm.tree.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(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, java.util.Map<java.lang.String,org.objectweb.asm.tree.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(org.objectweb.asm.tree.ClassNode cn, BDIModel model, java.lang.ClassLoader cl)
Get a goal per class node.protected boolean
isAgentClass(org.objectweb.asm.tree.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.protected boolean
isGoal(java.lang.String annotationDescription)
Check whether a given Annotation marks a goal.protected boolean
isGoalClass(org.objectweb.asm.tree.ClassNode classNode)
protected boolean
isPlan(java.lang.String annotationDescription)
Check whether a given Annotation marks a plan.protected boolean
isPlanClass(org.objectweb.asm.tree.ClassNode classNode)
protected boolean
isPlanMethod(org.objectweb.asm.tree.MethodNode methodNode)
protected abstract void
replaceNativeGetter(java.lang.String iclname, org.objectweb.asm.tree.MethodNode nativeGetter, java.lang.String belname)
Replace native getter for abstract belief.protected abstract void
replaceNativeSetter(java.lang.String iclname, org.objectweb.asm.tree.MethodNode nativeSetter, java.lang.String belname)
Replace native setter for abstract belief.protected abstract void
transformArrayStores(org.objectweb.asm.tree.MethodNode mn, BDIModel model, java.lang.String iclname)
protected void
transformClassNode(org.objectweb.asm.tree.ClassNode cn, java.lang.String iclname, BDIModel model, java.lang.ClassLoader dummycl, java.util.Map<java.lang.String,org.objectweb.asm.tree.ClassNode> others)
protected abstract void
transformConstructor(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, java.util.List<java.lang.String> tododyn, java.util.Map<java.lang.String,org.objectweb.asm.tree.ClassNode> others)
-
-
-
Field Detail
-
ophelper
protected OpcodeHelper ophelper
-
nodehelper
protected NodeHelper nodehelper
-
-
Method Detail
-
generateBDIClass
public abstract java.util.List<java.lang.Class<?>> generateBDIClass(java.lang.String clname, BDIModel micromodel, java.lang.ClassLoader cl) throws JadexBDIGenerationException
Description copied from interface:IBDIClassGenerator
Generate class, including inner classes.- Specified by:
generateBDIClass
in interfaceIBDIClassGenerator
- Returns:
- the List of classes generated.
- Throws:
JadexBDIGenerationException
-
transformClassNode
protected void transformClassNode(org.objectweb.asm.tree.ClassNode cn, java.lang.String iclname, BDIModel model, java.lang.ClassLoader dummycl, java.util.Map<java.lang.String,org.objectweb.asm.tree.ClassNode> others)
- Parameters:
cn
-iclname
-model
-
-
getGoal
protected MGoal getGoal(org.objectweb.asm.tree.ClassNode cn, BDIModel model, java.lang.ClassLoader cl)
Get a goal per class node.- Parameters:
cn
-- Returns:
-
addBeliefEventsToConditions
protected void addBeliefEventsToConditions(org.objectweb.asm.tree.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)
- Parameters:
cn
-dummycl
-conditions
-methodbeliefs
-model
-
-
findMethodBelief
protected AbstractAsmBdiClassGenerator.MethodBeliefs findMethodBelief(java.util.Collection<AbstractAsmBdiClassGenerator.MethodBeliefs> mbs, java.lang.reflect.Method m, java.lang.reflect.Constructor<?> c)
- Parameters:
mbs
-m
-c
-- Returns:
-
transformArrayStores
protected abstract void transformArrayStores(org.objectweb.asm.tree.MethodNode mn, BDIModel model, java.lang.String iclname)
-
transformConstructor
protected abstract void transformConstructor(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, java.util.List<java.lang.String> tododyn, java.util.Map<java.lang.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(java.lang.String iclname, org.objectweb.asm.tree.MethodNode nativeGetter, java.lang.String belname)
Replace native getter for abstract belief.- Parameters:
iclname
-nativeSetter
-belname
-
-
replaceNativeSetter
protected abstract void replaceNativeSetter(java.lang.String iclname, org.objectweb.asm.tree.MethodNode nativeSetter, java.lang.String belname)
Replace native setter for abstract belief.- Parameters:
iclname
-nativeSetter
-belname
-
-
enhanceSetter
protected abstract void enhanceSetter(java.lang.String iclname, org.objectweb.asm.tree.MethodNode setter, java.lang.String belname)
Enhance setter method with unobserve oldvalue at the beginning and event call at the end- Parameters:
iclname
-setter
-belname
-
-
findBeliefs
protected abstract java.util.Set<java.lang.String> findBeliefs(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, java.util.Map<java.lang.String,org.objectweb.asm.tree.ClassNode> others)
Find the beliefs used in a method.
-
findParameters
protected abstract java.util.Set<java.lang.String> findParameters(org.objectweb.asm.tree.ClassNode cn, org.objectweb.asm.tree.MethodNode mn, BDIModel model, java.util.Map<java.lang.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
protected boolean isAgentOrCapa(java.lang.String annotationDescription)
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
protected boolean isGoal(java.lang.String annotationDescription)
Check whether a given Annotation marks a goal.- Parameters:
annotationDescription
- description of the annotation- Returns:
- true, if the given annotationDescription marks a goal.
-
isPlan
protected boolean isPlan(java.lang.String annotationDescription)
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:
-
-