Skip to content

Commit

Permalink
Renaming PhotonState for QuantumPossibleState to avoid future confusi…
Browse files Browse the repository at this point in the history
…on with serialization, see #65
  • Loading branch information
AgustinVallejo committed Dec 4, 2024
1 parent 8416d32 commit c982245
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions js/photons/model/Mirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { EmptySelfOptions } from '../../../../phet-core/js/optionize.js';
import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
import { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js';
import quantumMeasurement from '../../quantumMeasurement.js';
import Photon, { DOWN, PhotonState } from './Photon.js';
import Photon, { DOWN, QuantumPossibleState } from './Photon.js';
import { PhotonInteractionTestResult } from './PhotonsModel.js';
import { TPhotonInteraction } from './TPhotonInteraction.js';

Expand All @@ -40,7 +40,7 @@ export default class Mirror implements TPhotonInteraction {
this.mirrorSurfaceLine = new Line( endpoint1, endpoint2 );
}

public testForPhotonInteraction( photonState: PhotonState, photon: Photon, dt: number ): PhotonInteractionTestResult {
public testForPhotonInteraction( photonState: QuantumPossibleState, photon: Photon, dt: number ): PhotonInteractionTestResult {

assert && assert( photon.activeProperty.value, 'save CPU cycles - don\'t use this method with inactive photons' );

Expand Down
10 changes: 5 additions & 5 deletions js/photons/model/Photon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ type possiblePolarizationResult = 'vertical' | 'horizontal';

// TODO: This class could live in its own file, once the feature is fully green lit, will move https://github.com/phetsims/quantum-measurement/issues/63
/**
* PhotonState is a class that represents a possible state of a photon at a given point in time.
* QuantumPossibleState is a class that represents a possible state of a photon at a given point in time.
* It contains properties for position, direction and the probability of the photon being in that state.
*/
export class PhotonState {
export class QuantumPossibleState {
public readonly positionProperty: Vector2Property;
public readonly directionProperty: Vector2Property;
public readonly probabilityProperty: NumberProperty;
Expand Down Expand Up @@ -86,7 +86,7 @@ export default class Photon extends PhetioObject {

// Contains all the possible states of the photon, which include position, direction, and probability.
// Since they contain properties, and based on the design of this simulation, it will always have two states.
public possibleStates: [ PhotonState, PhotonState ];
public possibleStates: [ QuantumPossibleState, QuantumPossibleState ];

// whether this photon is active, and should thus be moved by the model and shown in the view
public readonly activeProperty: BooleanProperty;
Expand All @@ -110,8 +110,8 @@ export default class Photon extends PhetioObject {
} );

this.possibleStates = [
new PhotonState( 'vertical', tandem.createTandem( 'verticalState' ) ),
new PhotonState( 'horizontal', tandem.createTandem( 'horizontalState' ) )
new QuantumPossibleState( 'vertical', tandem.createTandem( 'verticalState' ) ),
new QuantumPossibleState( 'horizontal', tandem.createTandem( 'horizontalState' ) )
];

// Entangle the possible states
Expand Down
4 changes: 2 additions & 2 deletions js/photons/model/PhotonDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js';
import AveragingCounterNumberProperty from '../../common/model/AveragingCounterNumberProperty.js';
import quantumMeasurement from '../../quantumMeasurement.js';
import { PHOTON_BEAM_WIDTH } from './Laser.js';
import Photon, { PhotonState } from './Photon.js';
import Photon, { QuantumPossibleState } from './Photon.js';
import { PhotonInteractionTestResult } from './PhotonsModel.js';
import { TPhotonInteraction } from './TPhotonInteraction.js';

Expand Down Expand Up @@ -88,7 +88,7 @@ export default class PhotonDetector implements TPhotonInteraction {
} );
}

public testForPhotonInteraction( photonState: PhotonState, photon: Photon, dt: number ): PhotonInteractionTestResult {
public testForPhotonInteraction( photonState: QuantumPossibleState, photon: Photon, dt: number ): PhotonInteractionTestResult {

assert && assert( photon.activeProperty.value, 'save CPU cycles - don\'t use this method with inactive photons' );

Expand Down
4 changes: 2 additions & 2 deletions js/photons/model/PolarizingBeamSplitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Line } from '../../../../kite/js/imports.js';
import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
import { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js';
import quantumMeasurement from '../../quantumMeasurement.js';
import Photon, { PhotonState, RIGHT, UP } from './Photon.js';
import Photon, { QuantumPossibleState, RIGHT, UP } from './Photon.js';
import { PhotonInteractionTestResult } from './PhotonsModel.js';
import { TPhotonInteraction } from './TPhotonInteraction.js';

Expand Down Expand Up @@ -49,7 +49,7 @@ export default class PolarizingBeamSplitter implements TPhotonInteraction {
this.polarizingSurfaceLine = new Line( endpoint1, endpoint2 );
}

public testForPhotonInteraction( photonState: PhotonState, photon: Photon, dt: number ): PhotonInteractionTestResult {
public testForPhotonInteraction( photonState: QuantumPossibleState, photon: Photon, dt: number ): PhotonInteractionTestResult {

assert && assert( photon.activeProperty.value, 'save CPU cycles - don\'t use this method with inactive photons' );

Expand Down
4 changes: 2 additions & 2 deletions js/photons/model/TPhotonInteraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* @author John Blanco, PhET Interactive Simulations
*/

import Photon, { PhotonState } from './Photon.js';
import Photon, { QuantumPossibleState } from './Photon.js';
import { PhotonInteractionTestResult } from './PhotonsModel.js';

export type TPhotonInteraction = {
testForPhotonInteraction( state: PhotonState, photon: Photon, dt: number ): PhotonInteractionTestResult;
testForPhotonInteraction( state: QuantumPossibleState, photon: Photon, dt: number ): PhotonInteractionTestResult;
};

0 comments on commit c982245

Please sign in to comment.