public interface RecordInput extends PhysicalInputPort, SteppableRecordValued
ScalarInputField
fields, one for each field of the record,
indexed both by name and position, as determined by the schema of the input's
RecordTokenType
.
As with other ports, the input maintains a position in the flow. However,
the position in the flow is only advanced by calling methods on the RecordInput
itself; the component input fields cannot advance the position. When the port is
positioned on a token, the input fields contain the field values of the current record.
Modifier and Type | Method and Description |
---|---|
void |
detach()
Detaches the input port from its data flow.
|
ScalarInputField |
getField(int index)
Gets the input field at the given position.
|
ScalarInputField |
getField(String fieldName)
Gets the input field with the given name.
|
ScalarInputField[] |
getFields()
Gets all input fields of this record port.
|
long |
getPosition()
Retrieves the position of the port.
|
InputStatistics |
getStats()
Retrieves the run-time statistics gathered for this input.
|
RecordTokenType |
getType()
Gets the type of tokens in the underlying flow.
|
boolean |
isAttached()
Tests if the port is attached to a data flow.
|
boolean |
isOnToken()
Tests if the port is positioned on a token.
|
boolean |
stepNext()
Advances the cursor position of this input by one token.
|
boolean |
stepNext(long n)
Advances the cursor position of this input by the specified number of
tokens.
|
long |
stepUntil(long n,
Timeout timeout)
Advances the cursor position as many tokens as possible up to the specified
number of tokens, within a given amount of time.
|
long |
stepUntil(Timeout timeout)
Advances the cursor position of this input by one token, if it can be be done in
a given amount of time.
|
boolean |
transfer(TokenAppendable out)
Transfers the current token value of the input port to the target.
|
boolean |
transfer(TokenAppendable out,
boolean startWithNextToken)
Transfers a token value from the input port to the given target,
transferring either the current token (that is, push, then
step) or the next token (that is, step, then
push).
|
boolean |
transfer(TokenAppendable out,
long n)
Transfers multiple tokens of the input port starting at the current
token to the given target.
|
boolean |
transfer(TokenAppendable out,
long n,
boolean startWithNextToken)
Transfers multiple tokens from the input port, beginning either with the
current token or the next token.
|
void |
transferAll(TokenAppendable out)
Transfers all remaining tokens from the input port starting at the
current token to the given target.
|
void |
transferAll(TokenAppendable out,
boolean startWithNextToken)
Transfers all remaining tokens from the input port, beginning either with
the current token or the next token.
|
containsNull, newFieldIterator, newFieldIterator, newFieldIterator, size
isNull
RecordTokenType getType()
PhysicalPort
getType
in interface PhysicalPort
getType
in interface RecordTyped
getType
in interface RecordValued
getType
in interface TokenTyped
getType
in interface TokenValued
ScalarInputField[] getFields()
getFields
in interface RecordValued
ScalarInputField getField(String fieldName)
getField
in interface RecordValued
fieldName
- name of the fieldScalarInputField getField(int index)
getField
in interface RecordValued
getField
in interface SteppableRecordValued
index
- zero-based index into the field listboolean stepNext()
stepNext
in interface SteppableRecordValued
true
if the cursor was advanced and resides on a valid token,
false
if end of data was encountered.boolean stepNext(long n)
n
- the number of tokens to advancetrue
if the cursor was advanced the specified number of
tokens and resides on a valid token,
false
if end of data was encountered.long stepUntil(Timeout timeout)
timeout
- the maximum amount of time to block for data.
Using a value of 0
will block indefinitely, as stepNext()
does.-1
is be returned.long stepUntil(long n, Timeout timeout)
n
- the number of tokens to advancetimeout
- the maximum amount of time to block for data.
Using a value of 0
will block indefinitely, as stepNext(long)
does.-(tokensAdvanced + 1)
,
where tokensAdvanced
is the number of tokens advanced at the point when
end of data was hit.boolean transfer(TokenAppendable out)
The port and the given target must have compatible types for transfer.
out
- target onto which to push the current token.
This can be any appendable sequence of tokens, such as an output port.true
if the input port is positioned on a
valid token upon completion, false
if it is at
end of data.stepNext()
boolean transfer(TokenAppendable out, long n)
The port and the given output port must have compatible types for transfer. Fewer tokens than the given count may be transferred if this port encounters end of data during the transfer.
out
- target onto which to push tokens. This
can be any appendable sequence of tokens, such as an output port.n
- number of tokens to transfertrue
if the input port is positioned on a
valid token upon completion, false
if it is at
end of data.stepNext(long)
void transferAll(TokenAppendable out)
out
- target onto which to push all remaining tokens.
This can be any appendable sequence of tokens, such as an output port.boolean transfer(TokenAppendable out, boolean startWithNextToken)
This input port and the given output port must have compatible types for transfer. If transferring the current token, the token cursor for this port must be positioned on a token. When transferring the next token, it is possible that no token gets transferred if the next position is end of data.
out
- target onto which to push the token value. This can be any
appendable sequence of tokens, such as an output port.startWithNextToken
- indicates whether the current token or the next
token is pushed onto the target.true
if the input port is positioned on a
valid token upon completion, false
if it is at
end of data.stepNext()
,
transfer(TokenAppendable)
boolean transfer(TokenAppendable out, long n, boolean startWithNextToken)
This input port and the given target must have compatible types for transfer. If transferring starting with the current token, the token cursor for the port must be positioned on a token. Fewer tokens than requested (possibly none) may be transferred if the port encounters end of data during the transfer.
transfer
in interface SteppableRecordValued
out
- target onto which to push tokens. This can be anyn
- number of tokens to transferstartWithNextToken
- indicates whether to start the transfer with
the current token or the next token.true
if the input port is positioned on a
valid token upon completion, false
if it is at
end of data.stepNext(long)
,
transfer(TokenAppendable, long)
void transferAll(TokenAppendable out, boolean startWithNextToken)
The port and the given target must have compatible types for transfer.
out
- target onto which to push all remaining tokens.
This can be any appendable sequence of tokens, such as an output port.startWithNextToken
- indicates whether to start the transfer with
the current token or the next token.transferAll(TokenAppendable)
void detach()
Detaching a port frees resources. If an input port is no longer needed and end of data has not been reached, it is a good idea to detach it.
detach
in interface PhysicalPort
isAttached()
long getPosition()
stepNext()
and stepNext(long)
.
Once end of data has been encountered, this value will be exactly
the number of tokens which were on the flow.
The position is zero based. The position acts as a cursor in that the
position lies between the current element and the next element. Thus a
position of zero indicates that no element has been addressed from the
port. This is similar to the cursor semantics in the
ListIterator
interface.
getPosition
in interface SteppableRecordValued
boolean isAttached()
detach()
If a port is attached, the port can be safely advanced (using
stepNext()
, etc.). However, this does not indicate the
port is positioned on a token, so attempting to access the
current token value may fail with an exception.
If a port is not attached, any attempt to advance the port or access the current value will throw an exception.
isAttached
in interface PhysicalPort
isOnToken()
boolean isOnToken()
While positioned on a token, the current value can be safely accessed without error. But if not positioned on a token, all attempts to access the current value will throw an exception.
isAttached()
InputStatistics getStats()
getStats
in interface PhysicalPort
PortStats
gathered during execution or
null
if the configuration did not specify
collecting statisticsCopyright © 2016 Actian Corporation. All rights reserved.