Skip to content

Commit

Permalink
Move PhetioGroupIO to PhetioGroup.js, see phetsims/tandem#212
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Sep 30, 2020
1 parent acee9f8 commit 7f394d3
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions js/model/Circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import Vector2 from '../../../dot/js/Vector2.js';
import Enumeration from '../../../phet-core/js/Enumeration.js';
import merge from '../../../phet-core/js/merge.js';
import PhetioGroup from '../../../tandem/js/PhetioGroup.js';
import PhetioGroupIO from '../../../tandem/js/PhetioGroupIO.js';
import NullableIO from '../../../tandem/js/types/NullableIO.js';
import ReferenceIO from '../../../tandem/js/types/ReferenceIO.js';
import CCKCConstants from '../CCKCConstants.js';
Expand Down Expand Up @@ -165,7 +164,7 @@ class Circuit {
phetioType: Vertex.VertexIO
} );
}, [ new Vector2( -1000, 0 ) ], {
phetioType: PhetioGroupIO( Vertex.VertexIO ),
phetioType: PhetioGroup.PhetioGroupIO( Vertex.VertexIO ),
tandem: tandem.createTandem( 'vertexGroup' )
} );

Expand Down Expand Up @@ -275,15 +274,15 @@ class Circuit {
this.wireGroup = new PhetioGroup( ( tandem, startVertex, endVertex ) => {
return new Wire( startVertex, endVertex, this.wireResistivityProperty, tandem );
}, () => createVertices( WIRE_LENGTH ), {
phetioType: PhetioGroupIO( CircuitElement.CircuitElementIO ),
phetioType: PhetioGroup.PhetioGroupIO( CircuitElement.CircuitElementIO ),
tandem: tandem.createTandem( 'wireGroup' )
} );

this.batteryGroup = new PhetioGroup( ( tandem, startVertex, endVertex ) => {
return new Battery( startVertex, endVertex, this.sourceResistanceProperty, Battery.BatteryType.NORMAL,
tandem );
}, () => createVertices( BATTERY_LENGTH ), {
phetioType: PhetioGroupIO( CircuitElement.CircuitElementIO ),
phetioType: PhetioGroup.PhetioGroupIO( CircuitElement.CircuitElementIO ),
tandem: tandem.createTandem( 'batteryGroup' )
} );

Expand All @@ -293,15 +292,15 @@ class Circuit {
voltage: 1000
} );
}, () => createVertices( BATTERY_LENGTH ), {
phetioType: PhetioGroupIO( CircuitElement.CircuitElementIO ),
phetioType: PhetioGroup.PhetioGroupIO( CircuitElement.CircuitElementIO ),
tandem: tandem.createTandem( 'highVoltageBatteryGroup' ),
phetioDynamicElementName: 'battery'
} );

this.acVoltageGroup = new PhetioGroup( ( tandem, startVertex, endVertex ) => {
return new ACVoltage( startVertex, endVertex, this.sourceResistanceProperty, tandem );
}, () => createVertices( CCKCConstants.AC_VOLTAGE_LENGTH ), {
phetioType: PhetioGroupIO( CircuitElement.CircuitElementIO ),
phetioType: PhetioGroup.PhetioGroupIO( CircuitElement.CircuitElementIO ),
tandem: tandem.createTandem( 'acVoltageGroup' )
} );

Expand All @@ -314,22 +313,22 @@ class Circuit {
argumentArray.push( Resistor.ResistorType.RESISTOR );
return argumentArray;
}, {
phetioType: PhetioGroupIO( Resistor.ResistorIO ),
phetioType: PhetioGroup.PhetioGroupIO( Resistor.ResistorIO ),
tandem: tandem.createTandem( 'resistorGroup' )
} );

this.fuseGroup = new PhetioGroup(
( tandem, startVertex, endVertex ) => new Fuse( startVertex, endVertex, tandem ),
() => createVertices( CCKCConstants.FUSE_LENGTH ), {
phetioType: PhetioGroupIO( CircuitElement.CircuitElementIO ),
phetioType: PhetioGroup.PhetioGroupIO( CircuitElement.CircuitElementIO ),
tandem: tandem.createTandem( 'fuseGroup' )
} );

// @public
this.seriesAmmeterGroup = new PhetioGroup(
( tandem, startVertex, endVertex ) => new SeriesAmmeter( startVertex, endVertex, tandem ),
() => createVertices( CCKCConstants.SERIES_AMMETER_LENGTH ), {
phetioType: PhetioGroupIO( CircuitElement.CircuitElementIO ),
phetioType: PhetioGroup.PhetioGroupIO( CircuitElement.CircuitElementIO ),
tandem: tandem.createTandem( 'seriesAmmeterGroup' )
} );

Expand All @@ -342,35 +341,35 @@ class Circuit {
editableRange: CCKCConstants.HIGH_RESISTANCE_RANGE
} );
}, () => createVertices( 100 ), {
phetioType: PhetioGroupIO( CircuitElement.CircuitElementIO ),
phetioType: PhetioGroup.PhetioGroupIO( CircuitElement.CircuitElementIO ),
tandem: tandem.createTandem( 'highResistanceLightBulbGroup' )
} );

this.capacitorGroup = new PhetioGroup(
( tandem, startVertex, endVertex ) => new Capacitor( startVertex, endVertex, tandem ),
() => createVertices( CCKCConstants.CAPACITOR_LENGTH ), {
phetioType: PhetioGroupIO( CircuitElement.CircuitElementIO ),
phetioType: PhetioGroup.PhetioGroupIO( CircuitElement.CircuitElementIO ),
tandem: tandem.createTandem( 'capacitorGroup' )
} );

this.inductorGroup = new PhetioGroup(
( tandem, startVertex, endVertex ) => new Inductor( startVertex, endVertex, tandem ),
() => createVertices( CCKCConstants.INDUCTOR_LENGTH ), {
phetioType: PhetioGroupIO( CircuitElement.CircuitElementIO ),
phetioType: PhetioGroup.PhetioGroupIO( CircuitElement.CircuitElementIO ),
tandem: tandem.createTandem( 'inductorGroup' )
} );

this.switchGroup = new PhetioGroup(
( tandem, startVertex, endVertex ) => new Switch( startVertex, endVertex, tandem ),
() => createVertices( CCKCConstants.SWITCH_LENGTH ), {
phetioType: PhetioGroupIO( CircuitElement.CircuitElementIO ),
phetioType: PhetioGroup.PhetioGroupIO( CircuitElement.CircuitElementIO ),
tandem: tandem.createTandem( 'switchGroup' )
} );

this.lightBulbGroup = new PhetioGroup( ( tandem, startVertex, endVertex ) => {
return new LightBulb( startVertex, endVertex, CCKCConstants.DEFAULT_RESISTANCE, this.viewTypeProperty, tandem );
}, () => createVertices( 100 ), {
phetioType: PhetioGroupIO( CircuitElement.CircuitElementIO ),
phetioType: PhetioGroup.PhetioGroupIO( CircuitElement.CircuitElementIO ),
tandem: tandem.createTandem( 'lightBulbGroup' )
} );

Expand Down

0 comments on commit 7f394d3

Please sign in to comment.