Class LabelRange
java.lang.Object
net.covers1624.coffeegrinder.util.asm.LabelRange
Represents a logical list of
Labels as described in Bytecode.
Created by covers1624 on 6/4/21.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LabelRangecompute(org.objectweb.asm.tree.InsnList list, org.objectweb.asm.Label start, org.objectweb.asm.Label end, boolean exclusiveEnd) Computes aLabelRangefrom the givenInsnList.booleancontainsLabel(org.objectweb.asm.Label label) Checks if a given label is contained within the range.booleanstatic @Nullable LabelRangeextractRange(org.objectweb.asm.tree.InsnList list) org.objectweb.asm.LabelgetEnd()Gets the last label included in this range.static org.objectweb.asm.LabelgetLabelAfter(org.objectweb.asm.tree.InsnList list, org.objectweb.asm.Label target) Get the label declared immediately after the target label.List<org.objectweb.asm.Label> getRange()Gets the ordered list of labels included in this range.org.objectweb.asm.LabelgetStart()Gets the first label included in this range.inthashCode()
-
Field Details
-
start
public final org.objectweb.asm.Label start -
end
public final org.objectweb.asm.Label end -
range
-
-
Constructor Details
-
LabelRange
-
-
Method Details
-
getStart
public org.objectweb.asm.Label getStart()Gets the first label included in this range.- Returns:
- The
Label.
-
getEnd
public org.objectweb.asm.Label getEnd()Gets the last label included in this range. This may be the same asgetStart()- Returns:
- The
Label.
-
getRange
Gets the ordered list of labels included in this range. This is exactly how they appear in Bytecode, and are not sorted.- Returns:
- The range.
-
containsLabel
public boolean containsLabel(org.objectweb.asm.Label label) Checks if a given label is contained within the range.- Parameters:
label- The label to check.- Returns:
- If the label is contained within the range.
-
equals
-
hashCode
public int hashCode() -
compute
public static LabelRange compute(org.objectweb.asm.tree.InsnList list, org.objectweb.asm.Label start, org.objectweb.asm.Label end, boolean exclusiveEnd) Computes aLabelRangefrom the givenInsnList.- Parameters:
list- TheInsnListto extract the range from.start- The firstLabelto be included in the range.end- The lastLabelto be included in the range.exclusiveEnd- If the provided endLabelshould be exclusive or inclusive.- Returns:
- The built range.
- Throws:
IllegalStateException- If either the start or end label are not included in the providedInsnList.
-
getLabelAfter
public static org.objectweb.asm.Label getLabelAfter(org.objectweb.asm.tree.InsnList list, org.objectweb.asm.Label target) Get the label declared immediately after the target label.- Parameters:
list- TheInsnListto search.target- The target label to search for.- Returns:
- The label after the target.
-
extractRange
-