public class PositionEventHandler extends java.lang.Object implements EventHandler
SynchronizedSpotDataParser
to extract the position
number from the parsed data. When cooperation is needed
between multiple event handlers (eg. using the MultiEventHandler
class, make sure that this event handler receives the event
before any other handler that needs the position value.Modifier and Type | Field and Description |
---|---|
private int |
currentPosition |
private int |
externalIndex |
private int |
parserIndex |
private PositionBatcher |
posBatcher |
private int |
posIndex |
private ReporterBatcher |
reporterBatcher |
private int |
reporterIndex |
Constructor and Description |
---|
PositionEventHandler(int parserIndex,
int posIndex,
PositionBatcher posBatcher,
int reporterIndex,
int externalIndex)
Create a new event handler.
|
Modifier and Type | Method and Description |
---|---|
int |
getCurrentPosition()
Get the current position.
|
void |
handleEvent(EventType eventType,
java.lang.Object eventData,
BfsParser parser)
Get the position number from the given parser/column.
|
private final int parserIndex
private final int posIndex
private final PositionBatcher posBatcher
private final int reporterIndex
private final int externalIndex
private ReporterBatcher reporterBatcher
private int currentPosition
public PositionEventHandler(int parserIndex, int posIndex, PositionBatcher posBatcher, int reporterIndex, int externalIndex)
parserIndex
- The index of the parser, a value between 0 and
the number of synchronized data parsersposIndex
- The index of the data column holding the position number,
a value between 0 and the number of columns in the parsed fileposBatcher
- An optional position batcher if a position/reporter
needs to be createdreporterIndex
- The index of the data column holding the internal
reporter id, ignored if no position batcher is used, -1 if the
external id index should be used instead of the internal idexternalIndex
- The index of the data column holding the external
reporter id, only used if reporterIndex=-1 is specifiedpublic void handleEvent(EventType eventType, java.lang.Object eventData, BfsParser parser)
handleEvent
in interface EventHandler
eventType
- The type of event. See the parser documentation
for more information about the event types it generateseventData
- The data that is associated with the eventparser
- The parser that is resposible for parsing the filepublic int getCurrentPosition()