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

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

There is a newer version: 0.10.1
Show newest version
/**
 * @class
 */
sahagin.TestFuncTable = function() {

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

/**
 * @returns {Array.}
 */
sahagin.TestFuncTable.prototype.getTestFunctions = function() {
  return this.testFunctions;
};

/**
 * @param {sahagin.TestFunction} testFunction
 */
sahagin.TestFuncTable.prototype.addTestFunction = function(testFunction) {
  this.testFunctions.push(testFunction);
}

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

/**
 * @param {string} qualifiedName
 * @return {Array.}
 */
sahagin.TestFuncTable.prototype.getByQualifiedName = function(qualifiedName) {
  if (qualifiedName == null || key == undefined) {
    throw new Error(qualifiedName);
  }
  var result = new Array();
  for (var i = 0; i < this.testFunctions.length; i++) {
    var testFunction = this.testFunctions[i];
    if (qualifiedName == testFunction.getQualifiedName()) {
      result.push(testFunction);
    }
  }
  return result;
};

/**
 * @returns {Object.}
 */
sahagin.TestFuncTable.prototype.toYamlObject = function() {
  var result = new Object();
  result['functions'] = sahagin.YamlUtils.toYamlObjectList(this.testFunctions);
  return result;
};

/**
 * @param {Object.} yamlObject
 */
sahagin.TestFuncTable.prototype.fromYamlObject = function(yamlObject) {
  var testFunctionsYamlObj = sahagin.YamlUtils.getYamlObjectListValue(yamlObject, 'functions');
  this.testFunctions = new Array();
  for (var i = 0; i < testFunctionsYamlObj.length; i++) {
    var testFunction = sahagin.TestFunction.newInstanceFromYamlObject(testFunctionsYamlObj[i]);
    this.testFunctions.push(testFunction);
  }
};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy