<commit_before>// Copyright 2019, University of Colorado Boulder

/**
 * Base class for representation of plate charge.  Plate charge is represented
 * as an integer number of '+' or '-' symbols. These symbols are distributed
 * across some portion of the plate's top face.
 *
 * All model coordinates are relative to the capacitor's local coordinate frame.
 *
 * Moved from capacitor-lab-basics/js/common/view/PlateChargeNode.js on Oct 7, 2019
 *
 * @author <NAME> (PixelZoom, Inc.)
 * @author <NAME> (PhET Interactive Simulations)
 * @author <NAME>  (PhET Interactive Simulations)
 * @author <NAME> (PhET Interactive Simulations)
 */
define( require => {
  'use strict';

  // modules
  const CanvasNode = require( 'SCENERY/nodes/CanvasNode' );
  const CapacitorConstants = require( 'SCENERY_PHET/capacitor/CapacitorConstants' );
  const Dimension2 = require( 'DOT/Dimension2' );
  const merge = require( 'PHET_CORE/merge' );
  const Node = require( 'SCENERY/nodes/Node' );
  const Orientation = require( 'PHET_CORE/Orientation' );
  const PhetColorScheme = require( 'SCENERY_PHET/PhetColorScheme' );
  const Property = require( 'AXON/Property' );
  const Range = require( 'DOT/Range' );
  const sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' );
  const Util = require( 'DOT/Util' );
  const validate = require( 'AXON/validate' );

  // constants
  const POSITIVE_CHARGE_COLOR = PhetColorScheme.RED_COLORBLIND.computeCSS(); // CSS passed into context fillStyle
  const NEGATIVE_CHARGE_COLOR = 'blue';
  const NUMBER_OF_PLATE_CHARGES = new Range( 1, 625 );
  const NEGATIVE_CHARGE_SIZE = new Dimension2( 7, 2 );

  class PlateChargeNode extends CanvasNode {

    /**
     * @param {Capacitor} capacitor
     * @param {YawPitchModelViewTransform3} modelViewTransform
     * @param {Object} options
     */
    constructor( capacitor, modelViewTransform, options ) {

      options = merge( {
        // {string} - 'POSITIVE' or 'NEGATIVE'
        polarity: CapacitorConstants.POLARITY.POSITIVE,
        maxPlateCharge: Infinity,
        opacity: 1.0,
        orientation: Orientation.VERTICAL,
        canvasBounds: null // Bounds2|null
      }, options );

      validate( options.orientation, { validValues: Orientation.VALUES } );

      super( { canvasBounds: options.canvasBounds } );
      const self = this; // extend scope for nested callbacks

      // @private {Capacitor}
      this.capacitor = capacitor;

      // @private
      this.orientation = options.orientation;

      // @private {YawPitchModelViewTransform3}
      this.modelViewTransform = modelViewTransform;

      // @private {string} - 'POSITIVE' or 'NEGATIVE'
      this.polarity = options.polarity;

      // @private {number}
      this.maxPlateCharge = options.maxPlateCharge;

      // @private {number}
      this.opacity = options.opacity;

      this.parentNode = new Node(); // @private parent node for charges
      this.addChild( this.parentNode );

      // No disposal required because the capacitor exists for the life of the sim
      Property.multilink( [
          capacitor.plateSizeProperty,
          capacitor.plateChargeProperty // TODO: why was this not needed by CLB
        ], () => self.isVisible() && self.invalidatePaint()
      );
    }

    /**
     * @param {number} numberOfObjects [description]
     * @param {number} width
     * @param {number} height
     * @returns {Dimension2}<commit_msg>Remove unnecessary TODO<commit_after>// Copyright 2019, University of Colorado Boulder

/**
 * Base class for representation of plate charge.  Plate charge is represented
 * as an integer number of '+' or '-' symbols. These symbols are distributed
 * across some portion of the plate's top face.
 *
 * All model coordinates are relative to the capacitor's local coordinate frame.
 *
 * Moved from capacitor-lab-basics/js/common/view/PlateChargeNode.js on Oct 7, 2019
 *
 * @author <NAME> (PixelZoom, Inc.)
 * @author <NAME> (PhET Interactive Simulations)
 * @author <NAME>  (PhET Interactive Simulations)
 * @author <NAME> (PhET Interactive Simulations)
 */
define( require => {
  'use strict';

  // modules
  const CanvasNode = require( 'SCENERY/nodes/CanvasNode' );
  const CapacitorConstants = require( 'SCENERY_PHET/capacitor/CapacitorConstants' );
  const Dimension2 = require( 'DOT/Dimension2' );
  const merge = require( 'PHET_CORE/merge' );
  const Node = require( 'SCENERY/nodes/Node' );
  const Orientation = require( 'PHET_CORE/Orientation' );
  const PhetColorScheme = require( 'SCENERY_PHET/PhetColorScheme' );
  const Property = require( 'AXON/Property' );
  const Range = require( 'DOT/Range' );
  const sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' );
  const Util = require( 'DOT/Util' );
  const validate = require( 'AXON/validate' );

  // constants
  const POSITIVE_CHARGE_COLOR = PhetColorScheme.RED_COLORBLIND.computeCSS(); // CSS passed into context fillStyle
  const NEGATIVE_CHARGE_COLOR = 'blue';
  const NUMBER_OF_PLATE_CHARGES = new Range( 1, 625 );
  const NEGATIVE_CHARGE_SIZE = new Dimension2( 7, 2 );

  class PlateChargeNode extends CanvasNode {

    /**
     * @param {Capacitor} capacitor
     * @param {YawPitchModelViewTransform3} modelViewTransform
     * @param {Object} options
     */
    constructor( capacitor, modelViewTransform, options ) {

      options = merge( {
        // {string} - 'POSITIVE' or 'NEGATIVE'
        polarity: CapacitorConstants.POLARITY.POSITIVE,
        maxPlateCharge: Infinity,
        opacity: 1.0,
        orientation: Orientation.VERTICAL,
        canvasBounds: null // Bounds2|null
      }, options );

      validate( options.orientation, { validValues: Orientation.VALUES } );

      super( { canvasBounds: options.canvasBounds } );
      const self = this; // extend scope for nested callbacks

      // @private {Capacitor}
      this.capacitor = capacitor;

      // @private
      this.orientation = options.orientation;

      // @private {YawPitchModelViewTransform3}
      this.modelViewTransform = modelViewTransform;

      // @private {string} - 'POSITIVE' or 'NEGATIVE'
      this.polarity = options.polarity;

      // @private {number}
      this.maxPlateCharge = options.maxPlateCharge;

      // @private {number}
      this.opacity = options.opacity;

      this.parentNode = new Node(); // @private parent node for charges
      this.addChild( this.parentNode );

      // No disposal required because the capacitor exists for the life of the sim
      Property.multilink( [
          capacitor.plateSizeProperty,
          capacitor.plateChargeProperty
        ], () => self.isVisible() && self.invalidatePaint()
      );
    }

    /**
     * @param {number} numberOfObjects [description]
     * @param {number} width
     * @param {number} height
     * @returns {Dimension2}
{'fraction_non_alphanumeric': 0.11070165094339622, 'fraction_numerical': 0.007075471698113208, 'mean_word_length': 3.2195273631840795, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2739349', 'n_tokens_mistral': 2114, 'n_tokens_neox': 2004, 'n_words': 543}