public final class CharToken extends Object implements ScalarToken, Comparable<CharToken>
CharValued
object.Modifier and Type | Field and Description |
---|---|
static CharToken |
NULL
A null valued
CharToken |
static CharToken |
ZERO
A zero valued
CharToken |
static char |
ZERO_VALUE
The character representing a zero value,
'\0' . |
Constructor and Description |
---|
CharToken(char value)
Constructs a new token with the given non-null
character value.
|
CharToken(CharValued value)
Constructs a new token with the character
value in the given container.
|
Modifier and Type | Method and Description |
---|---|
char |
asChar()
Gets the contained character value.
|
Character |
asObject()
Gets the value of the token as an object.
|
int |
compareTo(CharToken that) |
boolean |
equals(Object obj)
Indicates whether another object is equal to this token.
|
ScalarTokenType |
getType()
Gets the data type of the token.
|
int |
hashCode()
Returns a hash code for the token.
|
boolean |
isNull()
Indicates whether the token is null valued.
|
boolean |
isZero()
Indicates whether the value is the zero value
for the type.
|
static CharToken |
parse(String value)
Converts a string representation of a char value into
a token.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getType, isZero
isNull
public static final CharToken NULL
CharToken
public static final char ZERO_VALUE
'\0'
.public static final CharToken ZERO
CharToken
public CharToken(CharValued value)
value
- a CharValued
containing the
desired valuepublic CharToken(char value)
NULL
.value
- the character value of the tokenpublic int compareTo(CharToken that)
compareTo
in interface Comparable<CharToken>
public Character asObject()
null
if the token is null valued.public boolean equals(Object obj)
DataToken
TokenComparator.equal(TokenValued,TokenValued)
but makes it possible to store DataToken
s in Map
s.public int hashCode()
DataToken
TokenConverter.asHashCode(TokenValued)
.public static CharToken parse(String value)
value
- a string value to interpret as a character;
this must be exactly 1 character in lengthpublic final ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public final char asChar()
CharValued
asChar
in interface CharValued
char
. If null valued,
as indicated by TokenValued.isNull()
, Character.MAX_VALUE
is returned.public final boolean isZero()
ScalarValued
isZero
in interface ScalarValued
true
if the value is the zero value,
false
otherwise.public final boolean isNull()
TokenValued
isNull
in interface TokenValued
true
if the token is null valued,
false
otherwiseCopyright © 2016 Actian Corporation. All rights reserved.