public final class LabelManager
extends java.lang.Object
LabelManager class is resolving references to labels that have the same
names, but are defined in different blocks. It stores all labels defined by a sequence and their
relative positions grouped by name. When it is required to perform a jump to a label with a
specific name, it chooses the most suitable label depending on the block from which the jump is
performed. Here are the rules according to which the choice is made:
LabelManager.TargetDistance class.| Modifier and Type | Class and Description |
|---|---|
static class |
LabelManager.Target
The
LabelManager.Target class stores information about the target the specified label points to. |
| Constructor and Description |
|---|
LabelManager()
Constructs a new label manager that stores no information about labels.
|
LabelManager(LabelManager other) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAllLabels(java.util.Collection<Label> labels,
long address,
int sequenceIndex)
Adds information about label in the specified collection to the table of label targets.
|
void |
addLabel(Label label,
long address)
Adds information about a label to the table of label targets.
|
void |
reset()
Clears all labels.
|
LabelManager.Target |
resolve(Label referenceLabel)
Resolves a reference to a label having a specific name from a specific block and returns the
most suitable target (label and its position).
|
java.lang.String |
toString() |
public LabelManager()
public LabelManager(LabelManager other)
public void addLabel(Label label, long address)
label - Label to be registered.address - Address associated with the label.java.lang.IllegalArgumentException - if the parameter is null.public void addAllLabels(java.util.Collection<Label> labels, long address, int sequenceIndex)
labels - Collection of labels to be registered.address - Address the labels in the collection point to.sequenceIndex - Index of the sequence.java.lang.IllegalArgumentException - if the label parameter is null.java.lang.IllegalArgumentException - if an object in the labels collection is not a
Label object.public LabelManager.Target resolve(Label referenceLabel)
LabelManager class comment). If there are several
equally possible choices (ambiguity) a warning message is printed.referenceLabel - A Label object that describes a reference to a label that has a specific
name from a specific block.null if no label having such name is found.java.lang.IllegalArgumentException - if the parameter is null.public void reset()
public java.lang.String toString()
toString in class java.lang.Object