Skip to content

Commit

Permalink
remove unused instances and disable constructor, see #339
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Aug 7, 2023
1 parent 5ac22a0 commit 4984c36
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
6 changes: 1 addition & 5 deletions js/common/view/GreenhouseGasConcentrationPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import GreenhouseEffectConstants from '../GreenhouseEffectConstants.js';
import ConcentrationModel, { ConcentrationControlMode, ConcentrationDate } from '../model/ConcentrationModel.js';
import ConcentrationSliderSoundGenerator from './ConcentrationSliderSoundGenerator.js';
import ConcentrationDescriber from './describers/ConcentrationDescriber.js';
import RadiationDescriber from './describers/RadiationDescriber.js';
import PickRequired from '../../../../phet-core/js/types/PickRequired.js';

// constants
Expand Down Expand Up @@ -97,12 +96,10 @@ class GreenhouseGasConcentrationPanel extends Panel {
/**
* @param width - overall width of the panel
* @param concentrationModel
* @param radiationDescriber
* @param [providedOptions]
*/
public constructor( width: number,
concentrationModel: ConcentrationModel,
radiationDescriber: RadiationDescriber,
providedOptions?: GreenhouseGasConcentrationPanelOptions ) {

const options = optionize<GreenhouseGasConcentrationPanelOptions, SelfOptions, PanelOptions>()( {
Expand Down Expand Up @@ -132,7 +129,6 @@ class GreenhouseGasConcentrationPanel extends Panel {
// controls the concentration directly by value
const concentrationControl = new ConcentrationControl(
concentrationModel,
radiationDescriber,
options.tandem.createTandem( 'concentrationControl' )
);

Expand Down Expand Up @@ -363,7 +359,7 @@ class DateControl extends HBox {
* Inner class representing a labeled vertical slider that directly controls greenhouse gas concentration.
*/
class ConcentrationControl extends VBox {
public constructor( concentrationModel: ConcentrationModel, radiationDescriber: RadiationDescriber, tandem: Tandem ) {
public constructor( concentrationModel: ConcentrationModel, tandem: Tandem ) {

const sliderRange = concentrationModel.manuallyControlledConcentrationProperty.range;
const sliderSoundGenerator = new ConcentrationSliderSoundGenerator(
Expand Down
10 changes: 6 additions & 4 deletions js/common/view/describers/RadiationDescriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import StringUtils from '../../../../../phetcommon/js/util/StringUtils.js';
import greenhouseEffect from '../../../greenhouseEffect.js';
import GreenhouseEffectStrings from '../../../GreenhouseEffectStrings.js';
import GroundLayer from '../../model/GroundLayer.js';
import LayersModel from '../../model/LayersModel.js';
import TemperatureDescriber from './TemperatureDescriber.js';
import { ConcentrationControlMode, ConcentrationDate } from '../../model/ConcentrationModel.js';
import ConcentrationDescriber from './ConcentrationDescriber.js';
Expand All @@ -20,10 +19,13 @@ const sunlightStartedStringProperty = GreenhouseEffectStrings.a11y.sunlightStart
const sunlightStartedSimPausedStringProperty = GreenhouseEffectStrings.a11y.sunlightStartedSimPausedStringProperty;

class RadiationDescriber {
private readonly model: LayersModel;

public constructor( model: LayersModel ) {
this.model = model;
public constructor() {

// At the time of this writing (Aug 2023), there are only static usages of this type, so the constructor has been
// disallowed. If state is ever needed, feel free to change this. See
// https://github.com/phetsims/greenhouse-effect/issues/339.
assert && assert( false, 'Intended, at least originally, to only be used statically.' );
}

/**
Expand Down
6 changes: 1 addition & 5 deletions js/photons/view/PhotonsScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { VBox } from '../../../../scenery/js/imports.js';
import Tandem from '../../../../tandem/js/Tandem.js';
import GreenhouseEffectConstants from '../../common/GreenhouseEffectConstants.js';
import GreenhouseGasConcentrationPanel from '../../common/view/GreenhouseGasConcentrationPanel.js';
import RadiationDescriber from '../../common/view/describers/RadiationDescriber.js';
import GreenhouseEffectScreenView from '../../common/view/GreenhouseEffectScreenView.js';
import LayersModelTimeControlNode from '../../common/view/LayersModelTimeControlNode.js';
import MorePhotonsCheckbox from '../../common/view/MorePhotonsCheckbox.js';
Expand Down Expand Up @@ -55,13 +54,10 @@ class PhotonsScreenView extends GreenhouseEffectScreenView {
tandem.createTandem( 'morePhotonsCheckbox' )
);

// Responsible for generating descriptions about the changing radiation.
const radiationDescriber = new RadiationDescriber( model );

const greenhouseGasConcentrationPanel = new GreenhouseGasConcentrationPanel(
this.energyLegend.width,
model,
radiationDescriber, {
{
includeCompositionData: true,

// phet-io
Expand Down
5 changes: 0 additions & 5 deletions js/waves/view/WavesScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import soundManager from '../../../../tambo/js/soundManager.js';
import Tandem from '../../../../tandem/js/Tandem.js';
import GreenhouseEffectConstants from '../../common/GreenhouseEffectConstants.js';
import GreenhouseGasConcentrationPanel from '../../common/view/GreenhouseGasConcentrationPanel.js';
import RadiationDescriber from '../../common/view/describers/RadiationDescriber.js';
import EnergyLegend from '../../common/view/EnergyLegend.js';
import GreenhouseEffectScreenView from '../../common/view/GreenhouseEffectScreenView.js';
import LayersModelTimeControlNode from '../../common/view/LayersModelTimeControlNode.js';
Expand Down Expand Up @@ -88,13 +87,9 @@ class WavesScreenView extends GreenhouseEffectScreenView {
model.concentrationControlModeProperty,
tandem.createTandem( 'cloudCheckbox' ) );

// Responsible for generating descriptions about the changing radiation.
const radiationDescriber = new RadiationDescriber( model );

const greenhouseGasConcentrationPanel = new GreenhouseGasConcentrationPanel(
this.energyLegend.width,
model,
radiationDescriber,
{

// phet-io
Expand Down

0 comments on commit 4984c36

Please sign in to comment.