public class DataUnitFinder<Tunit extends PamDataUnit>
extends java.lang.Object
It sets up a list iterator at the start of the data block and then searches for each requested data unit from the unit after the last unit requested. This will generally be an efficient way of matching two almost ordered lists of units.
If the iterator gets to the end of the list without finding a match it restarts at the beginning, only returning null (nothing found) when it has been right through the list exactly once.
The finder can work with a default mather of time and channel or with user created matchers which can use any criteria the user wants
DataUnitMatcher
,
DefaultUnitMatcher;
Constructor and Description |
---|
DataUnitFinder(PamDataBlock<Tunit> pamDataBlock)
Create a data unit finder that uses the default matcher.
|
DataUnitFinder(PamDataBlock<Tunit> pamDataBlock,
DataUnitMatcher dataUnitMatcher)
Create a data unit finder that uses a user created matcher
|
Modifier and Type | Method and Description |
---|---|
Tunit |
findDataUnit(java.lang.Object... criteria)
Find a data unit which satisfies the criteria in
criteria.
|
DataUnitMatcher |
getDataUnitMatcher() |
Tunit |
getLastUnit() |
PamDataBlock<Tunit> |
getPamDataBlock() |
void |
setDataUnitMatcher(DataUnitMatcher dataUnitMatcher) |
public DataUnitFinder(PamDataBlock<Tunit> pamDataBlock)
pamDataBlock
- parent PamDataBLockpublic DataUnitFinder(PamDataBlock<Tunit> pamDataBlock, DataUnitMatcher dataUnitMatcher)
pamDataBlock
- parent PamDataBlockdataUnitMatcher
- user created matcherpublic Tunit findDataUnit(java.lang.Object... criteria)
For the default search, the criteria are either just the time in milliseconds OR both the time AND the channel bitmap.
For user defined matchers, the criteria will have to match whatever the matcher expects.
criteria
- variable number of matching criteria.public DataUnitMatcher getDataUnitMatcher()
public void setDataUnitMatcher(DataUnitMatcher dataUnitMatcher)
dataUnitMatcher
- the dataUnitMatcher to setpublic PamDataBlock<Tunit> getPamDataBlock()
public Tunit getLastUnit()