private void addGroup(Group group){
  if (objectNodeMap.get(group) != null) {
    return;
  }
  if (group instanceof NeuronGroup) {
    NeuronGroup ng=(NeuronGroup)group;
    addNeuronGroup(ng);
    if (ng.isTopLevelGroup()) {
      whereToAdd.setLocation(whereToAdd.getX() + DEFAULT_SPACING,whereToAdd.getY() + DEFAULT_SPACING);
    }
  }
 else   if (group instanceof SynapseGroup) {
    addSynapseGroup((SynapseGroup)group);
  }
 else   if (group instanceof Subnetwork) {
    addSubnetwork((Subnetwork)group);
    whereToAdd.setLocation(whereToAdd.getX() + DEFAULT_SPACING,whereToAdd.getY() + DEFAULT_SPACING);
  }
  clearSelection();
}

private void addGroup ( Group group ) { if ( objectNodeMap . get ( group ) != null ) { return ; } if ( group instanceof NeuronGroup ) { NeuronGroup ng = ( NeuronGroup ) group ; addNeuronGroup ( ng ) ; if ( ng . isTopLevelGroup ( ) ) { whereToAdd . setLocation ( whereToAdd . getX ( ) + DEFAULT_SPACING , whereToAdd . getY ( ) + DEFAULT_SPACING ) ; } } else if ( group instanceof SynapseGroup ) { addSynapseGroup ( ( SynapseGroup ) group ) ; } else if ( group instanceof Subnetwork ) { addSubnetwork ( ( Subnetwork ) group ) ; whereToAdd . setLocation ( whereToAdd . getX ( ) + DEFAULT_SPACING , whereToAdd . getY ( ) + DEFAULT_SPACING ) ; } clearSelection ( ) ; }
add a model group node representation to the piccolo canvas . be aware that creation of groups is complex . parts of the groups can be added in different orders ( e . g . a neurongroup inside a subnetwork , or neurons inside a neuron group , etc ) . these may or may not fire listeners so it is hard to make assumptions about which parts of a group have been added when this method is called . as an example , feedforward networks are created using all - to - all connection objects , which can call addsynpase as they are invoked , so that synapse nodes may are already here when the feed - forward node is created and added .
