public class ExternalSort extends UnaryOperator
tupleCounter
Constructor and Description |
---|
ExternalSort(Operator operator,
StorageManager sm,
int[] slots,
int buffers)
Constructs a new external sort operator.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Cleanup after the sort.
|
protected void |
initTempFiles()
Initialises the temporary files, according to the number
of buffers.
|
protected java.util.List<Tuple> |
innerGetNext()
The inner method to retrieve tuples.
|
protected java.util.List<Tuple> |
innerProcessTuple(Tuple tuple,
int inOp)
Operator class abstract interface -- never called.
|
protected Relation |
setOutputRelation()
Operator class abstract interface -- sets the ouput relation of
this sort operator.
|
void |
setup()
Sets up this external sort operator.
|
getInputOperator
allDone, getInputOperator, getMultiNext, getNext, getNumberOfInputs, getOutputRelation, prefix, processTuple, setInputs, toString, toString, toStringSingle, tuples
public ExternalSort(Operator operator, StorageManager sm, int[] slots, int buffers) throws EngineException
operator
- the input operator.sm
- the storage manager.slots
- the indexes of the sort keys.buffers
- the number of buffers (i.e., run files) to be
used for the sort.EngineException
- thrown whenever the sort operator
cannot be properly initialized.protected void initTempFiles() throws StorageManagerException
StorageManagerException
- thrown whenever the temporary
files cannot be initialised.public void setup() throws EngineException
setup
in class Operator
EngineException
- thrown whenever there is something wrong with
setting this operator uppublic void cleanup() throws EngineException
cleanup
in class Operator
EngineException
- whenever the operator cannot clean up
after itself.protected java.util.List<Tuple> innerGetNext() throws EngineException
innerGetNext
in class Operator
EngineException
- thrown whenever the next iteration is not
possible.protected java.util.List<Tuple> innerProcessTuple(Tuple tuple, int inOp) throws EngineException
innerProcessTuple
in class Operator
tuple
- the tuple to be processed.inOp
- the index of the input operator the tuple to be
processed belongs to.EngineException
- thrown whenever there is something wrong
with processing the tuple.protected Relation setOutputRelation() throws EngineException
setOutputRelation
in class Operator
EngineException
- whenever the output relation of this
operator cannot be set.