Option name | Type | Description |
---|---|---|
column | Object | the source column |
predicate | Object | a Predicate object to filter the column |
childOperator | Object |
Data Source operator. Base operator, retrieves data from a column source
function DataSourceOperator(column, predicate, childOperator){
var self = this;
self.childOperator = childOperator;
self.column = column;
self.index = 0;
if(predicate != null && !(predicate instanceof Predicate))
throw 'Predicate is not an instance of Predicate';
Operator.call(this, childOperator);
Get the next matching block from the column, filtered by a predicate
self.getNextValueBlock = function(position){
var block = GetNextBlock(position);
var pass = false;
do{
if(block == null)
pass = true;
else if(predicate == null || (predicate != null && (predicate instanceof Operator || predicate.evaluate(block.getNext()))))
pass = true;
else
block = GetNextBlock(position);
}while(!pass);
return block;
};
Get the next position block
self.getNextPositionBlock = function(){
};
Option name | Type | Description |
---|---|---|
position | number | the column index |
Get a block at an index
function GetNextBlock(position){
var block = null;
//get next block from child
if(self.childOperator != null){
block = self.childOperator.getNextValueBlock();
//get next block from column at position
}else if(position != null && position < column.length){
block = self.column[position];
self.index = position + 1;
}
//get next block from column
else if(self.column !== undefined && self.column.length > self.index){
block = self.column[self.index];
self.index++;
}
return block;
}
}
DataSourceOperator.prototype = Object.create(Operator.prototype);
DataSourceOperator.prototype.constructor = DataSourceOperator;
return DataSourceOperator;
});