Example usage for org.apache.commons.collections.map MultiKeyMap get

List of usage examples for org.apache.commons.collections.map MultiKeyMap get

Introduction

In this page you can find the example usage for org.apache.commons.collections.map MultiKeyMap get.

Prototype

public Object get(Object key) 

Source Link

Usage

From source file:com.qq.tars.service.monitor.TARSPropertyMonitorService.java

private List<TARSPropertyMonitorDataRow> merge(TARSPropertyMonitorCondition condition, MultiKeyMap thedata,
        MultiKeyMap predata) {//  w  w  w .  ja  v  a  2s.  c om
    Set<MultiKey> keys = mergeKey(condition, thedata, predata);

    List<TARSPropertyMonitorDataRow> result = new LinkedList<>();
    for (MultiKey key : keys) {
        TARSPropertyMonitorDataRow row = new TARSPropertyMonitorDataRow();
        result.add(row);

        double[] thevalue = (double[]) thedata.get(key);
        double[] prevalue = (double[]) predata.get(key);
        String[] thevalueoutput = translate(thevalue);
        String[] prevalueoutput = translate(prevalue);

        row.setTheValue(thevalueoutput[0]);
        row.setPreValue(prevalueoutput[0]);

        dimension(condition, key, row);
    }
    return result;
}

From source file:com.qq.tars.service.monitor.TARSStatMonitorService.java

private List<TARSStatMonitorDataRow> merge(TARSStatMonitorCondition condition, MultiKeyMap thedata,
        MultiKeyMap predata) {/*ww  w  .j  a  v  a  2s  . c om*/
    Set<MultiKey> keys = mergeKey(condition, thedata, predata);

    List<TARSStatMonitorDataRow> result = new LinkedList<>();
    for (MultiKey key : keys) {
        TARSStatMonitorDataRow row = new TARSStatMonitorDataRow();
        result.add(row);

        double[] thevalue = translate((long[]) thedata.get(key));
        double[] prevalue = translate((long[]) predata.get(key));
        String[] thevalueoutput = translate(thevalue);
        String[] prevalueoutput = translate(prevalue);

        row.setTheTotalCount(thevalueoutput[0]);
        row.setTheAvgTime(thevalueoutput[1]);
        row.setTheFailRate(thevalueoutput[2]);
        row.setTheTimeoutRate(thevalueoutput[3]);

        row.setPreTotalCount(prevalueoutput[0]);
        row.setPreAvgTime(prevalueoutput[1]);
        row.setPreFailRate(prevalueoutput[2]);
        row.setPreTimeoutRate(prevalueoutput[3]);

        if (thevalue[0] < 0 || prevalue[0] < 0) {
            row.setTotalCountWave("--");
        } else {
            if (0 == prevalue[0]) {
                if (0 == thevalue[0]) {
                    row.setTotalCountWave("0%");
                } else {
                    row.setTotalCountWave("+%");
                }
            } else {
                double wave = (thevalue[0] - prevalue[0]) / prevalue[0];
                row.setTotalCountWave(String.format("%.2f", wave * 100) + "%");
            }
        }

        dimension(condition, key, row);
    }
    return result;
}