Skip to content

Commit

Permalink
use isDisposable:false where appropriate, phetsims/axon#436
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jul 5, 2023
1 parent ff477ae commit f4abc13
Show file tree
Hide file tree
Showing 40 changed files with 96 additions and 271 deletions.
7 changes: 1 addition & 6 deletions js/common/model/DirectFocalLengthModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import Disposable from '../../../../axon/js/Disposable.js';
import { OpticSurfaceType } from './OpticSurfaceType.js';
import FocalLengthModel from './FocalLengthModel.js';
import RangeWithValue from '../../../../dot/js/RangeWithValue.js';
Expand Down Expand Up @@ -45,6 +44,7 @@ export default class DirectFocalLengthModel extends PhetioObject implements Foca
const options = optionize<DirectFocalLengthModelOptions, SelfOptions, PhetioObjectOptions>()( {

// PhetioObjectOptions
isDisposable: false,
phetioState: false,
phetioDocumentation: 'Model of focal length that is used when ' +
`${GOPreferences.focalLengthModelTypeProperty.tandem.phetioID} ` +
Expand Down Expand Up @@ -103,11 +103,6 @@ export default class DirectFocalLengthModel extends PhetioObject implements Foca
public reset(): void {
this.resetDirectFocalLengthModel();
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}
}

geometricOptics.register( 'DirectFocalLengthModel', DirectFocalLengthModel );
7 changes: 1 addition & 6 deletions js/common/model/GOScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import Disposable from '../../../../axon/js/Disposable.js';
import Range from '../../../../dot/js/Range.js';
import geometricOptics from '../../geometricOptics.js';
import Optic from './Optic.js';
Expand Down Expand Up @@ -49,6 +48,7 @@ export default abstract class GOScene extends PhetioObject {
const options = optionize<GOSceneOptions, SelfOptions, PhetioObjectOptions>()( {

// PhetioObjectOptions
isDisposable: false,
phetioState: false
}, providedOptions );

Expand All @@ -70,11 +70,6 @@ export default abstract class GOScene extends PhetioObject {
};
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}

public reset(): void {
this.resetGOObjectScene();
}
Expand Down
7 changes: 1 addition & 6 deletions js/common/model/IndirectFocalLengthModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import Disposable from '../../../../axon/js/Disposable.js';
import { OpticSurfaceType } from './OpticSurfaceType.js';
import FocalLengthModel from './FocalLengthModel.js';
import RangeWithValue from '../../../../dot/js/RangeWithValue.js';
Expand Down Expand Up @@ -51,6 +50,7 @@ export default class IndirectFocalLengthModel extends PhetioObject implements Fo
indexOfRefractionPropertyFeatured: true,

// PhetioObjectOptions
isDisposable: false,
phetioState: false,
phetioDocumentation: 'Model of focal length that is used when ' +
`${GOPreferences.focalLengthModelTypeProperty.tandem.phetioID} ` +
Expand Down Expand Up @@ -111,11 +111,6 @@ export default class IndirectFocalLengthModel extends PhetioObject implements Fo
public reset(): void {
this.resetIndirectFocalLengthModel();
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}
}

geometricOptics.register( 'IndirectFocalLengthModel', IndirectFocalLengthModel );
7 changes: 1 addition & 6 deletions js/common/model/LightSpot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import Disposable from '../../../../axon/js/Disposable.js';
import DerivedProperty from '../../../../axon/js/DerivedProperty.js';
import Vector2 from '../../../../dot/js/Vector2.js';
import Utils from '../../../../dot/js/Utils.js';
Expand Down Expand Up @@ -60,6 +59,7 @@ export default class LightSpot extends PhetioObject {
const options = optionize<LightSpotOptions, SelfOptions, PhetioObjectOptions>()( {

// PhetioObjectOptions
isDisposable: false,
phetioState: false
}, providedOptions );

Expand Down Expand Up @@ -124,11 +124,6 @@ export default class LightSpot extends PhetioObject {
phetioValueType: BooleanIO
} );
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}
}

/**
Expand Down
7 changes: 1 addition & 6 deletions js/common/model/Optic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* @author Martin Veillette
*/

import Disposable from '../../../../axon/js/Disposable.js';
import StringUnionProperty from '../../../../axon/js/StringUnionProperty.js';
import DerivedProperty from '../../../../axon/js/DerivedProperty.js';
import NumberProperty from '../../../../axon/js/NumberProperty.js';
Expand Down Expand Up @@ -123,6 +122,7 @@ export default abstract class Optic extends PhetioObject {
radiusOfCurvaturePropertyFeatured: true,

// PhetioObjectOptions
isDisposable: false,
phetioState: false
}, providedOptions );

Expand Down Expand Up @@ -318,11 +318,6 @@ export default abstract class Optic extends PhetioObject {
this.resetOptic();
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}

/**
* Determines whether the optic is converging for the specified optical surface type.
*/
Expand Down
7 changes: 1 addition & 6 deletions js/common/model/OpticalImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* @author Martin Veillette
*/

import Disposable from '../../../../axon/js/Disposable.js';
import BooleanProperty from '../../../../axon/js/BooleanProperty.js';
import DerivedProperty from '../../../../axon/js/DerivedProperty.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
Expand Down Expand Up @@ -80,6 +79,7 @@ export default class OpticalImage extends PhetioObject {
magnificationPropertyFeatured: true,

// PhetioObject options
isDisposable: false,
phetioState: false
}, providedOptions );

Expand Down Expand Up @@ -185,11 +185,6 @@ export default class OpticalImage extends PhetioObject {
public reset(): void {
this.resetOpticalImage();
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}
}

geometricOptics.register( 'OpticalImage', OpticalImage );
7 changes: 1 addition & 6 deletions js/common/model/OpticalObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import Disposable from '../../../../axon/js/Disposable.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import Property from '../../../../axon/js/Property.js';
import Vector2 from '../../../../dot/js/Vector2.js';
Expand Down Expand Up @@ -63,6 +62,7 @@ export default class OpticalObject extends PhetioObject {
position: Vector2.ZERO,

// PhetioObjectOptions
isDisposable: false,
phetioState: false
}, providedOptions );

Expand Down Expand Up @@ -96,11 +96,6 @@ export default class OpticalObject extends PhetioObject {
};
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}

public reset(): void {
this.resetOpticalObject();
}
Expand Down
7 changes: 1 addition & 6 deletions js/common/model/ProjectionScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* @author Martin Veillette
*/

import Disposable from '../../../../axon/js/Disposable.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import Property from '../../../../axon/js/Property.js';
import Matrix3 from '../../../../dot/js/Matrix3.js';
Expand Down Expand Up @@ -53,6 +52,7 @@ export default class ProjectionScreen extends PhetioObject {
const options = optionize<ProjectionScreenOptions, SelfOptions, PhetioObjectOptions>()( {

// PhetioObjectOptions
isDisposable: false,
phetioState: false
}, providedOptions );

Expand Down Expand Up @@ -85,11 +85,6 @@ export default class ProjectionScreen extends PhetioObject {
};
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}

public reset(): void {
this.resetProjectionScreen();
}
Expand Down
7 changes: 1 addition & 6 deletions js/common/model/SecondPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import Disposable from '../../../../axon/js/Disposable.js';
import DerivedProperty from '../../../../axon/js/DerivedProperty.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import NumberProperty from '../../../../axon/js/NumberProperty.js';
Expand Down Expand Up @@ -46,6 +45,7 @@ export default class SecondPoint extends PhetioObject {
const options = optionize<SecondPointOptions, SelfOptions, PhetioObjectOptions>()( {

// PhetioObjectOptions
isDisposable: false,
phetioState: false
}, providedOptions );

Expand Down Expand Up @@ -74,11 +74,6 @@ export default class SecondPoint extends PhetioObject {
};
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}

public reset(): void {
this.resetSecondPoint();
}
Expand Down
7 changes: 1 addition & 6 deletions js/common/model/tools/GOTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import Disposable from '../../../../../axon/js/Disposable.js';
import BooleanProperty from '../../../../../axon/js/BooleanProperty.js';
import Property from '../../../../../axon/js/Property.js';
import Vector2 from '../../../../../dot/js/Vector2.js';
Expand Down Expand Up @@ -36,6 +35,7 @@ class GOTool extends PhetioObject {
const options = optionize<GOToolOptions, SelfOptions, PhetioObjectOptions>()( {

// PhetioObjectOptions
isDisposable: false,
phetioState: false
}, providedOptions );

Expand All @@ -58,11 +58,6 @@ class GOTool extends PhetioObject {
};
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}

public reset(): void {
this.resetGOTool();
}
Expand Down
9 changes: 2 additions & 7 deletions js/common/view/CueingArrowsNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import Disposable from '../../../../axon/js/Disposable.js';
import geometricOptics from '../../geometricOptics.js';
import { NodeTranslationOptions, Path, PathOptions } from '../../../../scenery/js/imports.js';
import ArrowShape from '../../../../scenery-phet/js/ArrowShape.js';
Expand Down Expand Up @@ -43,7 +42,8 @@ export default class CueingArrowsNode extends Path {

// PathOptions
fill: 'rgb( 0, 200, 0 )',
stroke: 'black'
stroke: 'black',
isDisposable: false

}, providedOptions );

Expand All @@ -61,11 +61,6 @@ export default class CueingArrowsNode extends Path {
this.shape = createArrowsShape( direction, this.length );
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}

/**
* Common method of creating the visibleProperty for cueing arrows when they are associated with a draggable Node.
* @param inputEnabledProperty - is input enabled for the associated Node?
Expand Down
9 changes: 2 additions & 7 deletions js/common/view/FocalLengthControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import Disposable from '../../../../axon/js/Disposable.js';
import NumberControl, { NumberControlOptions } from '../../../../scenery-phet/js/NumberControl.js';
import geometricOptics from '../../geometricOptics.js';
import GeometricOpticsStrings from '../../GeometricOpticsStrings.js';
Expand Down Expand Up @@ -59,18 +58,14 @@ export default class FocalLengthControl extends NumberControl {
keyboardStep: GOConstants.FOCAL_LENGTH_KEYBOARD_STEP, // used by all alternative-input devices
shiftKeyboardStep: GOConstants.FOCAL_LENGTH_SHIFT_KEYBOARD_STEP, // finer grain, used by keyboard only
pageKeyboardStep: GOConstants.FOCAL_LENGTH_PAGE_KEYBOARD_STEP
}
},
isDisposable: false
}, providedOptions );

super( titleStringProperty, focalLengthMagnitudeProperty, range, options );

this.addLinkedElement( focalLengthMagnitudeProperty );
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}
}

geometricOptics.register( 'FocalLengthControl', FocalLengthControl );
9 changes: 2 additions & 7 deletions js/common/view/FocalPointNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import Disposable from '../../../../axon/js/Disposable.js';
import Vector2 from '../../../../dot/js/Vector2.js';
import optionize, { EmptySelfOptions } from '../../../../phet-core/js/optionize.js';
import ModelViewTransform2 from '../../../../phetcommon/js/view/ModelViewTransform2.js';
Expand All @@ -31,7 +30,8 @@ export default class FocalPointNode extends Node {

// NodeOptions
children: [ FocalPointNode.createIcon() ],
phetioVisiblePropertyInstrumented: false
phetioVisiblePropertyInstrumented: false,
isDisposable: false
}, providedOptions );

super( options );
Expand All @@ -58,11 +58,6 @@ export default class FocalPointNode extends Node {
children: [ circleNode, centerPointNode ]
} );
}

public override dispose(): void {
Disposable.assertNotDisposable();
super.dispose();
}
}

geometricOptics.register( 'FocalPointNode', FocalPointNode );
Loading

0 comments on commit f4abc13

Please sign in to comment.