All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.share.srctree.test-class-table.js Maven / Gradle / Ivy

The newest version!
/**
 * @class
 */
sahagin.TestClassTable = function() {

  /**
   * @private
   * @type {Array.}
   */
  this.testClasses = new Array();
};

/**
 * @returns {Array.}
 */
sahagin.TestClassTable.prototype.getTestClasses = function() {
  return this.testClasses;
};

/**
 * @param {sahagin.TestClass} testClass
 */
sahagin.TestClassTable.prototype.addTestClass = function(testClass) {
  this.testClasses.push(testClass);
};

/**
 * @returns {boolean}
 */
sahagin.TestClassTable.prototype.isEmpty = function() {
  this.testClasses.length == 0;
};

/**
 * returns null if not found
 * @param {string} key
 * @returns {sahagin.TestClass}
 */
sahagin.TestClassTable.prototype.getByKey = function(key) {
  if (key == null || key == undefined) {
    throw new Error(key);
  }
  for (var i = 0; i < this.testClasses.length; i++) {
    var testClass = this.testClasses[i];
    if (key == testClass.getKey()) {
      return testClass;
    }
  }
  return null;
};

/**
 * @returns {Object.}
 */
sahagin.TestClassTable.prototype.toYamlObject = function() {
  var result = new Object();
  if (!this.isEmpty()) {
    result['classes'] = sahagin.YamlUtils.toYamlObjectList(this.testClasses);
  }
  return result;
};

/**
 * @param {Object.} yamlObject
 */
sahagin.TestClassTable.prototype.fromYamlObject = function(yamlObject) {
  var testClassesYamlObj = sahagin.YamlUtils.getYamlObjectListValue(yamlObject, 'classes', true);
  this.testClasses = new Array();
  for (var i = 0; i < testClassesYamlObj.length; i++) {
    var testClass = sahagin.TestClass.newInstanceFromYamlObject(testClassesYamlObj[i]);
    this.testClasses.push(testClass);
  }
};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy