Java Doc for MethodEditor.java in  » Database-DBMS » db4o-6.4 » EDU » purdue » cs » bloat » editor » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db4o 6.4 » EDU.purdue.cs.bloat.editor 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   EDU.purdue.cs.bloat.editor.MethodEditor

MethodEditor
public class MethodEditor implements Opcode(Code)
MethodEditor provides a means to edit a method of a class. A MethodEditor gathers information from a MethodInfo object. It then goes through the bytecodes of the method and extracts information about the method. Along the way it creates an array of Instruction and Label objects that represent the code. Additionally, it models the try-catch blocks in the method and their associated exception handlers.
See Also:   EDU.purdue.cs.bloat.reflect.MethodInfo
See Also:   Label
See Also:   Instruction
author:
   Nate Nystrom (author:
   href="mailto:nystrom@cs.purdue.edu">nystrom@cs.purdue.edu)

Inner Class :class LineNumberEntry
Inner Class :class LocalInfo
Inner Class :class LocalVarEntry

Field Summary
public static  booleanOPT_STACK_2
    
public static  booleanPRESERVE_DEBUG
    
public static  booleanUNIQUE_HANDLERS
    
public  UseMapuMap
    

Constructor Summary
public  MethodEditor(ClassEditor editor, int modifiers, Class returnType, String methodName, Class[] paramTypes, Class[] exceptionTypes)
    
public  MethodEditor(ClassEditor editor, int modifiers, Type returnType, String methodName, Type[] paramTypes, Type[] exceptionTypes)
     Creates a new MethodEditor for editing a method in a given class with the given modifiers, return type, name, parameter types, and exception types.
Parameters:
  modifiers - The EDU.purdue.cs.bloat.reflect.Modifiers modifiersfor the new method
Parameters:
  returnType - The return type of the method.
public  MethodEditor(ClassEditor editor, MethodInfo methodInfo)
     Constructor.

Method Summary
public  voidaddInstruction(int opcodeClass)
     Add an instruction.
public  voidaddInstruction(int opcodeClass, Object operand)
     Add an instruction.
public  voidaddInstruction(Instruction inst)
     Add an instruction to the end of the code array.
public  voidaddLabel(Label label)
     Add a label to the code array to the end of the code array.
public  voidaddLineNumberEntry(Label label, int lineNumber)
     Add a line number entry.
public  voidaddTryCatch(TryCatch tryCatch)
     Add an exception handler.
public  voidclearCode()
     Remove all the instructions in preparation for the instructions being added back after a control flow graph edit.
public  voidclearCode2()
     Like clear code, but doesn't reset the maxLocals.
public  Listcode()
     Returns the code (Instructions and Labels) in the method.
public  ObjectcodeElementAt(int i)
     Returns a Label or Instruction in the code array.
Parameters:
  i - The index into the code array.
public  intcodeLength()
     Get the length of the code array.
public  voidcommit()
     Commits changes made to this MethodEditor back to the MethodInfo on which it is based.
public  ClassEditordeclaringClass()
     Returns the class which declared the method.
public  voiddelete()
     Marks this method for deletion.
public  booleanequals(Object o)
     Two MethodEditors are equal if they edit the same method in the same class.
public  Type[]exceptions()
     Returns the Types of exceptions that this method may throw.
public  LabelfirstBlock()
     Get the label of the first block.
public  inthashCode()
     A MethodEditor's hash code is based on the hash codes for its class, name, and type.
public  voidinsertCodeAt(Object obj, int i)
     Inserts a Label or Instruction into the code array.
public  booleanisAbstract()
    
public  booleanisConstructor()
     Returns true if the method being edited is a constructor.
public  booleanisDirty()
     Returns true if this method has been modified.
public  booleanisFinal()
    
public  booleanisInterface()
     Returns true if this method's class is an interface.
public  booleanisNative()
    
public  booleanisPackage()
    
public  booleanisPrivate()
    
public  booleanisProtected()
    
public  booleanisPublic()
    
public  booleanisStatic()
    
public  booleanisSynchronized()
    
public  LocalVariablelocalAt(int index)
     Returns the LocalVariable with the given index.
public  intmaxLocals()
     Returns the maximum number of locals used by the method.
public  MemberRefmemberRef()
     Returns a MemberRef for the method.
public  MethodInfomethodInfo()
     Returns the raw MethodInfo of the method being edited.
public  Stringname()
     Returns the name of the method.
public  NameAndTypenameAndType()
     Returns the NameAndType of the method.
public  LabelnewLabel()
     Get the next available label.
public  LabelnewLabelTrue()
    
public  LocalVariablenewLocal(Type type)
     Creates a new local variable.
public  LocalVariablenewLocal(boolean isWide)
     Creates a new local variable of an undertermined type.
public  LabelnextBlock(Label label)
     Get the label of the next block after the parameter.
Parameters:
  label - The label at which to begin.
public  intnumTryCatches()
     Returns the number of exception handlers in the method.
public  LocalVariableparamAt(int index)
     Get the LocalVariable for the parameter at the given index.
Parameters:
  index - The index into the params (0 is the this pointer or the firstargument, if static).
public  Type[]paramTypes()
     Returns an array of Types representing the types of the parameters of this method.
public  voidprint(PrintStream out)
     Print the method.
public  voidrememberDef(LocalExpr e)
    
public  voidremoveCodeAt(int i)
     Removes a Label or Instruction from the code array.
public  voidreplaceCodeAt(Object obj, int i)
     Replace a Label or Instruction in the code array.
public  voidsetAbstract(boolean flag)
    
public  voidsetCode(List v)
    
public  voidsetDirty(boolean dirty)
     Sets the dirty flag of this method.
public  voidsetFinal(boolean flag)
    
public  voidsetNative(boolean flag)
    
public  voidsetPrivate(boolean flag)
    
public  voidsetProtected(boolean flag)
    
public  voidsetPublic(boolean flag)
    
public  voidsetStatic(boolean flag)
    
public  voidsetSynchronized(boolean flag)
    
public  StringtoString()
    
public  CollectiontryCatches()
     Returns the exception handlers (TryCatch) in the method.
public  Typetype()
     Returns the type of the method.
public  UseMapuMap()
    

Field Detail
OPT_STACK_2
public static boolean OPT_STACK_2(Code)



PRESERVE_DEBUG
public static boolean PRESERVE_DEBUG(Code)



UNIQUE_HANDLERS
public static boolean UNIQUE_HANDLERS(Code)



uMap
public UseMap uMap(Code)




Constructor Detail
MethodEditor
public MethodEditor(ClassEditor editor, int modifiers, Class returnType, String methodName, Class[] paramTypes, Class[] exceptionTypes)(Code)



MethodEditor
public MethodEditor(ClassEditor editor, int modifiers, Type returnType, String methodName, Type[] paramTypes, Type[] exceptionTypes)(Code)
Creates a new MethodEditor for editing a method in a given class with the given modifiers, return type, name, parameter types, and exception types.
Parameters:
  modifiers - The EDU.purdue.cs.bloat.reflect.Modifiers modifiersfor the new method
Parameters:
  returnType - The return type of the method. If, returnTypeis null, the return type is assumed to be void.
Parameters:
  methodName - The name of the method
Parameters:
  paramTypes - The types of the parameters to the new method. IfparamTypes is null, then weassume that there are no arguments.
Parameters:
  exceptionTypes - The types of exceptions that may be thrown by the new method.If exceptionTypes is null, thenwe assume that no exceptions are declared.



MethodEditor
public MethodEditor(ClassEditor editor, MethodInfo methodInfo)(Code)
Constructor.
Parameters:
  editor - The class containing the method.
Parameters:
  methodInfo - The method to edit.
See Also:   ClassEditor
See Also:   EDU.purdue.cs.bloat.reflect.MethodInfo
See Also:    MethodInfo




Method Detail
addInstruction
public void addInstruction(int opcodeClass)(Code)
Add an instruction.
Parameters:
  opcodeClass - The instruction to add.



addInstruction
public void addInstruction(int opcodeClass, Object operand)(Code)
Add an instruction.
Parameters:
  opcodeClass - The instruction to add.



addInstruction
public void addInstruction(Instruction inst)(Code)
Add an instruction to the end of the code array.
Parameters:
  inst - The instruction to add.
throws:
  IllegalStateException - This field has been marked for deletion



addLabel
public void addLabel(Label label)(Code)
Add a label to the code array to the end of the code array.
Parameters:
  label - The label to add.
throws:
  IllegalStateException - This field has been marked for deletion



addLineNumberEntry
public void addLineNumberEntry(Label label, int lineNumber)(Code)
Add a line number entry.
Parameters:
  label - The label beginning the range of instructions for this linenumber.
Parameters:
  lineNumber - The line number.
throws:
  IllegalStateException - This field has been marked for deletion



addTryCatch
public void addTryCatch(TryCatch tryCatch)(Code)
Add an exception handler.
Parameters:
  tryCatch - An exception handler.
throws:
  IllegalStateException - This field has been marked for deletion



clearCode
public void clearCode()(Code)
Remove all the instructions in preparation for the instructions being added back after a control flow graph edit.
throws:
  IllegalStateException - This field has been marked for deletion



clearCode2
public void clearCode2()(Code)
Like clear code, but doesn't reset the maxLocals. I'm not really sure why this works, but it stops certain parts of code that is generated and then re-cfg'd from being eliminated as dead



code
public List code()(Code)
Returns the code (Instructions and Labels) in the method.



codeElementAt
public Object codeElementAt(int i)(Code)
Returns a Label or Instruction in the code array.
Parameters:
  i - The index into the code array. The element at the index.



codeLength
public int codeLength()(Code)
Get the length of the code array. The length of the code array.



commit
public void commit()(Code)
Commits changes made to this MethodEditor back to the MethodInfo on which it is based. Note that committal will take place regardless of whether or not the method is dirty.



declaringClass
public ClassEditor declaringClass()(Code)
Returns the class which declared the method.



delete
public void delete()(Code)
Marks this method for deletion. Once a method has been marked for deletion all attempts to change it will throw an IllegalStateException.



equals
public boolean equals(Object o)(Code)
Two MethodEditors are equal if they edit the same method in the same class.



exceptions
public Type[] exceptions()(Code)
Returns the Types of exceptions that this method may throw.



firstBlock
public Label firstBlock()(Code)
Get the label of the first block.



hashCode
public int hashCode()(Code)
A MethodEditor's hash code is based on the hash codes for its class, name, and type.



insertCodeAt
public void insertCodeAt(Object obj, int i)(Code)
Inserts a Label or Instruction into the code array.
Parameters:
  i - The index of the element to insert before.
throws:
  IllegalStateException - This field has been marked for deletion



isAbstract
public boolean isAbstract()(Code)



isConstructor
public boolean isConstructor()(Code)
Returns true if the method being edited is a constructor.



isDirty
public boolean isDirty()(Code)
Returns true if this method has been modified.



isFinal
public boolean isFinal()(Code)



isInterface
public boolean isInterface()(Code)
Returns true if this method's class is an interface.



isNative
public boolean isNative()(Code)



isPackage
public boolean isPackage()(Code)
Returns true is the method has package level visibility



isPrivate
public boolean isPrivate()(Code)



isProtected
public boolean isProtected()(Code)



isPublic
public boolean isPublic()(Code)



isStatic
public boolean isStatic()(Code)



isSynchronized
public boolean isSynchronized()(Code)



localAt
public LocalVariable localAt(int index)(Code)
Returns the LocalVariable with the given index. If there is no local variable at that index, a new one is created at that index. We assume that this variable is not wide.



maxLocals
public int maxLocals()(Code)
Returns the maximum number of locals used by the method.



memberRef
public MemberRef memberRef()(Code)
Returns a MemberRef for the method.



methodInfo
public MethodInfo methodInfo()(Code)
Returns the raw MethodInfo of the method being edited.



name
public String name()(Code)
Returns the name of the method.



nameAndType
public NameAndType nameAndType()(Code)
Returns the NameAndType of the method.



newLabel
public Label newLabel()(Code)
Get the next available label. That is the Label after the final Instruction in the code array. A new label.
throws:
  IllegalStateException - This field has been marked for deletion



newLabelTrue
public Label newLabelTrue()(Code)



newLocal
public LocalVariable newLocal(Type type)(Code)
Creates a new local variable.



newLocal
public LocalVariable newLocal(boolean isWide)(Code)
Creates a new local variable of an undertermined type.
throws:
  IllegalStateException - This field has been marked for deletion



nextBlock
public Label nextBlock(Label label)(Code)
Get the label of the next block after the parameter.
Parameters:
  label - The label at which to begin. The label.



numTryCatches
public int numTryCatches()(Code)
Returns the number of exception handlers in the method.



paramAt
public LocalVariable paramAt(int index)(Code)
Get the LocalVariable for the parameter at the given index.
Parameters:
  index - The index into the params (0 is the this pointer or the firstargument, if static). The LocalVariable for the parameter at the given index.



paramTypes
public Type[] paramTypes()(Code)
Returns an array of Types representing the types of the parameters of this method. It's really used to figure out the type of the local variables that hold the parameters. So, wide data is succeeded by an empty slot. Also, for virtual methods, the first element in the array is the receiver.



print
public void print(PrintStream out)(Code)
Print the method.
Parameters:
  out - Stream to which to print.



rememberDef
public void rememberDef(LocalExpr e)(Code)



removeCodeAt
public void removeCodeAt(int i)(Code)
Removes a Label or Instruction from the code array.
Parameters:
  i - The index of the element to remove.
throws:
  IllegalStateException - This field has been marked for deletion



replaceCodeAt
public void replaceCodeAt(Object obj, int i)(Code)
Replace a Label or Instruction in the code array.
Parameters:
  obj - The new element.
Parameters:
  i - The index of the element to replace
throws:
  IllegalStateException - This field has been marked for deletion



setAbstract
public void setAbstract(boolean flag)(Code)



setCode
public void setCode(List v)(Code)

throws:
  IllegalStateException - This field has been marked for deletion



setDirty
public void setDirty(boolean dirty)(Code)
Sets the dirty flag of this method. The dirty flag is true if the method has been modified.



setFinal
public void setFinal(boolean flag)(Code)

throws:
  IllegalStateException - This field has been marked for deletion



setNative
public void setNative(boolean flag)(Code)

throws:
  IllegalStateException - This field has been marked for deletion



setPrivate
public void setPrivate(boolean flag)(Code)

throws:
  IllegalStateException - This field has been marked for deletion



setProtected
public void setProtected(boolean flag)(Code)

throws:
  IllegalStateException - This field has been marked for deletion



setPublic
public void setPublic(boolean flag)(Code)

throws:
  IllegalStateException - This field has been marked for deletion



setStatic
public void setStatic(boolean flag)(Code)

throws:
  IllegalStateException - This field has been marked for deletion



setSynchronized
public void setSynchronized(boolean flag)(Code)

throws:
  IllegalStateException - This field has been marked for deletion



toString
public String toString()(Code)



tryCatches
public Collection tryCatches()(Code)
Returns the exception handlers (TryCatch) in the method.



type
public Type type()(Code)
Returns the type of the method.



uMap
public UseMap uMap()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.