Example usage for com.google.gwt.coreext.client JsIntegerDoubleMap iterate

List of usage examples for com.google.gwt.coreext.client JsIntegerDoubleMap iterate

Introduction

In this page you can find the example usage for com.google.gwt.coreext.client JsIntegerDoubleMap iterate.

Prototype

public final native void iterate(IterationCallBack callback) ;

Source Link

Document

Iterates through the elements and calls back with the proper key value pair.

Usage

From source file:com.google.speedtracer.client.visualizations.model.ReportDataCollector.java

License:Apache License

private static void doAggregation(JsIntegerDoubleMap in, final JsIntegerDoubleMap out) {
    in.iterate(new IterationCallBack() {
        public void onIteration(int key, double val) {
            double duration = out.hasKey(key) ? out.get(key) + val : val;
            out.put(key, duration);// w w w .java 2  s.  c  o m
        }
    });
}

From source file:com.google.speedtracer.client.visualizations.view.EventWaterfallRowDetails.java

License:Apache License

private void ensureData() {
    if (data == null) {
        data = new ArrayList<ColorCodedValue>();
        UiEvent event = getParentRow().getEvent();
        JsIntegerDoubleMap durations = event.getTypeDurations();

        assert (durations != null);

        durations.iterate(new JsIntegerDoubleMap.IterationCallBack() {
            public void onIteration(int key, double val) {
                if (val > 0) {
                    data.add(new ColorCodedValue(
                            EventRecord.typeToString(key) + " (" + TimeStampFormatter.format(val) + ")", val,
                            EventRecordColors.getColorForType(key)));
                }/*from   ww  w  . j ava2s .c  o  m*/
            }
        });
        Collections.sort(data);
    }
}

From source file:com.google.speedtracer.client.visualizations.view.ReportDialog.java

License:Apache License

private void populatePieChart(JsIntegerDoubleMap aggregateTypeDurations) {
    final List<ColorCodedValue> data = new ArrayList<ColorCodedValue>();

    assert (aggregateTypeDurations != null);

    // Flatten the aggregate map into a sorted list.
    aggregateTypeDurations.iterate(new JsIntegerDoubleMap.IterationCallBack() {
        public void onIteration(int key, double val) {
            if (val > 0) {
                String typeName = (key == -1) ? "UI Thread Available" : EventRecord.typeToString(key);
                typeName += " (" + TimeStampFormatter.format(val) + ")";
                data.add(new ColorCodedValue(typeName, val, EventRecordColors.getColorForType(key)));
            }//from   w w  w .j a va 2s.c  o  m
        }
    });

    Collections.sort(data);
    // Update the piechart with this data.
    this.pieChart.setData(data);
    this.pieChart.render();
    this.pieChart.showLegend();
}