From c4f58a343128da090659473eaca64bd1c183ecc8 Mon Sep 17 00:00:00 2001 From: Michael Kauzmann Date: Fri, 25 Aug 2023 13:33:17 -0600 Subject: [PATCH] rename *BooleanProperty *NumberProperty to *Property, https://github.com/phetsims/build-a-nucleus/issues/166 --- js/chart-intro/view/ChartIntroScreenView.ts | 6 ++--- .../view/FocusedNuclideChartNode.ts | 4 ++-- .../view/NuclideChartAccordionBox.ts | 8 +++---- js/chart-intro/view/NuclideChartNode.ts | 12 +++++----- js/chart-intro/view/ZoomInNuclideChartNode.ts | 4 ++-- js/common/model/BANModel.ts | 8 +++---- js/common/view/BANScreenView.ts | 4 ++-- js/common/view/ElementNameText.ts | 4 ++-- js/decay/model/DecayModel.ts | 4 ++-- js/decay/view/DecayScreenView.ts | 4 ++-- js/decay/view/HalfLifeInfoDialog.ts | 4 ++-- js/decay/view/HalfLifeInformationNode.ts | 6 ++--- js/decay/view/HalfLifeNumberLineNode.ts | 24 +++++++++---------- js/decay/view/StabilityIndicatorText.ts | 4 ++-- 14 files changed, 48 insertions(+), 48 deletions(-) diff --git a/js/chart-intro/view/ChartIntroScreenView.ts b/js/chart-intro/view/ChartIntroScreenView.ts index 9c558de..8c2e9b0 100644 --- a/js/chart-intro/view/ChartIntroScreenView.ts +++ b/js/chart-intro/view/ChartIntroScreenView.ts @@ -188,12 +188,12 @@ class ChartIntroScreenView extends BANScreenView { this.addChild( rightDashedLine ); // Whether to show a special highlight for magic-numbered nuclides in the charts - const showMagicNumbersBooleanProperty = new BooleanProperty( false ); + const showMagicNumbersProperty = new BooleanProperty( false ); // create the nuclideChartAccordionBox const nuclideChartAccordionBox = new NuclideChartAccordionBox( this.model.particleAtom.protonCountProperty, this.model.particleAtom.neutronCountProperty, this.model.selectedNuclideChartProperty, this.model.decayEquationModel, - this.decayAtom.bind( this ), showMagicNumbersBooleanProperty, this.model.hasIncomingParticlesProperty, { + this.decayAtom.bind( this ), showMagicNumbersProperty, this.model.hasIncomingParticlesProperty, { minWidth: periodicTableAndIsotopeSymbol.width } ); @@ -216,7 +216,7 @@ class ChartIntroScreenView extends BANScreenView { this.addChild( partialChartRadioButton ); // create and add the checkbox to show special highlight for magic-numbered nuclides in the charts - const showMagicNumbersCheckbox = new Checkbox( showMagicNumbersBooleanProperty, + const showMagicNumbersCheckbox = new Checkbox( showMagicNumbersProperty, new Text( BuildANucleusStrings.magicNumbersStringProperty, { font: BANConstants.LEGEND_FONT, maxWidth: 145 } ), { boxWidth: 15, touchAreaYDilation: 4 diff --git a/js/chart-intro/view/FocusedNuclideChartNode.ts b/js/chart-intro/view/FocusedNuclideChartNode.ts index f8f6b1a..6e15669 100644 --- a/js/chart-intro/view/FocusedNuclideChartNode.ts +++ b/js/chart-intro/view/FocusedNuclideChartNode.ts @@ -23,11 +23,11 @@ const HIGHLIGHT_RECTANGLE_LINE_WIDTH = 1.5; class FocusedNuclideChartNode extends NuclideChartNode { public constructor( protonCountProperty: TReadOnlyProperty, neutronCountProperty: TReadOnlyProperty, - chartTransform: ChartTransform, showMagicNumbersBooleanProperty: TReadOnlyProperty ) { + chartTransform: ChartTransform, showMagicNumbersProperty: TReadOnlyProperty ) { super( protonCountProperty, neutronCountProperty, chartTransform, { cellTextFontSize: 6, arrowSymbol: false, - showMagicNumbersBooleanProperty: showMagicNumbersBooleanProperty + showMagicNumbersProperty: showMagicNumbersProperty } ); // use current bounds to place and update highlightRectangle diff --git a/js/chart-intro/view/NuclideChartAccordionBox.ts b/js/chart-intro/view/NuclideChartAccordionBox.ts index b4594c7..fc044a8 100644 --- a/js/chart-intro/view/NuclideChartAccordionBox.ts +++ b/js/chart-intro/view/NuclideChartAccordionBox.ts @@ -35,7 +35,7 @@ class NuclideChartAccordionBox extends AccordionBox { public constructor( protonCountProperty: TReadOnlyProperty, neutronCountProperty: TReadOnlyProperty, selectedNuclideChartProperty: TReadOnlyProperty, decayEquationModel: DecayEquationModel, decayAtom: ( decayType: DecayType | null ) => void, - showMagicNumbersBooleanProperty: TReadOnlyProperty, + showMagicNumbersProperty: TReadOnlyProperty, hasIncomingParticlesProperty: TReadOnlyProperty, providedOptions?: NuclideChartAccordionBoxOptions ) { const options = optionize()( { @@ -64,13 +64,13 @@ class NuclideChartAccordionBox extends AccordionBox { const nuclideChartAndNumberLines = new NuclideChartAndNumberLines( protonCountProperty, neutronCountProperty, partialChartTransform, { nuclideChartNodeOptions: { - showMagicNumbersBooleanProperty: showMagicNumbersBooleanProperty + showMagicNumbersProperty: showMagicNumbersProperty } } ); const focusedNuclideChartNode = new FocusedNuclideChartNode( protonCountProperty, neutronCountProperty, - focusedChartTransform, showMagicNumbersBooleanProperty ); + focusedChartTransform, showMagicNumbersProperty ); const zoomInNuclideChartNode = new ZoomInNuclideChartNode( protonCountProperty, neutronCountProperty, - zoomInChartTransform, showMagicNumbersBooleanProperty ); + zoomInChartTransform, showMagicNumbersProperty ); // create the legend node const nuclideChartLegendNode = new NuclideChartLegendNode(); diff --git a/js/chart-intro/view/NuclideChartNode.ts b/js/chart-intro/view/NuclideChartNode.ts index 5026401..e401089 100644 --- a/js/chart-intro/view/NuclideChartNode.ts +++ b/js/chart-intro/view/NuclideChartNode.ts @@ -31,12 +31,12 @@ import BANModel from '../../common/model/BANModel.js'; type SelfOptions = { cellTextFontSize: number; arrowSymbol: boolean; - showMagicNumbersBooleanProperty?: TReadOnlyProperty; + showMagicNumbersProperty?: TReadOnlyProperty; }; export type NuclideChartNodeOptions = SelfOptions & NodeOptions; -// Applies to both proton and neutron numbers see showMagicNumbersBooleanProperty for details. +// Applies to both proton and neutron numbers see showMagicNumbersProperty for details. const MAGIC_NUMBERS = [ N_ZERO_CAPACITY, N_ZERO_CAPACITY + N_ONE_CAPACITY ]; class NuclideChartNode extends Node { @@ -49,14 +49,14 @@ class NuclideChartNode extends Node { const options = optionize()( { excludeInvisibleChildrenFromBounds: true, - showMagicNumbersBooleanProperty: new BooleanProperty( false ) + showMagicNumbersProperty: new BooleanProperty( false ) }, providedOptions ); super( options ); // create and add the cells const cellLength = chartTransform.modelToViewDeltaX( 1 ); const cellLayerNode = new Node(); - this.cells = NuclideChartNode.createNuclideChart( cellLayerNode, chartTransform, cellLength, options.showMagicNumbersBooleanProperty ); + this.cells = NuclideChartNode.createNuclideChart( cellLayerNode, chartTransform, cellLength, options.showMagicNumbersProperty ); this.addChild( cellLayerNode ); // add the arrowNode indicating the decay direction first so that it appears behind the cell's label @@ -170,7 +170,7 @@ class NuclideChartNode extends Node { * Create a nuclide chart given a node to contain the cells and a chartTransform. Public for icon creation. */ public static createNuclideChart( cellLayerNode: Node, chartTransform: ChartTransform, cellLength: number, - showMagicNumbersBooleanProperty: TReadOnlyProperty = new BooleanProperty( false ) ): NuclideChartCell[][] { + showMagicNumbersProperty: TReadOnlyProperty = new BooleanProperty( false ) ): NuclideChartCell[][] { const cells: NuclideChartCell[][] = []; // create and add the chart cells to the chart. row is proton number and column is neutron number. @@ -192,7 +192,7 @@ class NuclideChartNode extends Node { if ( cellIsMagic ) { // highlight the cell with a special colored stroke if the cell has a magic number of protons or neutrons - showMagicNumbersBooleanProperty.link( showMagic => { + showMagicNumbersProperty.link( showMagic => { showMagic && cell.moveToFront(); cell.lineWidth = showMagic ? defaultLineWidth + 2 : defaultLineWidth; cell.stroke = showMagic ? BANColors.nuclideChartBorderMagicNumberColorProperty : BANColors.nuclideChartBorderColorProperty; diff --git a/js/chart-intro/view/ZoomInNuclideChartNode.ts b/js/chart-intro/view/ZoomInNuclideChartNode.ts index bc9b177..b0cfa09 100644 --- a/js/chart-intro/view/ZoomInNuclideChartNode.ts +++ b/js/chart-intro/view/ZoomInNuclideChartNode.ts @@ -21,12 +21,12 @@ import BANConstants from '../../common/BANConstants.js'; class ZoomInNuclideChartNode extends NuclideChartNode { public constructor( protonCountProperty: TReadOnlyProperty, neutronCountProperty: TReadOnlyProperty, - chartTransform: ChartTransform, showMagicNumbersBooleanProperty: TReadOnlyProperty ) { + chartTransform: ChartTransform, showMagicNumbersProperty: TReadOnlyProperty ) { super( protonCountProperty, neutronCountProperty, chartTransform, { cellTextFontSize: 18, arrowSymbol: true, - showMagicNumbersBooleanProperty: showMagicNumbersBooleanProperty + showMagicNumbersProperty: showMagicNumbersProperty } ); // create and add the border outline to the chart diff --git a/js/common/model/BANModel.ts b/js/common/model/BANModel.ts index c0e4f17..8407878 100644 --- a/js/common/model/BANModel.ts +++ b/js/common/model/BANModel.ts @@ -24,10 +24,10 @@ import arrayRemove from '../../../../phet-core/js/arrayRemove.js'; class BANModel { // the stability of the nuclide - public readonly isStableBooleanProperty: TReadOnlyProperty; + public readonly isStableProperty: TReadOnlyProperty; // if a nuclide exists - public readonly doesNuclideExistBooleanProperty: TReadOnlyProperty; + public readonly nuclideExistsProperty: TReadOnlyProperty; // arrays of all Particle's that exist in all places, except the mini atom in the Chart Intro screen. public readonly particles: ObservableArray; @@ -82,12 +82,12 @@ class BANModel { this.neutronNumberRange = new Range( BANConstants.CHART_MIN, maximumNeutronNumber ); // the stability of the nuclide is determined by the given number of protons and neutrons - this.isStableBooleanProperty = new DerivedProperty( [ this.particleAtom.protonCountProperty, this.particleAtom.neutronCountProperty ], + this.isStableProperty = new DerivedProperty( [ this.particleAtom.protonCountProperty, this.particleAtom.neutronCountProperty ], ( protonNumber, neutronNumber ) => AtomIdentifier.isStable( protonNumber, neutronNumber ) ); // If a nuclide with a given number of protons and neutrons exists. - this.doesNuclideExistBooleanProperty = new DerivedProperty( + this.nuclideExistsProperty = new DerivedProperty( [ this.particleAtom.protonCountProperty, this.particleAtom.neutronCountProperty ], ( protonNumber, neutronNumber ) => AtomIdentifier.doesExist( protonNumber, neutronNumber ) ); diff --git a/js/common/view/BANScreenView.ts b/js/common/view/BANScreenView.ts index 4595b3b..9e78155 100644 --- a/js/common/view/BANScreenView.ts +++ b/js/common/view/BANScreenView.ts @@ -106,7 +106,7 @@ abstract class BANScreenView> // Create and add the textual readout for the element name. this.elementNameText = new ElementNameText( this.model.particleAtom.protonCountProperty, this.model.particleAtom.neutronCountProperty, - this.model.doesNuclideExistBooleanProperty ); + this.model.nuclideExistsProperty ); this.addChild( this.elementNameText ); const nucleonLabelTextOptions = { font: new PhetFont( 20 ), maxWidth: 150 }; @@ -403,7 +403,7 @@ abstract class BANScreenView> const p0n0Case = protonNumber === 0 && neutronNumber === 0; // We don't want this automatic atom-fixing behavior for the p0,n0 case - if ( !this.model.doesNuclideExistBooleanProperty.value && !p0n0Case ) { + if ( !this.model.nuclideExistsProperty.value && !p0n0Case ) { // start countdown to show the nuclide that does not exist for {{BANConstants.TIME_TO_SHOW_DOES_NOT_EXIST}} seconds this.timeSinceCountdownStarted += dt; diff --git a/js/common/view/ElementNameText.ts b/js/common/view/ElementNameText.ts index 209083e..214909a 100644 --- a/js/common/view/ElementNameText.ts +++ b/js/common/view/ElementNameText.ts @@ -25,7 +25,7 @@ export default class ElementNameText extends Text { public constructor( protonCountProperty: TReadOnlyProperty, neutronCountProperty: TReadOnlyProperty, - doesNuclideExistBooleanProperty: TReadOnlyProperty, + nuclideExistsProperty: TReadOnlyProperty, providedOptions?: ElementNameTextOptions ) { const options = optionize()( { @@ -37,7 +37,7 @@ export default class ElementNameText extends Text { const elementNameStringProperty = new DerivedStringProperty( [ protonCountProperty, neutronCountProperty, - doesNuclideExistBooleanProperty, + nuclideExistsProperty, // We need to update whenever any of these strings change, to support Dynamic Locale BuildANucleusStrings.nameMassPatternStringProperty, diff --git a/js/decay/model/DecayModel.ts b/js/decay/model/DecayModel.ts index 840d685..7c1dcf2 100644 --- a/js/decay/model/DecayModel.ts +++ b/js/decay/model/DecayModel.ts @@ -33,8 +33,8 @@ class DecayModel extends BANModel { this.halfLifeNumberProperty = new DerivedProperty( [ this.particleAtom.protonCountProperty, this.particleAtom.neutronCountProperty, - this.doesNuclideExistBooleanProperty, - this.isStableBooleanProperty + this.nuclideExistsProperty, + this.isStableProperty ], ( protonNumber, neutronNumber, doesNuclideExist, isStable ) => { let halfLife: number | null; diff --git a/js/decay/view/DecayScreenView.ts b/js/decay/view/DecayScreenView.ts index 88007e6..2f77b92 100644 --- a/js/decay/view/DecayScreenView.ts +++ b/js/decay/view/DecayScreenView.ts @@ -53,7 +53,7 @@ class DecayScreenView extends BANScreenView { this.model = model; // create and add the half-life information node at the top half of the decay screen - const halfLifeInformationNode = new HalfLifeInformationNode( model.halfLifeNumberProperty, model.isStableBooleanProperty, + const halfLifeInformationNode = new HalfLifeInformationNode( model.halfLifeNumberProperty, model.isStableProperty, this.elementNameText.elementNameStringProperty ); halfLifeInformationNode.left = this.layoutBounds.minX + BANConstants.SCREEN_VIEW_X_MARGIN + 30; halfLifeInformationNode.y = this.layoutBounds.minY + BANConstants.SCREEN_VIEW_Y_MARGIN + 80; @@ -158,7 +158,7 @@ class DecayScreenView extends BANScreenView { // create and add stability indicator const stabilityIndicatorText = new StabilityIndicatorText( model.particleAtom.protonCountProperty, - model.particleAtom.neutronCountProperty, model.doesNuclideExistBooleanProperty ); + model.particleAtom.neutronCountProperty, model.nuclideExistsProperty ); this.addChild( stabilityIndicatorText ); // add the particleViewLayerNode after everything else so particles are in the top layer diff --git a/js/decay/view/HalfLifeInfoDialog.ts b/js/decay/view/HalfLifeInfoDialog.ts index 5750a51..cacbe8d 100644 --- a/js/decay/view/HalfLifeInfoDialog.ts +++ b/js/decay/view/HalfLifeInfoDialog.ts @@ -24,7 +24,7 @@ const LEGEND_FONT = BANConstants.REGULAR_FONT; class HalfLifeInfoDialog extends Dialog { public constructor( halfLifeNumberProperty: TReadOnlyProperty, - isStableBooleanProperty: TReadOnlyProperty, + isStableProperty: TReadOnlyProperty, elementNameStringProperty: TReadOnlyProperty ) { const leftSideTimescalePoints = [ @@ -91,7 +91,7 @@ class HalfLifeInfoDialog extends Dialog { } ); // create the halfLifeNumberLineNode - const halfLifeNumberLineNode = new HalfLifeNumberLineNode( halfLifeNumberProperty, isStableBooleanProperty, { + const halfLifeNumberLineNode = new HalfLifeNumberLineNode( halfLifeNumberProperty, isStableProperty, { tickMarkExtent: 24, numberLineLabelFont: LEGEND_FONT, numberLineWidth: 750, diff --git a/js/decay/view/HalfLifeInformationNode.ts b/js/decay/view/HalfLifeInformationNode.ts index b0e99ce..5d7f026 100644 --- a/js/decay/view/HalfLifeInformationNode.ts +++ b/js/decay/view/HalfLifeInformationNode.ts @@ -36,12 +36,12 @@ const HBOX_OPTIONS: HBoxOptions = { class HalfLifeInformationNode extends Node { public constructor( halfLifeNumberProperty: TReadOnlyProperty, - isStableBooleanProperty: TReadOnlyProperty, + isStableProperty: TReadOnlyProperty, elementNameStringProperty: TReadOnlyProperty ) { super(); // create and add the halfLifeNumberLineNode - const halfLifeNumberLineNode = new HalfLifeNumberLineNode( halfLifeNumberProperty, isStableBooleanProperty, { + const halfLifeNumberLineNode = new HalfLifeNumberLineNode( halfLifeNumberProperty, isStableProperty, { tickMarkExtent: 18, numberLineLabelFont: new PhetFont( 15 ), numberLineWidth: 550, @@ -52,7 +52,7 @@ class HalfLifeInformationNode extends Node { this.addChild( halfLifeNumberLineNode ); // create and add the HalfLifeInfoDialog - const halfLifeInfoDialog = new HalfLifeInfoDialog( halfLifeNumberProperty, isStableBooleanProperty, + const halfLifeInfoDialog = new HalfLifeInfoDialog( halfLifeNumberProperty, isStableProperty, elementNameStringProperty ); // create and add the info button diff --git a/js/decay/view/HalfLifeNumberLineNode.ts b/js/decay/view/HalfLifeNumberLineNode.ts index cf1a7fc..5401e95 100644 --- a/js/decay/view/HalfLifeNumberLineNode.ts +++ b/js/decay/view/HalfLifeNumberLineNode.ts @@ -72,12 +72,12 @@ class HalfLifeNumberLineNode extends Node { private readonly numberLineLabelFont: PhetFont | undefined; private readonly chartTransform: ChartTransform; private readonly tickMarkSetCenterY = 0; - private readonly halfLifeArrowRotationNumberProperty: TProperty; + private readonly halfLifeArrowRotationProperty: TProperty; private arrowXPositionAnimation: null | Animation; private arrowRotationAnimation: null | Animation; // x position of half-life arrow in model coordinates - private readonly arrowXPositionNumberProperty: TProperty; + private readonly arrowXPositionProperty: TProperty; // the half life display node, public for positioning the infoButton public readonly halfLifeDisplayNode: VBox; @@ -86,7 +86,7 @@ class HalfLifeNumberLineNode extends Node { private readonly numberLineNode: Node; public constructor( halfLifeNumberProperty: TReadOnlyProperty, - isStableBooleanProperty: TReadOnlyProperty, + isStableProperty: TReadOnlyProperty, providedOptions: HalfLifeNumberLineNodeOptions ) { super(); @@ -150,7 +150,7 @@ class HalfLifeNumberLineNode extends Node { halfLifeArrow.addChild( arrowNode ); // all valid values are based on the halfLifeNumberProperty, for more information see its implementation - this.arrowXPositionNumberProperty = new NumberProperty( 0 ); + this.arrowXPositionProperty = new NumberProperty( 0 ); this.arrowXPositionAnimation = null; this.arrowRotationAnimation = null; @@ -230,10 +230,10 @@ class HalfLifeNumberLineNode extends Node { this.halfLifeDisplayNode.insertChild( 0, elementName ); } - // animate the rotation of the halfLifeArrow through the halfLifeArrowRotationNumberProperty - this.halfLifeArrowRotationNumberProperty = new NumberProperty( 0, + // animate the rotation of the halfLifeArrow through the halfLifeArrowRotationProperty + this.halfLifeArrowRotationProperty = new NumberProperty( 0, { isValidValue: value => value >= ROTATION_POINTING_RIGHT_RADIANS && value <= ROTATION_POINTING_DOWN_RADIANS } ); - this.halfLifeArrowRotationNumberProperty.link( rotation => { halfLifeArrow.rotation = rotation; } ); + this.halfLifeArrowRotationProperty.link( rotation => { halfLifeArrow.rotation = rotation; } ); // function to show or hide the halfLifeArrow const showHalfLifeArrow = ( show: boolean ) => { @@ -244,7 +244,7 @@ class HalfLifeNumberLineNode extends Node { halfLifeNumberProperty.link( halfLifeNumber => { // the nuclide is stable - if ( isStableBooleanProperty.value ) { + if ( isStableProperty.value ) { showHalfLifeArrow( true ); infinityNode.visible = true; @@ -319,7 +319,7 @@ class HalfLifeNumberLineNode extends Node { halfLifeArrow ]; - Multilink.multilink( [ this.arrowXPositionNumberProperty, + Multilink.multilink( [ this.arrowXPositionProperty, // Cannot listen to the bounds of halfLifeDisplayNode to prevent reentrancy, so instead listen to all potential children changes options.elementNameStringProperty, @@ -376,7 +376,7 @@ class HalfLifeNumberLineNode extends Node { this.arrowXPositionAnimation = new Animation( { to: newXPosition, - property: this.arrowXPositionNumberProperty, + property: this.arrowXPositionProperty, duration: arrowXPositionAnimationDuration, easing: Easing.QUADRATIC_IN_OUT } ); @@ -394,7 +394,7 @@ class HalfLifeNumberLineNode extends Node { // rotate arrow horizontally, pointing right this.arrowRotationAnimation = new Animation( { to: ROTATION_POINTING_RIGHT_RADIANS, - property: this.halfLifeArrowRotationNumberProperty, + property: this.halfLifeArrowRotationProperty, duration: arrowRotationAnimationDuration, easing: Easing.QUADRATIC_IN_OUT } ); @@ -412,7 +412,7 @@ class HalfLifeNumberLineNode extends Node { // rotate arrow back vertically, pointing down this.arrowRotationAnimation = new Animation( { to: ROTATION_POINTING_DOWN_RADIANS, - property: this.halfLifeArrowRotationNumberProperty, + property: this.halfLifeArrowRotationProperty, duration: arrowRotationAnimationDuration, easing: Easing.QUADRATIC_IN_OUT } ); diff --git a/js/decay/view/StabilityIndicatorText.ts b/js/decay/view/StabilityIndicatorText.ts index 1a2c5f7..5647f90 100644 --- a/js/decay/view/StabilityIndicatorText.ts +++ b/js/decay/view/StabilityIndicatorText.ts @@ -21,7 +21,7 @@ type StabilityTextOptions = TextOptions; class StabilityIndicatorText extends Text { public constructor( protonCountProperty: TReadOnlyProperty, neutronCountProperty: TReadOnlyProperty, - doesNuclideExistBooleanProperty: TReadOnlyProperty, + nuclideExistsProperty: TReadOnlyProperty, providedOptions?: StabilityTextOptions ) { const options = optionize()( { @@ -46,7 +46,7 @@ class StabilityIndicatorText extends Text { super( stabilityStringProperty, options ); // update stability string visibility - doesNuclideExistBooleanProperty.link( ( visible: boolean ) => { + nuclideExistsProperty.link( ( visible: boolean ) => { this.visible = visible; } ); }