use of bwem.area.typedef.GroupId in project BWAPI4J by OpenBW.
the class Graph method updateGroupIds.
private void updateGroupIds() {
int nextGroupId = 1;
AreaInitializerImpl.getStaticMarkable().unmarkAll();
for (final Area start : getAreas()) {
if (!((AreaInitializer) start).getMarkable().isMarked()) {
final List<Area> toVisit = new ArrayList<>();
toVisit.add(start);
while (!toVisit.isEmpty()) {
final Area current = toVisit.remove(toVisit.size() - 1);
((AreaInitializer) current).setGroupId(new GroupId(nextGroupId));
for (final Area next : current.getAccessibleNeighbors()) {
if (!((AreaInitializer) next).getMarkable().isMarked()) {
((AreaInitializer) next).getMarkable().setMarked();
toVisit.add(next);
}
}
}
++nextGroupId;
}
}
}
Aggregations