public final class BinaryRegister extends Object implements ScalarRegister, BinarySettable
BinaryValued
object.Constructor and Description |
---|
BinaryRegister()
Creates a new null-valued register.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
asBinary()
Gets the contained binary value.
|
byte[] |
asBinaryRef()
Gets a reference to the contained binary value.
|
ScalarTokenType |
getType()
Gets the data type of the token.
|
boolean |
isNull()
Indicates whether the token is null valued.
|
boolean |
isZero()
Indicates whether the value is the zero value
for the type.
|
void |
set(byte[] data)
Sets the container to the given binary data.
|
void |
set(byte[] data,
int offset,
int length)
Sets the container to a subsequence of the given binary
data.
|
void |
set(TokenValued value)
Sets the contained value to the given token value.
|
void |
setNull()
Sets the contained value to be null valued.
|
void |
setRef(byte[] ref)
Sets the container to the given byte array reference.
|
void |
setZero()
Sets the contained value to be zero valued.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getType, isZero
isNull
public void setNull()
TokenSettable
setNull
in interface TokenSettable
public void setZero()
TokenSettable
setZero
in interface TokenSettable
public void set(byte[] data)
BinarySettable
The input array is copied to prevent later modification of the value
that is set. To avoid this overhead and prevent the data copy,
use the BinarySettable.setRef(byte[])
method instead.
set
in interface BinarySettable
data
- binary value to which to set the containerpublic void set(byte[] data, int offset, int length)
BinarySettable
set
in interface BinarySettable
data
- binary data containing the subsequence to which to set the containeroffset
- starting offset of the subsequencelength
- length of the subsequence, in bytespublic void setRef(byte[] ref)
BinarySettable
While this call avoids the overhead seen with BinarySettable.set(byte[])
,
the caller must guarantee that the input array will not be
modified subsequent to this call. Failure to comply may
result in the dataflow exhibiting unexpected behavior.
setRef
in interface BinarySettable
ref
- binary value to which to set the containerpublic void set(TokenValued value)
TokenSettable
set
in interface TokenSettable
value
- the value to which to set the containerpublic final ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public final byte[] asBinary()
BinaryValued
The array returned is a copy of the binary data contained in
the object. To avoid this overhead, use BinaryValued.asBinaryRef()
instead.
asBinary
in interface BinaryValued
byte[]
. If
null valued, as indicated by TokenValued.isNull()
,
null
is returned.public final byte[] asBinaryRef()
BinaryValued
While this call avoids the overhead seen with BinaryValued.asBinary()
,
the caller must guarantee that the returned array will not be
modified. Failure to comply may result in the dataflow exhibiting
unexpected behavior, as other operators may (or may not)
see the modified value.
asBinaryRef
in interface BinaryValued
byte[]
holding the contained
value. If null valued, as indicated by TokenValued.isNull()
,
null
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 © 2020 Actian Corporation. All rights reserved.