Skip to content
Snippets Groups Projects
Commit 304907f1 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

sbml function data struct

parent 185228bb
No related branches found
No related tags found
1 merge request!186Resolve "upload of sbml"
"use strict";
function SbmlFunction(jsonObject) {
var self = this;
self.setFunctionId(jsonObject.functionId);
self.setName(jsonObject.name);
self.setId(jsonObject.id);
self.setArguments(jsonObject["arguments"]);
self.setDefinition(jsonObject.definition);
self.setMathMlPresentation(jsonObject.mathMlPresentation);
}
SbmlFunction.prototype.setFunctionId = function (functionId) {
this._functionId = functionId;
};
SbmlFunction.prototype.getFunctionId = function () {
return this._functionId;
};
SbmlFunction.prototype.setDefinition = function (definition) {
this._definition = definition;
};
SbmlFunction.prototype.getDefinition = function () {
return this._definition;
};
SbmlFunction.prototype.setMathMlPresentation = function (mathMlPresentation) {
this._mathMlPresentation = mathMlPresentation;
};
SbmlFunction.prototype.getMathMlPresentation = function () {
return this._mathMlPresentation;
};
SbmlFunction.prototype.setName = function (name) {
this._name = name;
};
SbmlFunction.prototype.getName = function () {
return this._name;
};
SbmlFunction.prototype.setArguments = function (args) {
this._arguments = args;
};
SbmlFunction.prototype.getArguments = function () {
return this._arguments;
};
SbmlFunction.prototype.setId = function (id) {
this._id = id;
};
SbmlFunction.prototype.getId = function () {
return this._id;
};
module.exports = SbmlFunction;
"use strict";
var SbmlFunction = require('../../../../main/js/map/data/SbmlFunction');
var chai = require('chai');
var assert = chai.assert;
var logger = require('../../logger');
describe('SbmlFunction', function () {
beforeEach(function () {
logger.flushBuffer();
});
it("constructor", function () {
var object = new SbmlFunction({
"functionId": "fun",
"name": "fun name",
"definition": "<lambda>" +
"<bvar><ci> x </ci></bvar>" +
"<bvar><ci> y </ci></bvar>" +
"<apply><plus/><ci> x </ci><ci> y </ci><cn type=\"integer\"> 2 </cn></apply>" +
"</lambda>\n\n",
"arguments": ["x", "y"],
"id": 5
});
assert.ok(object);
assert.ok(object.getDefinition().indexOf("apply") >= 0);
assert.equal("fun name",object.getName());
assert.equal("fun",object.getFunctionId());
assert.equal(5,object.getId());
assert.deepEqual(["x","y"],object.getArguments());
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment