<commit_before>/**
 * @license
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
CLASS({
  package: 'foam.u2',
  name: 'ChoiceViewTrait',

  properties: [
    {
      model_: 'BooleanProperty',
      name: 'autoSetData',
      documentation: 'When true, this.data will be set if choices are set ' +
          'and the current data is not one of the choices.',
      defaultValue: true
    },
    {
      name: 'label',
      documentation: 'The user-visible label for this View. Not to be ' +
          'confused with $$DOC{ref:".text"}, the name of the currently ' +
          'selected choice.',
      postSet: function(old, nu) {
        for (var i = 0; i < this.choices.length; i++) {
          if (this.choices[i][1] === nu) {
            if (this.index !== i) this.index = i;
            return;
          }
        }
      },
    },
    {
      name: 'choice',
      documentation: 'The current choice (ie. [value, text] pair).',
      getter: function() {
        var value = this.data;
        for (var i = 0; i < this.choices.length; i++) {
          var choices = this.choices[i];
          if (value === choices[0]) return choice;
        }
        return undefined;
      },
      setter: function(nu) {
        var oldValue = this.choice;
        this.data = nu[0];
        this.text = nu[1];
        this.propertyChange('choice', oldValue, this.choice);
      }
    },
    {
      name: 'choices',
      type: 'Array[StringField]',
      documentation: 'Array of [value, text] choices. Simple String values ' +<commit_msg>Fix undefined reference in ChoiceViewTrait.<commit_after>/**
 * @license
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
CLASS({
  package: 'foam.u2',
  name: 'ChoiceViewTrait',

  properties: [
    {
      model_: 'BooleanProperty',
      name: 'autoSetData',
      documentation: 'When true, this.data will be set if choices are set ' +
          'and the current data is not one of the choices.',
      defaultValue: true
    },
    {
      name: 'label',
      documentation: 'The user-visible label for this View. Not to be ' +
          'confused with $$DOC{ref:".text"}, the name of the currently ' +
          'selected choice.',
      postSet: function(old, nu) {
        for (var i = 0; i < this.choices.length; i++) {
          if (this.choices[i][1] === nu) {
            if (this.index !== i) this.index = i;
            return;
          }
        }
      },
    },
    {
      name: 'choice',
      documentation: 'The current choice (ie. [value, text] pair).',
      getter: function() {
        var value = this.data;
        for (var i = 0; i < this.choices.length; i++) {
          var choice = this.choices[i];
          if (value === choice[0]) return choice;
        }
        return undefined;
      },
      setter: function(nu) {
        var oldValue = this.choice;
        this.data = nu[0];
        this.text = nu[1];
        this.propertyChange('choice', oldValue, this.choice);
      }
    },
    {
      name: 'choices',
      type: 'Array[StringField]',
      documentation: 'Array of [value, text] choices. Simple String values ' +
{'fraction_non_alphanumeric': 0.11991485335856197, 'fraction_numerical': 0.007095553453169348, 'mean_word_length': 2.273219814241486, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6692812', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1193, 'n_words': 440}