public class SingleMessage extends java.lang.Object implements IMessageType, java.lang.Comparable<SingleMessage>
This class represents one single MIDI message. It’s used for the messages in the messages table, produced by the SequenceAnalyzer
.
Jan Trukenmüller
Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<java.lang.Integer,java.lang.Object> |
options
can be used to store custom options
|
OPT_CHANNEL, OPT_CONTROLLER, OPT_LEAF_NODE, OPT_LENGTH, OPT_MESSAGE, OPT_META_TYPE, OPT_MSG_NUM, OPT_NRPN, OPT_RPN, OPT_STATUS_BYTE, OPT_SUB_ID_1, OPT_SUB_ID_2, OPT_SUMMARY, OPT_SYSEX_CHANNEL, OPT_TEMPO_BPM, OPT_TEMPO_MPQ, OPT_TEXT, OPT_TICK, OPT_TRACK, OPT_VENDOR_ID, OPT_VENDOR_NAME, OPTIONS
Constructor and Description |
---|
SingleMessage() |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(SingleMessage other)
Compares this message with the given one.
|
java.lang.String |
getDistinctOptions(int id)
Returns the custom option with the given ID as a string.
|
java.lang.String |
getDistinctOptions(int id,
java.lang.String separator)
Returns the custom option with the given ID.
|
java.lang.Object |
getOption(int id)
Returns the custom option with the given ID.
|
java.lang.String |
getRange(int id)
Returns the custom option with the given ID.
|
java.lang.String |
getType()
Returns a description of the message type.
|
java.lang.String |
getTypeTooltip()
Returns the tooltip for the type column of the message table for this message.
|
void |
setOption(int id,
java.lang.Object value)
Sets the custom option with the given ID.
|
java.lang.String |
toString()
Used in unit tests.
|
private java.util.HashMap<java.lang.Integer,java.lang.Object> options
can be used to store custom options
public void setOption(int id, java.lang.Object value)
Sets the custom option with the given ID.
id
- The option ID.value
- The option value.public java.lang.Object getOption(int id)
Returns the custom option with the given ID.
Returns null, if no option of the given ID exists.
getOption
in interface IMessageType
id
- The option ID.public java.lang.String getRange(int id)
Returns the custom option with the given ID.
Returns null, if no option of the given ID exists.
Same as getDistinctOptions(int)
, but necessary in order to fulfill the interface requirements.
getRange
in interface IMessageType
id
- The option ID.public java.lang.String getDistinctOptions(int id)
Returns the custom option with the given ID as a string.
Returns null, if no option of the given ID exists.
The only difference to getOption(int)
is the return type.
getDistinctOptions
in interface IMessageType
id
- The option ID.public java.lang.String getDistinctOptions(int id, java.lang.String separator)
Returns the custom option with the given ID.
Returns null, if no option of the given ID exists.
Same as getOption(int)
, but necessary in order to fulfill the interface requirements.
getDistinctOptions
in interface IMessageType
id
- The option ID.separator
- The string to be used in order to separate the values.public int compareTo(SingleMessage other)
Compares this message with the given one. This is needed for sorting.
Sorting criteria are:
compareTo
in interface java.lang.Comparable<SingleMessage>
other
- The other message to be compared with.public java.lang.String getType()
Returns a description of the message type. This is used for the “type” column in the message table.
The description contains the names from the according tree nodes in reverse order. Only the root node is not included.
public java.lang.String getTypeTooltip()
Returns the tooltip for the type column of the message table for this message.
The tooltip shows the hierarchy of the message type, according to it’s leaf node’s tree path.
public java.lang.String toString()
Used in unit tests.
toString
in class java.lang.Object