Package net.fabricmc.mappingio.tree
Class MemoryMappingTree
java.lang.Object
net.fabricmc.mappingio.tree.MemoryMappingTree
- All Implemented Interfaces:
MappingVisitor,MappingTree,MappingTreeView,VisitableMappingTree
VisitableMappingTree implementation that stores all data in memory.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.fabricmc.mappingio.tree.MappingTree
MappingTree.ClassMapping, MappingTree.ElementMapping, MappingTree.FieldMapping, MappingTree.MemberMapping, MappingTree.MetadataEntry, MappingTree.MethodArgMapping, MappingTree.MethodMapping, MappingTree.MethodVarMappingNested classes/interfaces inherited from interface net.fabricmc.mappingio.tree.MappingTreeView
MappingTreeView.ClassMappingView, MappingTreeView.ElementMappingView, MappingTreeView.FieldMappingView, MappingTreeView.MemberMappingView, MappingTreeView.MetadataEntryView, MappingTreeView.MethodArgMappingView, MappingTreeView.MethodMappingView, MappingTreeView.MethodVarMappingView -
Field Summary
Fields inherited from interface net.fabricmc.mappingio.tree.MappingTreeView
MIN_NAMESPACE_ID, NULL_NAMESPACE_ID, SRC_NAMESPACE_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(MappingVisitor visitor, VisitOrder order) void@Nullable MappingTree.ClassMapping@Nullable MappingTree.ClassMappingCollection<? extends MappingTree.ClassMapping> List<? extends MappingTree.MetadataEntry> List<? extends MappingTree.MetadataEntry> getMetadata(String key) @Nullable String@Nullable MappingTree.ClassMappingremoveClass(String srcName) booleanremoveMetadata(String key) Removes all metadata entries whose key is equal to the passed one.voidreset()Reset the visitor, including any chained visitors, to allow for another independent visit (excluding visitEnd=false).setDstNamespaces(List<String> namespaces) voidsetHierarchyInfoProvider(@Nullable HierarchyInfoProvider<?> provider) voidsetIndexByDstNames(boolean indexByDstNames) @Nullable StringsetSrcNamespace(String namespace) booleanvisitClass(String srcName) Visit a class.voidvisitComment(MappedElementKind targetKind, String comment) Comment for the specified element (last content-visited or any parent).voidvisitDstName(MappedElementKind targetKind, int namespace, String name) Destination name for the current element.booleanvisitElementContent(MappedElementKind targetKind) Determine whether the element content (comment, sub-elements) should be visited.booleanvisitEnd()Finish the visitation pass.booleanvisitField(String srcName, @Nullable String srcDesc) voidvisitMetadata(String key, @Nullable String value) booleanvisitMethod(String srcName, @Nullable String srcDesc) booleanvisitMethodArg(int argPosition, int lvIndex, @Nullable String srcName) Visit a parameter.booleanvisitMethodVar(int lvtRowIndex, int lvIndex, int startOpIdx, int endOpIdx, @Nullable String srcName) Visit a variable.voidvisitNamespaces(String srcNamespace, List<String> dstNamespaces) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.fabricmc.mappingio.tree.MappingTree
getField, getField, getMethod, getMethodMethods inherited from interface net.fabricmc.mappingio.tree.MappingTreeView
accept, getMaxNamespaceId, getMinNamespaceId, getNamespaceId, getNamespaceName, mapClassName, mapClassName, mapDesc, mapDesc, mapDesc, mapDescMethods inherited from interface net.fabricmc.mappingio.MappingVisitor
getFlags, visitContent, visitDstDesc, visitHeader
-
Constructor Details
-
MemoryMappingTree
public MemoryMappingTree() -
MemoryMappingTree
public MemoryMappingTree(boolean indexByDstNames) -
MemoryMappingTree
-
-
Method Details
-
setIndexByDstNames
public void setIndexByDstNames(boolean indexByDstNames) -
setHierarchyInfoProvider
@Experimental public void setHierarchyInfoProvider(@Nullable @Nullable HierarchyInfoProvider<?> provider) -
getSrcNamespace
- Specified by:
getSrcNamespacein interfaceMappingTreeView- Returns:
- The source namespace, or
nullif the tree is uninitialized.
-
setSrcNamespace
- Specified by:
setSrcNamespacein interfaceMappingTree
-
getDstNamespaces
- Specified by:
getDstNamespacesin interfaceMappingTreeView- Returns:
- A list containing the destination namespaces, in order of their IDs. Can only be empty if the tree is uninitialized.
-
setDstNamespaces
- Specified by:
setDstNamespacesin interfaceMappingTree
-
getMetadata
- Specified by:
getMetadatain interfaceMappingTree- Specified by:
getMetadatain interfaceMappingTreeView- Returns:
- A modifiable list of all metadata entries currently present in the tree. The list's order is equal to the order in which the entries have been originally added.
-
getMetadata
- Specified by:
getMetadatain interfaceMappingTree- Specified by:
getMetadatain interfaceMappingTreeView- Returns:
- An unmodifiable list of all metadata entries currently present in the tree whose key is equal to the passed one. The list's order is equal to the order in which the entries have been originally added.
-
addMetadata
- Specified by:
addMetadatain interfaceMappingTree
-
removeMetadata
Description copied from interface:MappingTreeRemoves all metadata entries whose key is equal to the passed one.- Specified by:
removeMetadatain interfaceMappingTree- Returns:
- Whether or not any entries have been removed.
-
getClasses
- Specified by:
getClassesin interfaceMappingTree- Specified by:
getClassesin interfaceMappingTreeView
-
getClass
- Specified by:
getClassin interfaceMappingTree- Specified by:
getClassin interfaceMappingTreeView
-
getClass
- Specified by:
getClassin interfaceMappingTree- Specified by:
getClassin interfaceMappingTreeView
-
addClass
- Specified by:
addClassin interfaceMappingTree
-
removeClass
- Specified by:
removeClassin interfaceMappingTree
-
accept
- Specified by:
acceptin interfaceMappingTreeView- Throws:
IOException
-
reset
public void reset()Description copied from interface:MappingVisitorReset the visitor, including any chained visitors, to allow for another independent visit (excluding visitEnd=false).- Specified by:
resetin interfaceMappingVisitor
-
visitNamespaces
- Specified by:
visitNamespacesin interfaceMappingVisitor
-
visitMetadata
- Specified by:
visitMetadatain interfaceMappingVisitor
-
visitClass
Description copied from interface:MappingVisitorVisit a class.- Specified by:
visitClassin interfaceMappingVisitor- Parameters:
srcName- The fully qualified source name of the class, in internal form (slashes instead of dots, dollar signs for delimiting inner classes).- Returns:
- Whether or not the class's content should be visited too.
-
visitField
- Specified by:
visitFieldin interfaceMappingVisitor
-
visitMethod
- Specified by:
visitMethodin interfaceMappingVisitor
-
visitMethodArg
Description copied from interface:MappingVisitorVisit a parameter.- Specified by:
visitMethodArgin interfaceMappingVisitor- Parameters:
argPosition- Always starts at 0 and gets incremented by 1 for each additional parameter.lvIndex- The parameter's local variable index in the current method. Starts at 0 for static methods, 1 otherwise. For each additional parameter, it gets incremented by 1, or by 2 if it's a primitivelongordouble.srcName- The optional source name of the parameter.- Returns:
- Whether or not the arg's content should be visited too.
-
visitMethodVar
public boolean visitMethodVar(int lvtRowIndex, int lvIndex, int startOpIdx, int endOpIdx, @Nullable @Nullable String srcName) Description copied from interface:MappingVisitorVisit a variable.- Specified by:
visitMethodVarin interfaceMappingVisitor- Parameters:
lvtRowIndex- The variable's index in the method's LVT (local variable table). It is optional, so -1 can be passed instead. This is the case since LVTs themselves are optional debug information, see JVMS 4.7.13.lvIndex- The var's local variable index in the current method. For each additional variable, it gets incremented by 1, or by 2 if it's a primitivelongordouble. The first variable starts where the last parameter left off (plus the offset).startOpIdx- Required for cases when the lvIndex alone doesn't uniquely identify a local variable. This is the case when variables get re-defined later on, in which case most decompilers opt to not re-define the existing var, but instead generate a new one (with both sharing the same lvIndex).endOpIdx- Counterpart to startOpIdx. Exclusive.srcName- The optional source name of the variable.- Returns:
- Whether or not the var's content should be visited too.
-
visitEnd
public boolean visitEnd()Description copied from interface:MappingVisitorFinish the visitation pass.Implementors may throw an exception if a second pass is requested without the
NEEDS_MULTIPLE_PASSESflag having been passed beforehand, but only if that behavior is documented.- Specified by:
visitEndin interfaceMappingVisitor- Returns:
trueif the visitation pass is final,falseif it should be started over.
-
visitDstName
Description copied from interface:MappingVisitorDestination name for the current element.- Specified by:
visitDstNamein interfaceMappingVisitor- Parameters:
namespace- Namespace index (index into the dstNamespaces list inMappingVisitor.visitNamespaces(java.lang.String, java.util.List<java.lang.String>)).name- Destination name.
-
visitElementContent
Description copied from interface:MappingVisitorDetermine whether the element content (comment, sub-elements) should be visited.Called after visiting the target itself (e.g. visitClass for targetKind=class), its dst names and descs, but before any child elements or the comment.
This is also a notification about all available dst names having been passed on.
- Specified by:
visitElementContentin interfaceMappingVisitor- Returns:
trueif the contents are to be visited,falseotherwise- Throws:
IOException
-
visitComment
Description copied from interface:MappingVisitorComment for the specified element (last content-visited or any parent).- Specified by:
visitCommentin interfaceMappingVisitor- Parameters:
comment- Comment as a potentially multi-line string.
-