public class OrderedRecordToken extends RecordToken
This implementation maintains the order of the entries as they were added.
_fields, EMPTY_RECORD
Constructor and Description |
---|
OrderedRecordToken()
Construct an OrderedRecordToke with now fields.
|
OrderedRecordToken(java.util.Map<java.lang.String,Token> fieldMap)
Construct an OrderedRecordToken with the labels and values specified
by a given Map object.
|
OrderedRecordToken(java.lang.String init)
Construct a RecordToken from the specified string.
|
OrderedRecordToken(java.lang.String[] labels,
Token[] values)
Construct an OrderedRecordToken with the specified labels and values.
|
Modifier and Type | Method and Description |
---|---|
protected RecordToken |
_createRecordToken(java.lang.String[] labels,
Token[] values)
Create a new RecordToken.
|
protected java.util.Set<java.lang.String> |
_createSet()
Create a Set implementation appropriate for operations on this RecordToken.
|
protected void |
_initializeStorage()
Initialize the storage used by this token.
|
protected BooleanToken |
_isCloseTo(Token rightArgument,
double epsilon)
Test whether the value of this token is close to the first
argument, where "close" means that the distance between them
is less than or equal to the second argument.
|
protected BooleanToken |
_isEqualTo(Token rightArgument)
Return true if the specified token is equal to this one.
|
boolean |
equals(java.lang.Object object)
Return true if the class of the argument is RecordToken, and
the argument has the same set of labels as this token and the
corresponding fields are equal, as determined by the equals
method of the contained tokens.
|
int |
hashCode()
Return a hash code value for this token.
|
java.lang.String |
toString()
Return the value of this token as a string.
|
_add, _divide, _modulo, _multiply, _subtract, get, getType, labelSet, length, merge, mergeReturnType, one, zero
add, addReverse, divide, divideReverse, isCloseTo, isEqualTo, modulo, moduloReverse, multiply, multiplyReverse, notSupportedDifferentClassesMessage, subtract, subtractReverse
isCloseTo, isNil, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, pow, zeroReturnType
public OrderedRecordToken()
RecordToken
public OrderedRecordToken(java.util.Map<java.lang.String,Token> fieldMap) throws IllegalActionException
fieldMap
- A Map that has keys of type String and
values of type Token.IllegalActionException
- If the map contains null
keys or values, or if it contains non-String keys or non-Token
values.public OrderedRecordToken(java.lang.String init) throws IllegalActionException
Record labels that contain any non-Java identifier characters must be presented as a string i.e., surrounded with single or double quotes. Quotes within label strings must be escaped using a backslash.
init
- A string expression of a record.IllegalActionException
- If the string does not
contain a parsable record.public OrderedRecordToken(java.lang.String[] labels, Token[] values) throws IllegalActionException
labels
- An array of labels.values
- An array of Tokens.IllegalActionException
- If the labels or the values array
do not have the same length, or contains null element,
or the labels array contains duplicate elements.public boolean equals(java.lang.Object object)
equals
in class RecordToken
object
- An instance of Object.hashCode()
public int hashCode()
hashCode
in class RecordToken
public java.lang.String toString()
[label = value, label = value, ...]
The record fields are listed in the their original order
Record labels that contain any non-Java identifier characters are surrounded with double quotes. Quotes within label strings are escaped using a backslash.
toString
in class RecordToken
protected RecordToken _createRecordToken(java.lang.String[] labels, Token[] values) throws IllegalActionException
RecordToken
_createRecordToken
in class RecordToken
labels
- An array of String labels for the RecordToken to be created.values
- An array of Token values for the RecordToken to be created.IllegalActionException
- If thrown while constructing the RecordTokenRecordToken
protected void _initializeStorage()
_initializeStorage
in class RecordToken
protected java.util.Set<java.lang.String> _createSet()
_createSet
in class RecordToken
protected BooleanToken _isCloseTo(Token rightArgument, double epsilon) throws IllegalActionException
_isCloseTo
in class RecordToken
rightArgument
- The token to compare to this token.epsilon
- The value that we use to determine whether two
tokens are close.IllegalActionException
- If throw while checking
the closeness of an element of the record.protected BooleanToken _isEqualTo(Token rightArgument) throws IllegalActionException
_isEqualTo
in class RecordToken
rightArgument
- The token to compare to this token.IllegalActionException
- If this method is not
supported by the derived class.