@Override public Node encode(Node node, int offset){ String score = categories.get(this.classes.get(offset) - 1); Integer recordCount = n.getValue(offset); node .setScore(score) .setRecordCount(recordCount.doubleValue()); if(hasScoreDistribution){ node = NodeUtil.toComplexNode(node); List<ScoreDistribution> scoreDistributions = node.getScoreDistributions(); for(int i = 0; i < categories.size(); i++){ List<? extends Number> recordCounts = this.recordCounts.get(i); ScoreDistribution scoreDistribution = new ScoreDistribution() .setValue(categories.get(i)) .setRecordCount(recordCounts.get(offset).doubleValue()); scoreDistributions.add(scoreDistribution); } } return node; } };