Search in sources :

Example 21 with ScanSourcePredicate

use of edu.uci.ics.textdb.exp.source.scan.ScanSourcePredicate in project textdb by TextDB.

the class SamplerTest method matchSamplerTable.

/* 
     * To test if the sampled tuples are equal to the first K tuples of the sampler table 
     * in both the order and content.
     */
public static boolean matchSamplerTable(List<Tuple> sampleList) throws TextDBException {
    ScanBasedSourceOperator scanSource = new ScanBasedSourceOperator(new ScanSourcePredicate(SAMPLER_TABLE));
    scanSource.open();
    ListIterator<Tuple> iter = null;
    iter = sampleList.listIterator();
    while (iter.hasNext()) {
        Tuple nextTableTuple = scanSource.getNextTuple();
        Tuple nextSampledTuple = iter.next();
        if (!nextSampledTuple.equals(nextTableTuple)) {
            scanSource.close();
            return false;
        }
    }
    scanSource.close();
    return true;
}
Also used : ScanBasedSourceOperator(edu.uci.ics.textdb.exp.source.scan.ScanBasedSourceOperator) ScanSourcePredicate(edu.uci.ics.textdb.exp.source.scan.ScanSourcePredicate) Tuple(edu.uci.ics.textdb.api.tuple.Tuple)

Aggregations

ScanSourcePredicate (edu.uci.ics.textdb.exp.source.scan.ScanSourcePredicate)21 ScanBasedSourceOperator (edu.uci.ics.textdb.exp.source.scan.ScanBasedSourceOperator)20 Tuple (edu.uci.ics.textdb.api.tuple.Tuple)17 ArrayList (java.util.ArrayList)11 Test (org.junit.Test)7 IField (edu.uci.ics.textdb.api.field.IField)3 TextField (edu.uci.ics.textdb.api.field.TextField)3 Schema (edu.uci.ics.textdb.api.schema.Schema)3 IOperator (edu.uci.ics.textdb.api.dataflow.IOperator)2 DataFlowException (edu.uci.ics.textdb.api.exception.DataFlowException)2 RelationManager (edu.uci.ics.textdb.storage.RelationManager)2 ISourceOperator (edu.uci.ics.textdb.api.dataflow.ISourceOperator)1 TextDBException (edu.uci.ics.textdb.api.exception.TextDBException)1 StringField (edu.uci.ics.textdb.api.field.StringField)1 Attribute (edu.uci.ics.textdb.api.schema.Attribute)1 Span (edu.uci.ics.textdb.api.span.Span)1 DictionaryPredicate (edu.uci.ics.textdb.exp.dictionarymatcher.DictionaryPredicate)1 FuzzyTokenPredicate (edu.uci.ics.textdb.exp.fuzzytokenmatcher.FuzzyTokenPredicate)1 KeywordMatcherSourceOperator (edu.uci.ics.textdb.exp.keywordmatcher.KeywordMatcherSourceOperator)1 KeywordSourcePredicate (edu.uci.ics.textdb.exp.keywordmatcher.KeywordSourcePredicate)1