public class PartitioningStream extends AbstractOptionHandler implements ExampleStream
Modifier and Type | Field and Description |
---|---|
protected ExampleStream |
baseStream |
protected int |
numPartitions |
IntOption |
numPartitionsOption |
protected int |
partitionIndex |
IntOption |
partitionIndexOption |
protected Random |
random |
IntOption |
randomSeedOption |
ClassOption |
streamOption |
config
Constructor and Description |
---|
PartitioningStream() |
Modifier and Type | Method and Description |
---|---|
protected void |
discardNexInstancesNotFromPartition()
discarding all instances which are exluded until an instance which can be seen by this
stream or the stream is empty
|
long |
estimatedRemainingInstances()
Gets the estimated number of remaining instances in this stream
|
void |
getDescription(StringBuilder sb,
int indent)
Returns a string representation of this object.
|
InstancesHeader |
getHeader()
Gets the header of this stream.
|
protected int |
getNextPartitionToLeaveOut()
get the partition which is excluded from seeing the next instance
|
boolean |
hasMoreInstances()
Gets whether this stream has more instances to output.
|
protected boolean |
isNextInstanceFromPartition()
check if this stream is excluded from seeing the next instance
|
boolean |
isRestartable()
Gets whether this stream can restart.
|
Example<Instance> |
nextInstance()
Gets the next example from this stream.
|
protected void |
prepareForUseImpl(TaskMonitor monitor,
ObjectRepository repository)
This method describes the implementation of how to prepare this object for use.
|
void |
restart()
Restarts this stream.
|
copy, getCLICreationString, getOptions, getPreparedClassOption, getPurposeString, prepareClassOptions, prepareForUse, prepareForUse
copy, measureByteSize, measureByteSize, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
copy, measureByteSize
public ClassOption streamOption
public IntOption partitionIndexOption
public IntOption numPartitionsOption
public IntOption randomSeedOption
protected ExampleStream baseStream
protected int partitionIndex
protected int numPartitions
protected Random random
public InstancesHeader getHeader()
ExampleStream
getHeader
in interface ExampleStream
public long estimatedRemainingInstances()
ExampleStream
estimatedRemainingInstances
in interface ExampleStream
public boolean hasMoreInstances()
ExampleStream
hasMoreInstances
in interface ExampleStream
public Example<Instance> nextInstance()
ExampleStream
nextInstance
in interface ExampleStream
public boolean isRestartable()
ExampleStream
isRestartable
in interface ExampleStream
public void restart()
ExampleStream
restart
in interface ExampleStream
public void getDescription(StringBuilder sb, int indent)
MOAObject
AbstractMOAObject.toString
to give a string representation of the object.getDescription
in interface MOAObject
sb
- the stringbuilder to add the descriptionindent
- the number of characters to indentprotected void prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
AbstractOptionHandler
prepareForUseImpl
and not prepareForUse
since
prepareForUse
calls prepareForUseImpl
.prepareForUseImpl
in class AbstractOptionHandler
monitor
- the TaskMonitor to userepository
- the ObjectRepository to useprotected int getNextPartitionToLeaveOut()
protected boolean isNextInstanceFromPartition()
protected void discardNexInstancesNotFromPartition()
Copyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.