public void updateWeightDataset(int step) {
        if (datasetWeight == null) {
            datasetWeight = new DefaultTableXYDataset();
            weightSeries = new HashMap<>();
            for (Double weight = 0d; weight < bpgHistory.maxApplicationSize; weight++) {
                weightSeries.put(weight, new XYSeries("Weight " + weight, false, false));
                datasetWeight.addSeries(weightSeries.get(weight));
            }
            //weightSeries.put(-1d, new XYSeries("Weight sum", false, false));
            //datasetWeight.addSeries(weightSeries.get(-1d));
        }
        for (Double weight : weightSeries.keySet()) {
            weightSeries.get(weight).setNotify(false);
            for (int i = 0; i < step; i++) {
                double value;
                if (weight == -1d) {
                    value = linksByWeightByStep.get(i).values().stream().mapToDouble(w -> w).sum();
                } else {
                    if (linksByWeightByStep.get(i).containsKey(weight)) {
                        value = linksByWeightByStep.get(i).get(weight);
                    } else {
                        value = 0;
                    }
                }
                weightSeries.get(weight).addOrUpdate(new Integer(i), new Double(value));
            }
            for (int i = step; i < bpgHistory.getStepNumber(); i++) {
                weightSeries.get(weight).addOrUpdate(new Integer(i), new Integer(-1));
            }
            weightSeries.get(weight).setNotify(true);
        }
    }