Package com.netrics.likeit
Class NetricsArrayRecOpSrc
- java.lang.Object
-
- com.netrics.likeit.NetricsArrayRecOpSrc
-
- All Implemented Interfaces:
NetricsRecOpSrc
public class NetricsArrayRecOpSrc extends java.lang.Object implements NetricsRecOpSrc
An array backed source for record operations. This is an implementation of the NetricsRecOpSrc interface. It provides for storing and returning a fixed number of records. It does not provide an open ended stream. Instead it provides a simple batch of records.
-
-
Constructor Summary
Constructors Constructor Description NetricsArrayRecOpSrc()
Create an empty source.NetricsArrayRecOpSrc(NetricsRecOp... rec_ops)
Create a source with an initial set of record operations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRecOp(NetricsRecOp... rec_ops)
Add a set of record operations to the source.boolean
canReset()
Returns true as this class supports the reset operation.NetricsRecOp
getCur()
Returns the current record operation.NetricsRecOp
getNext()
Returns the next record operation.boolean
hasNext()
True if getNext will return a record operation.void
reset()
Reset the scan of record back to the beginning.int
size()
Return the number of RecOps in this source.
-
-
-
Constructor Detail
-
NetricsArrayRecOpSrc
public NetricsArrayRecOpSrc()
Create an empty source. This creates an empty source. Record operations must be added using addRecOp.
-
NetricsArrayRecOpSrc
public NetricsArrayRecOpSrc(NetricsRecOp... rec_ops)
Create a source with an initial set of record operations. This creates a record operation source and populates it with an initial set of record operations.- Parameters:
rec_ops
- the initial record operations.
-
-
Method Detail
-
addRecOp
public void addRecOp(NetricsRecOp... rec_ops)
Add a set of record operations to the source. This adds a set of record operations to the end of the current list of record operations for this source.- Parameters:
rec_ops
- the set of record operations to add.
-
size
public int size()
Return the number of RecOps in this source.- Returns:
- the total number RecOps in this source object.
-
hasNext
public boolean hasNext()
True if getNext will return a record operation.- Specified by:
hasNext
in interfaceNetricsRecOpSrc
- Returns:
- True if there is another record operation, false otherwise.
-
getNext
public NetricsRecOp getNext()
Returns the next record operation.- Specified by:
getNext
in interfaceNetricsRecOpSrc
- Returns:
- the next record operation, null if there is no next record.
-
getCur
public NetricsRecOp getCur()
Returns the current record operation. This returns the last record operation fetched. If no record operation has been fetched, or getNext() was called at the end of file, this returns null.- Specified by:
getCur
in interfaceNetricsRecOpSrc
- Returns:
- the current record operation, null if no current record operation set.
-
canReset
public boolean canReset()
Returns true as this class supports the reset operation.- Specified by:
canReset
in interfaceNetricsRecOpSrc
- Returns:
- true
-
reset
public void reset()
Reset the scan of record back to the beginning. This resets the scan of records back to the initial state. After this call there is no current record and getNext will retrieve the first record.- Specified by:
reset
in interfaceNetricsRecOpSrc
-
-