if (preferred != null) {
mergedPreferred = WeightsUtil.merge(preferred);
}
if (infeasible != null) {
ArrayNode arr = JOM.createArrayNode();
for (Interval interval : infeasible) {
ObjectNode o = JOM.createObjectNode();
o.put("start", interval.getStart().toString());
o.put("end", interval.getEnd().toString());
arr.add(o);
}
intervals.put("infeasible", arr);
}
if (preferred != null) {
ArrayNode arr = JOM.createArrayNode();
for (Weight weight : preferred) {
ObjectNode o = JOM.createObjectNode();
o.put("start", weight.getStart().toString());
o.put("end", weight.getEnd().toString());
o.put("weight", weight.getWeight());
arr.add(o);
}
intervals.put("preferred", arr);
}
if (solutions != null) {
ArrayNode arr = JOM.createArrayNode();
for (Weight weight : solutions) {
ObjectNode o = JOM.createObjectNode();
o.put("start", weight.getStart().toString());
o.put("end", weight.getEnd().toString());
o.put("weight", weight.getWeight());
arr.add(o);
}
intervals.put("solutions", arr);
}
if (mergedInfeasible != null) {
ArrayNode arr = JOM.createArrayNode();
for (Interval i : mergedInfeasible) {
ObjectNode o = JOM.createObjectNode();
o.put("start", i.getStart().toString());
o.put("end", i.getEnd().toString());
arr.add(o);
}
intervals.put("mergedInfeasible", arr);
}
if (mergedPreferred != null) {
ArrayNode arr = JOM.createArrayNode();
for (Weight wi : mergedPreferred) {
ObjectNode o = JOM.createObjectNode();
o.put("start", wi.getStart().toString());
o.put("end", wi.getEnd().toString());
o.put("weight", wi.getWeight());
arr.add(o);
}
intervals.put("mergedPreferred", arr);
}
return intervals;