public final class Label
extends java.lang.Object
Label
class describes a label set in test templates and symbolic test programs.Modifier and Type | Class and Description |
---|---|
static class |
Label.Kind |
Modifier and Type | Field and Description |
---|---|
static int |
NO_REFERENCE_NUMBER |
static int |
NO_SEQUENCE_INDEX |
Constructor and Description |
---|
Label(Label other)
Constructs a copy of the specified label.
|
Modifier and Type | Method and Description |
---|---|
static java.util.List<Label> |
copyAll(java.util.List<Label> labels)
Creates a deep copy of the specified label list.
|
boolean |
equals(java.lang.Object obj) |
BlockId |
getBlockId()
Returns the identifier of the block where the label was defined.
|
java.lang.String |
getName()
Returns the name of the label as it was defined in a test template.
|
int |
getReferenceNumber()
Returns a number that uniquely identifies the label among labels that have the same name.
|
int |
getSequenceIndex()
Returns an index that identifies the instruction sequence where the label is defined.
|
java.lang.String |
getUniqueName()
Returns a unique name for the label based on:
Label name
Block identifier if it is not a root (no parent) block
Reference number if it set
Sequence index if it set
N.B.
|
int |
hashCode() |
boolean |
isGlobal()
Checks whether the label is global.
|
boolean |
isNumeric()
Checks whether the label is numeric.
|
boolean |
isWeak()
Checks whether the label is weak.
|
static Label |
newGlobal(java.lang.String name,
BlockId blockId)
Creates a new global label.
|
static Label |
newLabel(java.lang.String name,
BlockId blockId)
Creates a new normal label.
|
static Label |
newNumeric(int index,
BlockId blockId)
Creates a new numeric label.
|
static Label |
newWeak(java.lang.String name,
BlockId blockId)
Creates a new weak label.
|
void |
setReferenceNumber(int value)
Assigns a number that uniquely identifies the label which is duplicated within an
instruction sequence.
|
void |
setSequenceIndex(int value)
Assigns an index that identifies the instruction sequence where the label is defined.
|
java.lang.String |
toString()
Returns textual representation of the label based on its unique name.
|
public static final int NO_REFERENCE_NUMBER
public static final int NO_SEQUENCE_INDEX
public Label(Label other)
other
- Label to be copied.java.lang.IllegalStateException
- if the other
argument equals null
;public static Label newLabel(java.lang.String name, BlockId blockId)
name
- The name of the label.blockId
- The identifier of the block where the label is defined.Label
object.java.lang.IllegalStateException
- if any of the arguments is null
.public static Label newGlobal(java.lang.String name, BlockId blockId)
name
- The name of the label.blockId
- The identifier of the block where the label is defined.Label
object.java.lang.IllegalStateException
- if any of the arguments is null
.public static Label newNumeric(int index, BlockId blockId)
index
- The index of the label.blockId
- The identifier of the block where the label is defined.Label
object.java.lang.IllegalStateException
- if the blockId
argument is null
.public static Label newWeak(java.lang.String name, BlockId blockId)
name
- The name of the label.blockId
- The identifier of the block where the label is defined.Label
object.java.lang.IllegalStateException
- if any of the arguments is null
.public static java.util.List<Label> copyAll(java.util.List<Label> labels)
labels
- List of labels to be copied.java.lang.IllegalArgumentException
- if the parameter is null
.public void setReferenceNumber(int value)
value
- Number that uniquely identifies a label which is duplicated within a sequence.public int getReferenceNumber()
public void setSequenceIndex(int value)
value
- Index that identifies the instruction sequence where the label is defined.public int getSequenceIndex()
public java.lang.String getName()
public java.lang.String getUniqueName()
public BlockId getBlockId()
public boolean isGlobal()
true
if the label is global or false
otherwise.public boolean isNumeric()
true
if the label is numeric or false
otherwise.public boolean isWeak()
true
if the label is weak or false
otherwise.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object