Search in sources :

Example 1 with FilteredEventClassifier

use of org.apache.apex.malhar.lib.testbench.FilteredEventClassifier in project apex-malhar by apache.

the class FilteredEventClassifierApp method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    FilteredEventClassifier filterEvent = dag.addOperator("filterEvent", new FilteredEventClassifier());
    HashMap<String, Double> kmap = new HashMap<String, Double>(3);
    kmap.put("a", 1.0);
    kmap.put("b", 4.0);
    kmap.put("c", 5.0);
    ArrayList<Integer> list = new ArrayList<Integer>(3);
    HashMap<String, ArrayList<Integer>> wmap = new HashMap<String, ArrayList<Integer>>(4);
    list.add(60);
    list.add(10);
    list.add(35);
    wmap.put("ia", list);
    list = new ArrayList<Integer>(3);
    list.add(10);
    list.add(75);
    list.add(15);
    wmap.put("ib", list);
    list = new ArrayList<Integer>(3);
    list.add(20);
    list.add(10);
    list.add(70);
    wmap.put("ic", list);
    list = new ArrayList<Integer>(3);
    list.add(50);
    list.add(15);
    list.add(35);
    wmap.put("id", list);
    filterEvent.setKeyMap(kmap);
    filterEvent.setKeyWeights(wmap);
    filterEvent.setPassFilter(10);
    filterEvent.setTotalFilter(100);
    HashMapOperator hmapOper = dag.addOperator("hmapOper", new HashMapOperator());
    DevNull<HashMap<String, Double>> dev = dag.addOperator("dev", new DevNull());
    dag.addStream("filter1", hmapOper.hmap_data, filterEvent.data).setLocality(locality);
    dag.addStream("filer2", filterEvent.filter, dev.data).setLocality(locality);
}
Also used : FilteredEventClassifier(org.apache.apex.malhar.lib.testbench.FilteredEventClassifier) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DevNull(org.apache.apex.malhar.lib.stream.DevNull)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 DevNull (org.apache.apex.malhar.lib.stream.DevNull)1 FilteredEventClassifier (org.apache.apex.malhar.lib.testbench.FilteredEventClassifier)1