Package jadex.bdiv3
Class ASMBDIClassGenerator
- java.lang.Object
-
- jadex.bdiv3.AbstractAsmBdiClassGenerator
-
- jadex.bdiv3.ASMBDIClassGenerator
-
- All Implemented Interfaces:
IBDIClassGenerator
- Direct Known Subclasses:
ByteKeepingASMBDIClassGenerator
public class ASMBDIClassGenerator extends AbstractAsmBdiClassGenerator
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jadex.bdiv3.AbstractAsmBdiClassGenerator
AbstractAsmBdiClassGenerator.MethodBeliefs
-
-
Field Summary
-
Fields inherited from class jadex.bdiv3.AbstractAsmBdiClassGenerator
nodehelper, 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 ASMBDIClassGenerator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
enhanceSetter(java.lang.String iclname, org.objectweb.asm.tree.MethodNode mn, java.lang.String belname)
Enhance setter method with unobserve oldvalue at the beginning and event call at the endprotected 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 beliefs accessed in methods.protected 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 parameters accessed in methods.java.util.List<java.lang.Class<?>>
generateBDIClass(java.lang.String clname, BDIModel model, java.lang.ClassLoader dummycl)
Generate class.java.util.List<java.lang.Class<?>>
generateBDIClass(java.lang.String clname, BDIModel model, java.lang.ClassLoader dummycl, java.util.Map<java.lang.String,org.objectweb.asm.tree.ClassNode> done)
Generate class.static void
main(java.lang.String[] args)
protected void
replaceNativeGetter(java.lang.String iclname, org.objectweb.asm.tree.MethodNode mn, java.lang.String belname)
Replace native getter for abstract belief.protected void
replaceNativeSetter(java.lang.String iclname, org.objectweb.asm.tree.MethodNode mn, java.lang.String belname)
Replace native setter for abstract belief.java.lang.Class<?>
toClass(java.lang.String name, byte[] data, java.lang.ClassLoader loader, java.security.ProtectionDomain domain)
Transform byte Array into Class and define it in classloader.java.lang.Class<?>
toClass(java.lang.String name, byte[] data, java.lang.ClassLoader loader, java.security.ProtectionDomain domain, boolean redefine)
Transform byte Array into Class and define it in classloader.protected void
transformArrayStores(org.objectweb.asm.tree.MethodNode mn, BDIModel model, java.lang.String iclname)
Transform array store instructions for beliefs.protected 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)
-
Methods inherited from class jadex.bdiv3.AbstractAsmBdiClassGenerator
addBeliefEventsToConditions, findMethodBelief, getGoal, isAgentClass, isAgentOrCapa, isGoal, isGoalClass, isPlan, isPlanClass, isPlanMethod, transformClassNode
-
-
-
-
Method Detail
-
generateBDIClass
public java.util.List<java.lang.Class<?>> generateBDIClass(java.lang.String clname, BDIModel model, java.lang.ClassLoader dummycl) throws JadexBDIGenerationException
Generate class.- Specified by:
generateBDIClass
in interfaceIBDIClassGenerator
- Specified by:
generateBDIClass
in classAbstractAsmBdiClassGenerator
- Returns:
- the List of classes generated.
- Throws:
JadexBDIGenerationException
-
generateBDIClass
public java.util.List<java.lang.Class<?>> generateBDIClass(java.lang.String clname, BDIModel model, java.lang.ClassLoader dummycl, java.util.Map<java.lang.String,org.objectweb.asm.tree.ClassNode> done) throws JadexBDIGenerationException
Generate class.- Throws:
JadexBDIGenerationException
-
replaceNativeGetter
protected void replaceNativeGetter(java.lang.String iclname, org.objectweb.asm.tree.MethodNode mn, java.lang.String belname)
Description copied from class:AbstractAsmBdiClassGenerator
Replace native getter for abstract belief.- Specified by:
replaceNativeGetter
in classAbstractAsmBdiClassGenerator
-
replaceNativeSetter
protected void replaceNativeSetter(java.lang.String iclname, org.objectweb.asm.tree.MethodNode mn, java.lang.String belname)
Description copied from class:AbstractAsmBdiClassGenerator
Replace native setter for abstract belief.- Specified by:
replaceNativeSetter
in classAbstractAsmBdiClassGenerator
-
enhanceSetter
protected void enhanceSetter(java.lang.String iclname, org.objectweb.asm.tree.MethodNode mn, java.lang.String belname)
Description copied from class:AbstractAsmBdiClassGenerator
Enhance setter method with unobserve oldvalue at the beginning and event call at the end- Specified by:
enhanceSetter
in classAbstractAsmBdiClassGenerator
-
transformConstructor
protected 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)
- Specified by:
transformConstructor
in classAbstractAsmBdiClassGenerator
- Parameters:
cn
- the class which contains the constructormn
- The Constructor method nodetododyn
- list of dynamic beliefs
-
transformArrayStores
protected void transformArrayStores(org.objectweb.asm.tree.MethodNode mn, BDIModel model, java.lang.String iclname)
Transform array store instructions for beliefs.- Specified by:
transformArrayStores
in classAbstractAsmBdiClassGenerator
-
toClass
public java.lang.Class<?> toClass(java.lang.String name, byte[] data, java.lang.ClassLoader loader, java.security.ProtectionDomain domain)
Transform byte Array into Class and define it in classloader.- Returns:
- the loaded class or
null
, if the class is not valid, such as Map.entry "inner Classes".
-
toClass
public java.lang.Class<?> toClass(java.lang.String name, byte[] data, java.lang.ClassLoader loader, java.security.ProtectionDomain domain, boolean redefine)
Transform byte Array into Class and define it in classloader.- Returns:
- the loaded class or
null
, if the class is not valid, such as Map.entry "inner Classes".
-
findBeliefs
protected 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 beliefs accessed in methods.- Specified by:
findBeliefs
in classAbstractAsmBdiClassGenerator
-
findParameters
protected 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 parameters accessed in methods.- Specified by:
findParameters
in classAbstractAsmBdiClassGenerator
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-