Fix order of qualifiers in SnakGroup generation

This commit is contained in:
Antonin Delpeuch 2017-09-19 10:54:02 +01:00
parent ddceec4d27
commit b326346fa3

View File

@ -83,17 +83,11 @@ public class WbStatementExpr extends BiJsonizable {
}
public static List<SnakGroup> groupSnaks(List<Snak> snaks) {
Map<PropertyIdValue, List<Snak> > map = new HashMap<PropertyIdValue, List<Snak>>();
for (Snak snak : snaks) {
PropertyIdValue pid = snak.getPropertyId();
if (!map.containsKey(pid)) {
map.put(pid, new ArrayList<Snak>());
}
map.get(pid).add(snak);
}
List<SnakGroup> snakGroups = new ArrayList<SnakGroup>();
for (List<Snak> snaksGroup : map.values()) {
snakGroups.add(Datamodel.makeSnakGroup(snaksGroup));
for (Snak snak : snaks) {
List<Snak> singleton = new ArrayList<Snak>();
singleton.add(snak);
snakGroups.add(Datamodel.makeSnakGroup(singleton));
}
return snakGroups;
}