Skip to content

Commit

Permalink
rename *BooleanProperty *NumberProperty to *Property, #166
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Aug 25, 2023
1 parent 4833a00 commit c4f58a3
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 48 deletions.
6 changes: 3 additions & 3 deletions js/chart-intro/view/ChartIntroScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ class ChartIntroScreenView extends BANScreenView<ChartIntroModel> {
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
} );

Expand All @@ -216,7 +216,7 @@ class ChartIntroScreenView extends BANScreenView<ChartIntroModel> {
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
Expand Down
4 changes: 2 additions & 2 deletions js/chart-intro/view/FocusedNuclideChartNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ const HIGHLIGHT_RECTANGLE_LINE_WIDTH = 1.5;
class FocusedNuclideChartNode extends NuclideChartNode {

public constructor( protonCountProperty: TReadOnlyProperty<number>, neutronCountProperty: TReadOnlyProperty<number>,
chartTransform: ChartTransform, showMagicNumbersBooleanProperty: TReadOnlyProperty<boolean> ) {
chartTransform: ChartTransform, showMagicNumbersProperty: TReadOnlyProperty<boolean> ) {
super( protonCountProperty, neutronCountProperty, chartTransform, {
cellTextFontSize: 6,
arrowSymbol: false,
showMagicNumbersBooleanProperty: showMagicNumbersBooleanProperty
showMagicNumbersProperty: showMagicNumbersProperty
} );

// use current bounds to place and update highlightRectangle
Expand Down
8 changes: 4 additions & 4 deletions js/chart-intro/view/NuclideChartAccordionBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class NuclideChartAccordionBox extends AccordionBox {
public constructor( protonCountProperty: TReadOnlyProperty<number>, neutronCountProperty: TReadOnlyProperty<number>,
selectedNuclideChartProperty: TReadOnlyProperty<SelectedChartType>,
decayEquationModel: DecayEquationModel, decayAtom: ( decayType: DecayType | null ) => void,
showMagicNumbersBooleanProperty: TReadOnlyProperty<boolean>,
showMagicNumbersProperty: TReadOnlyProperty<boolean>,
hasIncomingParticlesProperty: TReadOnlyProperty<boolean>, providedOptions?: NuclideChartAccordionBoxOptions ) {

const options = optionize<NuclideChartAccordionBoxOptions, EmptySelfOptions, AccordionBoxOptions>()( {
Expand Down Expand Up @@ -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();
Expand Down
12 changes: 6 additions & 6 deletions js/chart-intro/view/NuclideChartNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ import BANModel from '../../common/model/BANModel.js';
type SelfOptions = {
cellTextFontSize: number;
arrowSymbol: boolean;
showMagicNumbersBooleanProperty?: TReadOnlyProperty<boolean>;
showMagicNumbersProperty?: TReadOnlyProperty<boolean>;
};

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 {
Expand All @@ -49,14 +49,14 @@ class NuclideChartNode extends Node {

const options = optionize<NuclideChartNodeOptions, SelfOptions, NodeOptions>()( {
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
Expand Down Expand Up @@ -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<boolean> = new BooleanProperty( false ) ): NuclideChartCell[][] {
showMagicNumbersProperty: TReadOnlyProperty<boolean> = 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.
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions js/chart-intro/view/ZoomInNuclideChartNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import BANConstants from '../../common/BANConstants.js';
class ZoomInNuclideChartNode extends NuclideChartNode {

public constructor( protonCountProperty: TReadOnlyProperty<number>, neutronCountProperty: TReadOnlyProperty<number>,
chartTransform: ChartTransform, showMagicNumbersBooleanProperty: TReadOnlyProperty<boolean> ) {
chartTransform: ChartTransform, showMagicNumbersProperty: TReadOnlyProperty<boolean> ) {

super( protonCountProperty, neutronCountProperty, chartTransform, {
cellTextFontSize: 18,
arrowSymbol: true,
showMagicNumbersBooleanProperty: showMagicNumbersBooleanProperty
showMagicNumbersProperty: showMagicNumbersProperty
} );

// create and add the border outline to the chart
Expand Down
8 changes: 4 additions & 4 deletions js/common/model/BANModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import arrayRemove from '../../../../phet-core/js/arrayRemove.js';
class BANModel<T extends ParticleAtom> {

// the stability of the nuclide
public readonly isStableBooleanProperty: TReadOnlyProperty<boolean>;
public readonly isStableProperty: TReadOnlyProperty<boolean>;

// if a nuclide exists
public readonly doesNuclideExistBooleanProperty: TReadOnlyProperty<boolean>;
public readonly nuclideExistsProperty: TReadOnlyProperty<boolean>;

// arrays of all Particle's that exist in all places, except the mini atom in the Chart Intro screen.
public readonly particles: ObservableArray<BANParticle>;
Expand Down Expand Up @@ -82,12 +82,12 @@ class BANModel<T extends ParticleAtom> {
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 )
);
Expand Down
4 changes: 2 additions & 2 deletions js/common/view/BANScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ abstract class BANScreenView<M extends BANModel<ParticleAtom | ParticleNucleus>>
// 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 };
Expand Down Expand Up @@ -403,7 +403,7 @@ abstract class BANScreenView<M extends BANModel<ParticleAtom | ParticleNucleus>>
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;
Expand Down
4 changes: 2 additions & 2 deletions js/common/view/ElementNameText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class ElementNameText extends Text {

public constructor( protonCountProperty: TReadOnlyProperty<number>,
neutronCountProperty: TReadOnlyProperty<number>,
doesNuclideExistBooleanProperty: TReadOnlyProperty<boolean>,
nuclideExistsProperty: TReadOnlyProperty<boolean>,
providedOptions?: ElementNameTextOptions ) {

const options = optionize<ElementNameTextOptions, EmptySelfOptions, TextOptions>()( {
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions js/decay/model/DecayModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class DecayModel extends BANModel<ParticleAtom> {
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;
Expand Down
4 changes: 2 additions & 2 deletions js/decay/view/DecayScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DecayScreenView extends BANScreenView<DecayModel> {
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;
Expand Down Expand Up @@ -158,7 +158,7 @@ class DecayScreenView extends BANScreenView<DecayModel> {

// 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
Expand Down
4 changes: 2 additions & 2 deletions js/decay/view/HalfLifeInfoDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const LEGEND_FONT = BANConstants.REGULAR_FONT;
class HalfLifeInfoDialog extends Dialog {

public constructor( halfLifeNumberProperty: TReadOnlyProperty<number>,
isStableBooleanProperty: TReadOnlyProperty<boolean>,
isStableProperty: TReadOnlyProperty<boolean>,
elementNameStringProperty: TReadOnlyProperty<string> ) {

const leftSideTimescalePoints = [
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions js/decay/view/HalfLifeInformationNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ const HBOX_OPTIONS: HBoxOptions = {
class HalfLifeInformationNode extends Node {

public constructor( halfLifeNumberProperty: TReadOnlyProperty<number>,
isStableBooleanProperty: TReadOnlyProperty<boolean>,
isStableProperty: TReadOnlyProperty<boolean>,
elementNameStringProperty: TReadOnlyProperty<string> ) {
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,
Expand All @@ -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
Expand Down
24 changes: 12 additions & 12 deletions js/decay/view/HalfLifeNumberLineNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<number>;
private readonly halfLifeArrowRotationProperty: TProperty<number>;
private arrowXPositionAnimation: null | Animation;
private arrowRotationAnimation: null | Animation;

// x position of half-life arrow in model coordinates
private readonly arrowXPositionNumberProperty: TProperty<number>;
private readonly arrowXPositionProperty: TProperty<number>;

// the half life display node, public for positioning the infoButton
public readonly halfLifeDisplayNode: VBox;
Expand All @@ -86,7 +86,7 @@ class HalfLifeNumberLineNode extends Node {
private readonly numberLineNode: Node;

public constructor( halfLifeNumberProperty: TReadOnlyProperty<number>,
isStableBooleanProperty: TReadOnlyProperty<boolean>,
isStableProperty: TReadOnlyProperty<boolean>,
providedOptions: HalfLifeNumberLineNodeOptions ) {
super();

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 ) => {
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
} );
Expand All @@ -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
} );
Expand All @@ -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
} );
Expand Down
Loading

0 comments on commit c4f58a3

Please sign in to comment.