Skip to content

Commit

Permalink
fix Particles type hierarchy after changes for TParticles #213
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Nov 14, 2017
1 parent a62cf70 commit 34f6adf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
11 changes: 10 additions & 1 deletion js/concentration/model/Particles.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2015-2017, University of Colorado Boulder

/**
* Base type for a collection of particles.
* Abstract base type for a collection of particles.
*
* @author Chris Malley
*/
Expand Down Expand Up @@ -34,6 +34,15 @@ define( function( require ) {
this.particles.push( particle );
},

/**
* Removes all particles.
* @public
* @abstract
*/
removeAllParticles: function() {
throw new Error( 'must be implemented by subtype' );
},

/**
* Registers a listener that will be called when the collection of particles has changed in some way
* (eg, number of particles, particles move, ...)
Expand Down
3 changes: 2 additions & 1 deletion js/concentration/model/Precipitate.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ define( function( require ) {

/**
* Removes all particles from the precipitate.
* @private
* @public
* @override
*/
removeAllParticles: function() {
if ( this.particles.length > 0 ) {
Expand Down
10 changes: 4 additions & 6 deletions js/concentration/model/ShakerParticles.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,16 @@ define( function( require ) {
return new Vector2( 0, GRAVITATIONAL_ACCELERATION_MAGNITUDE );
},

// @public (phet-io)
addParticle: function( particle ) {
this.particles.push( particle );
},

// @private
removeParticle: function( particle ) {
this.particles.splice( this.particles.indexOf( particle ), 1 );
particle.dispose();
},

// @public
/**
* @public
* @override
*/
removeAllParticles: function() {
var particles = this.particles.slice( 0 );
for ( var i = 0; i < particles.length; i++ ) {
Expand Down

0 comments on commit 34f6adf

Please sign in to comment.