Skip to content

Commit

Permalink
Make arrays readonly, see #398
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Mar 3, 2023
1 parent d86e3af commit ddf2852
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions js/quadrilateral/model/QuadrilateralShapeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ export default class QuadrilateralShapeModel {
public readonly vertexB: QuadrilateralVertex;
public readonly vertexC: QuadrilateralVertex;
public readonly vertexD: QuadrilateralVertex;
public readonly vertices: QuadrilateralVertex[];
public readonly vertices: readonly QuadrilateralVertex[];

// Sides of the quadrilateral.
public readonly sideAB: QuadrilateralSide;
public readonly sideBC: QuadrilateralSide;
public readonly sideCD: QuadrilateralSide;
public readonly sideDA: QuadrilateralSide;
public readonly sides: QuadrilateralSide[];
public readonly sides: readonly QuadrilateralSide[];

// Available space for the Vertices to move.
private readonly modelBounds: Bounds2;

// Monitors angles of the shape to determine when pairs of opposite sides are parallel.
public readonly sideABSideCDParallelSideChecker: ParallelSideChecker;
public readonly sideBCSideDAParallelSideChecker: ParallelSideChecker;
public readonly parallelSideCheckers: ParallelSideChecker[];
public readonly parallelSideCheckers: readonly ParallelSideChecker[];

// Whether the quadrilateral is a parallelogram. This Property is true when both ParallelSideCheckers report
// parallel sides.
Expand Down
2 changes: 1 addition & 1 deletion js/quadrilateral/view/QuadrilateralDescriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default class QuadrilateralDescriber {
public readonly sideBCDescriber: SideDescriber;
public readonly sideCDDescriber: SideDescriber;
public readonly sideDADescriber: SideDescriber;
private readonly sideDescribers: SideDescriber[];
private readonly sideDescribers: readonly SideDescriber[];

public readonly vertexADescriber: VertexDescriber;
public readonly vertexBDescriber: VertexDescriber;
Expand Down
4 changes: 2 additions & 2 deletions js/quadrilateral/view/QuadrilateralNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export default class QuadrilateralNode extends Voicing( Node ) {
private readonly scratchShapeModel: QuadrilateralShapeModel;
private readonly modelViewTransform: ModelViewTransform2;

private readonly vertexNodes: QuadrilateralVertexNode[];
private readonly sideNodes: QuadrilateralSideNode[];
private readonly vertexNodes: readonly QuadrilateralVertexNode[];
private readonly sideNodes: readonly QuadrilateralSideNode[];

private remainingTimeForShapeChangeFill: number;
private activeFill: TPaint | null;
Expand Down
2 changes: 1 addition & 1 deletion js/quadrilateral/view/sound/TracksSoundView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class TracksSoundView extends SoundGenerator {

// Array of all SoundGenerators from the provided tracks. They will play and loop forever in the background. Depending
// on input and state of the quadrilateral shape, their output level will change.
public readonly soundClips: SoundClip[];
public readonly soundClips: readonly SoundClip[];

// A map that goes from the index of the sound file to play to its desired output leve. Subclasses will populate this.
public readonly indexToOutputLevelMap = new Map<number, number>();
Expand Down

0 comments on commit ddf2852

Please sign in to comment.