Example #1
0
 public void addChild(PlantNode child) {
   Set<PlantNode> gen = children.get(child.getGeneration());
   if (gen == null) {
     // create new generation
     gen = new HashSet<>();
     gen.add(child);
     children.put(child.getGeneration(), gen);
   } else {
     // add to existing generation
     gen.add(child);
   }
 }
Example #2
0
 public void removeChild(PlantNode child) {
   Set<PlantNode> gen = children.get(child.getGeneration());
   if (gen != null) {
     gen.remove(child);
   }
 }