@@ -0,0 +1,2003 @@
+package boa.aggregators;%0A%0Aimport boa.types.Ast.Expression;%0Aimport boa.io.EmitKey;%0A%0Aimport java.io.IOException;%0Aimport java.util.HashMap;%0Aimport java.util.HashSet;%0Aimport java.util.Map;%0Aimport java.util.Set;%0A%0Aimport static boa.functions.BoaAstIntrinsics.parseexpression;%0Aimport static boa.functions.BoaAstIntrinsics.prettyprint;%0A%0A@AggregatorSpec(name = %22precondition%22)%0Apublic class PreconditionAggregator extends Aggregator %7B%0A    private Map%3CString, Map%3CExpression, Set%3CString%3E%3E%3E apiPrecondition;%0A%0A    /**%0A     * Construct a %7B@link PreconditionAggregator%7D%0A     */%0A    public PreconditionAggregator() %7B%0A        this.apiPrecondition = new HashMap%3CString, Map%3CExpression, Set%3CString%3E%3E%3E();%0A    %7D%0A%0A    /** %7B@inheritDoc%7D */%0A    @Override%0A    public void aggregate(String data, String metadata) throws IOException, InterruptedException, FinishedException %7B%0A        //data expected format: %22pid:client:fq_clientmethodname%22%0A        EmitKey key = getKey();%0A        String api = key.getIndex();%0A%0A        int splitLoc = data.indexOf(':');%0A        String clientmethod = data.substring(0, splitLoc);%0A        String precond = data.substring(splitLoc+1, data.length());%0A%0A        Expression precondition = parseexpression(precond);%0A%0A        if (apiPrecondition.containsKey(api)) %7B%0A            if (apiPrecondition.get(api).containsKey(precondition)) %7B%0A                apiPrecondition.get(api).get(precondition).add(clientmethod);%0A            %7D%0A            else %7B%0A                Set%3CString%3E  setOfClients = new HashSet%3CString%3E();%0A                setOfClients.add(clientmethod);%0A                apiPrecondition.get(api).put(precondition, setOfClients);%0A            %7D%0A        %7D else %7B%0A            Set%3CString%3E  setOfClients = new HashSet%3CString%3E();%0A            setOfClients.add(clientmethod);%0A            Map%3CExpression, Set%3CString%3E%3E precondClients = new HashMap%3CExpression, Set%3CString%3E%3E();%0A            precondClients.put(precondition, setOfClients);%0A            apiPrecondition.put(api, precondClients);%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

add Precondition Aggregator