public void revalidateSynapseSets(){
  Iterator<Synapse> exIterator=exSynapseSet.iterator();
  ArrayList<Synapse> exSwitches=new ArrayList<Synapse>(exSynapseSet.size());
  while (exIterator.hasNext()) {
    Synapse s=exIterator.next();
    if (s.getStrength() < 0) {
      exSwitches.add(s);
      exIterator.remove();
    }
  }
  Iterator<Synapse> inIterator=inSynapseSet.iterator();
  ArrayList<Synapse> inSwitches=new ArrayList<Synapse>(inSynapseSet.size());
  while (inIterator.hasNext()) {
    Synapse s=inIterator.next();
    if (s.getStrength() > 0) {
      inSwitches.add(s);
      inIterator.remove();
    }
  }
  exSynapseSet.addAll(inSwitches);
  inSynapseSet.addAll(exSwitches);
  excitatoryRatio=exSynapseSet.size() / (double)(size());
}

public void revalidateSynapseSets ( ) { Iterator < Synapse > exIterator = exSynapseSet . iterator ( ) ; ArrayList < Synapse > exSwitches = new ArrayList < Synapse > ( exSynapseSet . size ( ) ) ; while ( exIterator . hasNext ( ) ) { Synapse s = exIterator . next ( ) ; if ( s . getStrength ( ) < 0 ) { exSwitches . add ( s ) ; exIterator . remove ( ) ; } } Iterator < Synapse > inIterator = inSynapseSet . iterator ( ) ; ArrayList < Synapse > inSwitches = new ArrayList < Synapse > ( inSynapseSet . size ( ) ) ; while ( inIterator . hasNext ( ) ) { Synapse s = inIterator . next ( ) ; if ( s . getStrength ( ) > 0 ) { inSwitches . add ( s ) ; inIterator . remove ( ) ; } } exSynapseSet . addAll ( inSwitches ) ; inSynapseSet . addAll ( exSwitches ) ; excitatoryRatio = exSynapseSet . size ( ) / ( double ) ( size ( ) ) ; }
if an algorithm ( like training ) extensively changes the polarity of the synapses in this group , it ' s impractical to check every time a change is made . thus after the bulk of the algorithm is completed this method can be called to sort synapses into their appropriate sets .
