Package EDU.purdue.cs.bloat.context
Class CachingBloatContext
- java.lang.Object
-
- EDU.purdue.cs.bloat.context.BloatContext
-
- EDU.purdue.cs.bloat.context.PersistentBloatContext
-
- EDU.purdue.cs.bloat.context.CachingBloatContext
-
- All Implemented Interfaces:
EditorContext,EDU.purdue.cs.bloat.inline.InlineContext
public class CachingBloatContext extends PersistentBloatContext
Does a lot of the same stuff as PersistentBloatContext except that it manages the chaches of BLOAT objects. For example, when a MethodEditor is no longer needed, it is removed from the cache if it is not dirty. This context is meant to used in volatile memory.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.MapclassRCprotected java.util.MapfieldRCprotected java.util.MapmethodRC-
Fields inherited from class EDU.purdue.cs.bloat.context.PersistentBloatContext
classEditors, classInfos, DB_COMMIT, fieldEditors, fieldInfos, hierarchy, methodEditors, methodInfos
-
Fields inherited from class EDU.purdue.cs.bloat.context.BloatContext
callGraph, DEBUG, ignoreClasses, ignoreFields, ignoreMethods, ignorePackages, ignoreSystem, inlineStats, loader, roots
-
-
Constructor Summary
Constructors Constructor Description CachingBloatContext(ClassInfoLoader loader, java.util.Collection classes, boolean closure)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommit()Commits all changes made to classes, methods, and fields.voidcommit(ClassInfo info)Classes that are ignored are not committed.voidcommit(FieldInfo info)Commits the changes made to a field.voidcommit(MethodInfo info)Commits the changes made to a method.ClassEditoreditClass(ClassInfo info)Returns a ClassEditor used to edit a class described by a given ClassInfo.FieldEditoreditField(MemberRef field)Returns a FieldEditor for editing a field.FieldEditoreditField(FieldInfo info)Returns a FieldEditor for editing a FieldInfo.MethodEditoreditMethod(MemberRef method)Returns a MethodEditor for editing a method.MethodEditoreditMethod(MethodInfo info)Returns a MethodEditor for editing a method.ClassEditornewClass(int modifiers, java.lang.String className, Type superType, Type[] interfaces)Returns aClassEditorfor editing a new class with the given name.voidrelease(ClassInfo info)Signals that we are done editing a class.voidrelease(FieldInfo info)Signals that we are done editing a field.voidrelease(MethodInfo info)Signals that we are done editing a method.java.lang.StringtoString()Return a textual description of all of the caches.-
Methods inherited from class EDU.purdue.cs.bloat.context.PersistentBloatContext
addClasses, comm, commitDirty, editClass, editClass, getHierarchy, loadClass, newClassInfo, release
-
Methods inherited from class EDU.purdue.cs.bloat.context.BloatContext
addIgnoreClass, addIgnoreField, addIgnoreMethod, addIgnorePackage, db, getCallGraph, getInlineStats, ignoreClass, ignoreField, ignoreMethod, isSystem, main, setIgnoreSystem, setRootMethods
-
-
-
-
Constructor Detail
-
CachingBloatContext
public CachingBloatContext(ClassInfoLoader loader, java.util.Collection classes, boolean closure)
Constructor.- Parameters:
loader- Used to load classesclasses- Some initial classes in the contextclosure- Do we look for the maximum number of classes?
-
-
Method Detail
-
newClass
public ClassEditor newClass(int modifiers, java.lang.String className, Type superType, Type[] interfaces)
Description copied from interface:EditorContextReturns aClassEditorfor editing a new class with the given name. It will override any class with the given name that is already being edited.- Specified by:
newClassin interfaceEditorContext- Overrides:
newClassin classPersistentBloatContext
-
editClass
public ClassEditor editClass(ClassInfo info)
Description copied from interface:EditorContextReturns a ClassEditor used to edit a class described by a given ClassInfo.- Specified by:
editClassin interfaceEditorContext- Overrides:
editClassin classPersistentBloatContext
-
editMethod
public MethodEditor editMethod(MemberRef method) throws java.lang.NoSuchMethodException
Description copied from interface:EditorContextReturns a MethodEditor for editing a method.- Specified by:
editMethodin interfaceEditorContext- Overrides:
editMethodin classPersistentBloatContext- Throws:
java.lang.NoSuchMethodException
-
editMethod
public MethodEditor editMethod(MethodInfo info)
Description copied from interface:EditorContextReturns a MethodEditor for editing a method.- Specified by:
editMethodin interfaceEditorContext- Overrides:
editMethodin classPersistentBloatContext
-
editField
public FieldEditor editField(MemberRef field) throws java.lang.NoSuchFieldException
Description copied from interface:EditorContextReturns a FieldEditor for editing a field.- Specified by:
editFieldin interfaceEditorContext- Overrides:
editFieldin classPersistentBloatContext- Throws:
java.lang.NoSuchFieldException
-
editField
public FieldEditor editField(FieldInfo info)
Description copied from interface:EditorContextReturns a FieldEditor for editing a FieldInfo.- Specified by:
editFieldin interfaceEditorContext- Overrides:
editFieldin classPersistentBloatContext
-
release
public void release(ClassInfo info)
Description copied from interface:EditorContextSignals that we are done editing a class. The object used to model it may be reclaimed.- Specified by:
releasein interfaceEditorContext- Overrides:
releasein classPersistentBloatContext
-
release
public void release(MethodInfo info)
Description copied from interface:EditorContextSignals that we are done editing a method. The object used to model it may be reclaimed.- Specified by:
releasein interfaceEditorContext- Overrides:
releasein classPersistentBloatContext
-
release
public void release(FieldInfo info)
Description copied from interface:EditorContextSignals that we are done editing a field. The object used to model it may be reclaimed.- Specified by:
releasein interfaceEditorContext- Overrides:
releasein classPersistentBloatContext
-
commit
public void commit(ClassInfo info)
Description copied from class:PersistentBloatContextClasses that are ignored are not committed.- Specified by:
commitin interfaceEditorContext- Overrides:
commitin classPersistentBloatContext- See Also:
BloatContext.ignoreClass(Type)
-
commit
public void commit(MethodInfo info)
Description copied from interface:EditorContextCommits the changes made to a method.- Specified by:
commitin interfaceEditorContext- Overrides:
commitin classPersistentBloatContext
-
commit
public void commit(FieldInfo info)
Description copied from interface:EditorContextCommits the changes made to a field.- Specified by:
commitin interfaceEditorContext- Overrides:
commitin classPersistentBloatContext
-
commit
public void commit()
Description copied from interface:EditorContextCommits all changes made to classes, methods, and fields.- Specified by:
commitin interfaceEditorContext- Overrides:
commitin classPersistentBloatContext
-
toString
public java.lang.String toString()
Return a textual description of all of the caches. Useful if we run out of memory.- Overrides:
toStringin classjava.lang.Object
-
-