phetsims / neuron

"Neuron" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
1 stars 3 forks source link

Is CaptureZoneScanResult used? #12

Closed samreid closed 9 years ago

samreid commented 9 years ago

During code review for #1, I noticed that the only occurrences of the strings getClosestFreeParticle and getNumParticlesInZone appear in CaptureZoneScanRegion.js, and those are its only methods. Is CaptureZoneScanRegion used? If not, can it be deleted? (Or perhaps these methods are accessed dynamically through string concatenation?)

It looks like only the numParticlesInZone is used:

          //CaptureZoneScanResult
          var czsr = thisModel.scanCaptureZoneForFreeParticles( captureZone, ParticleType.SODIUM_ION );
          if ( czsr.numParticlesInZone === 0 ) {
            thisModel.addBackgroundParticles( ParticleType.SODIUM_ION, captureZone, Math.floor( Math.random() * 2 ) + 1 );
          }
jbphet commented 9 years ago

I examined the code, and it looks like the methods are unused, so I removed them and tested the sim. Behavior was fine, closing.