home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Narzedzia
/
AIMP2
/
aimp_2.61.583.exe
/
$TEMP
/
YandexPackSetup.msi
/
fil62A122E1531034C084C81A23EACB45AC
< prev
next >
Wrap
Text File
|
2010-07-12
|
28KB
|
724 lines
XB._Parser = {
};
XB._Parser.EWidgetSyntax = CustomErrors.ECustom.extend({
$name: "EWidgetSyntax",
constructor: function EWidgetSyntax_constructor(elementName) {
this.base("XB widget parse error");
this._elementName = elementName.toString();
},
get _details() {
return [this._elementName];
},
_elementName: undefined
});
XB._Parser.ENoXBName = XB._Parser.EWidgetSyntax.extend({
$name: "ENoXBName"
});
XB._Parser.ENoXBFunction = XB._Parser.EWidgetSyntax.extend({
$name: "ENoXBFunction"
});
XB._Parser.Unit = function XBUnit_constructor(xmlDoc, package_, name, logRoot) {
if ( !(package_ instanceof XB.WidgetPackage) )
throw new CustomErrors.EArgType("package_", "XB.WidgetPackage", typeof package_);
if (!sysutils.isString(name) || name.length < 1)
throw new CustomErrors.EArgType("name", "String", typeof name);
this._package = package_;
this._name = name;
this._logger = XB._base.application.core.Log4Moz.repository.getLogger(logRoot + "." + name);
this._loadFromDoc(xmlDoc);
};
XB._Parser.Unit.prototype = {
constructor: XB._Parser.Unit,
get name() {
return this._name;
},
get unitPackage() {
return this._package;
},
get widgetProto() {
if (!this._widgetProto && this._widgetProtoParseError)
throw this._widgetProtoParseError;
return this._widgetProto;
},
finalize: function() {
this._widgetProto = null;
this._widgetProtoParseError = undefined;
this._name = undefined;
this._package = null;
this._logger = null;
},
_loadFromDoc: function XBUnit_loadFromDoc(unitDoc) {
if ( !(unitDoc instanceof Ci.nsIDOMDocument) )
throw new CustomErrors.EArgType("unitDoc", "nsIDOMDocument", typeof unitDoc);
if (unitDoc.documentElement.localName != XB._base.consts.STR_WIDGET_ELEMENT_NAME)
throw new XB._Parser.EWidgetSyntax(unitDoc.documentElement.nodeName);
try {
this._widgetProto = this._parseWidgetElement(unitDoc.documentElement);
}
catch (e) {
this._widgetProtoParseError = e;
this._logger.error(this._consts.ERR_PARSING_WIDGET + ". " + misc.formatError(e));
}
},
_consts: {
STR_UNIT_NODE_NAME: "unit",
STR_WIDGET_NAME_ATTR_NAME: "name",
STR_FUNC_PARAM_ELEM_NAME: "param",
STR_DEBUGMODE_ATTR_NAME: "__debug",
WARN_UNKNOWN_TOKEN: "Unknown token",
WARN_WIDGET_ALREADY_REGISTERED: "This unit already parsed a widget",
WARN_DUPLICATE_ARG: "Duplicate argument",
ERR_NO_WIDGET_ID: "No widget ID",
ERR_NO_WIDGET_NAME: "No widget name",
ERR_NO_DATA_NAME: "Unnamed data declaration",
ERR_NO_VAR_NAME: "Unnamed variable declaration",
ERR_NO_SETTING_NAME: "Unnamed setting",
ERR_PARSING_WIDGET: "An error occured while parsing widget",
ERR_PARSING_FUNC_NODE: "An error occured while parsing node",
ERR_INVALID_SCOPE: "Invalid scope definition",
ERR_WPACKAGE_REQUIRED: "Widget package required",
ERR_VALNODE_AMBIGUITY: "Value node has both a value attribute and a child node(s)",
ERR_UNKNOWN_VALUE_TYPE: "Unknown value type"
},
_name: undefined,
_logger: null,
_widgetProto: null,
_widgetProtoParseError: undefined,
_package: null,
_nodeUID: 1,
_parseWidgetElement: function XBUnit_parseWidgetElement(widgetElement) {
var widgetName = widgetElement.getAttribute(this._consts.STR_WIDGET_NAME_ATTR_NAME);
if (!widgetName)
throw new XB._Parser.ENoXBName(widgetElement.nodeName);
var protoID = this.unitPackage.id + "#" + this.name;
var widgetProto = new XB._Parser.Unit.WidgetPrototype(protoID, widgetElement, this);
var treeWalker = widgetElement.ownerDocument
.createTreeWalker(widgetElement, XB._Ci.nsIDOMNodeFilter.SHOW_ALL, this._nodeFilter, true);
if (treeWalker.firstChild()) {
do {
var subNode = treeWalker.currentNode;
if (subNode.namespaceURI == XB._base.consts.STR_FUNCTIONAL_NS) {
switch (subNode.localName) {
case "data":
this._parseWidgetData(widgetProto, treeWalker);
break;
case "variable":
this._parseWidgetVar(widgetProto, treeWalker);
break;
case "setting":
this._parseWidgetSetting(widgetProto, treeWalker);
break;
default:
this._createFunctionRef(treeWalker, widgetProto);
}
}
else
this._parseElement(treeWalker, null, widgetProto);
}
while (treeWalker.nextSibling());
}
return widgetProto;
},
_parseWidgetData: function XBUnit_parseWidgetData(parentWidget, treeWalker) {
var dataNode = treeWalker.currentNode;
var dataName = dataNode.getAttribute("name");
if (!dataName)
throw new XB._Parser.ENoXBName(dataNode.nodeName);
this._logger.trace("Found widget scope data " + dataName);
var nodeID = this._genNodeUID();
var calcNode = new XB._calcNodes.FuncNodeProto(nodeID, XB._functions.Data);
calcNode.debugMode = dataNode.hasAttribute(this._consts.STR_DEBUGMODE_ATTR_NAME);
this._parseElement(treeWalker, calcNode, parentWidget);
parentWidget.registerData(dataName, calcNode);
},
_evalScope: function XBUnit_evalScope(scopeName) {
switch (scopeName) {
case "widget":
return XB._base.consts.ENUM_SCOPE_WIDGET;
case "instance":
return XB._base.consts.ENUM_SCOPE_INSTANCE;
case undefined:
return XB._base.consts.ENUM_SCOPE_WIDGET;
default:
throw new Error(this._consts.ERR_INVALID_SCOPE);
}
},
_parseWidgetVar: function XBUnit_parseWidgetVar(parentWidget, treeWalker) {
var varNode = treeWalker.currentNode;
var varName = varNode.getAttribute("name");
if (!varName)
throw new XB._Parser.ENoXBName(varNode.nodeName);
this._logger.trace("Found variable " + varName);
var initialValue = varNode.getAttribute("default") || XB.types.empty;
try {
var varScope = this._evalScope(varNode.getAttribute("scope") || undefined);
}
catch (e) {
throw new XB._Parser.EWidgetSyntax(varNode.nodeName);
}
var persist = (varNode.getAttribute("persist") == "true");
parentWidget.registerVariable(varName, varScope, persist, initialValue);
},
_parseWidgetSetting: function XBUnit_parseWidgetSetting(parentWidget, treeWalker) {
var settingNode = treeWalker.currentNode;
var settingName = settingNode.getAttribute("name");
if (!settingName)
throw new XB._Parser.ENoXBName(settingNode.nodeName);
try {
var settingScope = this._evalScope(settingNode.getAttribute("scope") || undefined);
}
catch (e) {
throw new XB._Parser.EWidgetSyntax(settingNode.nodeName);
}
var defaultValue = settingNode.getAttribute("default");
var controlInfo = undefined;
if (treeWalker.firstChild())
try {
do {
let controlElement = treeWalker.currentNode;
if (controlElement.localName == "control") {
controlInfo = controlElement;
break;
}
}
while (treeWalker.nextSibling());
}
finally {
treeWalker.parentNode();
}
this._logger.trace("Found widget setting " + settingName +
", scope " + settingScope +
", default " + defaultValue);
parentWidget.registerSetting(settingName, settingScope, defaultValue, controlInfo);
},
_parseElement: function XBUnit_parseElement(treeWalker, parentCalcNode, parentWidget) {
this._logger.trace("Checking node " + treeWalker.currentNode.nodeName + " children");
var calcNodeArgs = [];
if (treeWalker.firstChild())
try {
do {
var widgetSubNode = treeWalker.currentNode;
if (parentCalcNode == null && widgetSubNode.namespaceURI != XB._base.consts.STR_FUNCTIONAL_NS) {
this._parseElement(treeWalker, null, parentWidget);
continue;
}
if (parentCalcNode == null) {
this._createFunctionRef(treeWalker, parentWidget);
}
else {
var argInfo = this._handleFunctionSubNode(treeWalker, parentWidget);
calcNodeArgs.push(argInfo);
}
}
while (treeWalker.nextSibling());
}
finally {
treeWalker.parentNode();
}
if (parentCalcNode != null) {
var unnamedArgs = [];
for each (let argInfo in calcNodeArgs) {
if (argInfo.name) {
if (!parentCalcNode.argumentAttached(argInfo.name))
parentCalcNode.attachArgument(argInfo.name, argInfo.calcNode);
else
this._logger.warn(this._consts.WARN_DUPLICATE_ARG + " '" + argInfo.name + "'");
}
else
unnamedArgs.push(argInfo);
}
for each (let argInfo in unnamedArgs) {
argInfo.name = parentCalcNode.proposeArgName();
parentCalcNode.attachArgument(argInfo.name, argInfo.calcNode);
}
}
},
_createFunctionRef: function XBUnit_createFuncRef(treeWalker, parentWidget) {
var srcXMLNode = treeWalker.currentNode;
var calcNode;
if (srcXMLNode.localName == "value"){
calcNode = this._createValNode(srcXMLNode);
}
else {
let funcName = srcXMLNode.localName;
let calcNodeConstructor = XB._functions["CN_" + funcName];
if ( !(calcNodeConstructor instanceof Function) )
throw new XB._Parser.ENoXBFunction(funcName);
calcNode = new XB._calcNodes.FuncNodeProto(this._genNodeUID(), calcNodeConstructor);
}
var refID = calcNode.baseID;
parentWidget.registerReference(refID, calcNode);
this._logger.trace("Replacing functional element " + srcXMLNode.localName + " with a reference " + refID);
var valRefElement = srcXMLNode.ownerDocument.createElementNS(
XB._base.consts.STR_UI_NS,
XB._base.consts.STR_VAL_REF_ELEM_NAME);
valRefElement.setUserData(XB._base.consts.STR_VAL_REF_ID_KEY_NAME, refID, this._userDataHandler);
srcXMLNode.parentNode.replaceChild(valRefElement, srcXMLNode);
try {
if ( !(calcNode instanceof XB._calcNodes.ConstNodeProto) ) {
this._parseFuncNodeAttributes(srcXMLNode.attributes, calcNode);
this._parseElement(treeWalker, calcNode, parentWidget);
}
}
finally {
treeWalker.currentNode = valRefElement;
}
},
_handleFunctionSubNode: function XBUnit_handleFuncSubNode(treeWalker, parentWidget) {
this._logger.trace("Handling function arguments");
var calcNode;
var argName;
var argXMLNode = treeWalker.currentNode;
if (argXMLNode.nodeType == argXMLNode.ELEMENT_NODE &&
argXMLNode.localName == this._consts.STR_FUNC_PARAM_ELEM_NAME &&
argXMLNode.namespaceURI == XB._base.consts.STR_FUNCTIONAL_NS) {
argName = argXMLNode.getAttribute("name") || undefined;
this._logger.trace("Found <f:param> element, name is " + argName);
var argsLen = 0;
if (treeWalker.firstChild()) {
try {
do {
argsLen++;
}
while (treeWalker.nextSibling());
if (argsLen == 1)
calcNode = this._handleArgumentNode(treeWalker, parentWidget);
}
finally {
treeWalker.parentNode();
}
}
if (argsLen > 1) {
var nodeID = this._genNodeUID();
calcNode = new XB._calcNodes.FuncNodeProto(nodeID, XB._functions.CN_concat);
this._parseElement(treeWalker, calcNode, parentWidget);
}
else
if (argsLen == 0)
calcNode = new XB._calcNodes.ConstNodeProto(this._genNodeUID(), "");
}
else
calcNode = this._handleArgumentNode(treeWalker, parentWidget);
return {name: argName, calcNode: calcNode};
},
_handleArgumentNode: function XBUnit_handleArgNode(treeWalker, parentWidget) {
var calcNode;
var argXMLNode = treeWalker.currentNode;
if (argXMLNode.nodeType == argXMLNode.ELEMENT_NODE &&
argXMLNode.namespaceURI == XB._base.consts.STR_FUNCTIONAL_NS) {
this._logger.trace("Found functional parameter. Subfunction is \"" + argXMLNode.localName + "\"");
if (argXMLNode.localName == "value"){
calcNode = this._createValNode(argXMLNode);
}
else {
let funcName = argXMLNode.localName;
let calcNodeConstructor = XB._functions["CN_" + funcName];
if ( !(calcNodeConstructor instanceof Function) )
throw new XB._Parser.ENoXBFunction(funcName);
calcNode = new XB._calcNodes.FuncNodeProto(this._genNodeUID(), calcNodeConstructor);
this._parseFuncNodeAttributes(argXMLNode.attributes, calcNode);
this._parseElement(treeWalker, calcNode, parentWidget);
}
}
else {
this._logger.trace("Found XML parameter. Node name is \"" + argXMLNode.nodeName + "\"");
if (argXMLNode.nodeType == argXMLNode.TEXT_NODE) {
var text = sysutils.trimSpaces(argXMLNode.nodeValue);
this._logger.trace("Text value is: " + text);
calcNode = new XB._calcNodes.ConstNodeProto(this._genNodeUID(), text);
}
else {
this._parseElement(treeWalker, null, parentWidget);
calcNode = new XB._calcNodes.ConstNodeProto(this._genNodeUID(), new XB.types.XML(argXMLNode));
}
}
return calcNode;
},
_parseFuncNodeAttributes: function XBUnit_parseFuncNodeAttrs(attrsNodeMap, calcNode) {
this._logger.trace("Checking functional node attributes");
for (let attrIdx = 0, len = attrsNodeMap.length; attrIdx < len; attrIdx++) {
let attrNode = attrsNodeMap.item(attrIdx);
let argName = attrNode.localName;
if (argName == this._consts.STR_DEBUGMODE_ATTR_NAME) {
calcNode.debugMode = true;
continue;
}
let arg;
let text = attrNode.nodeValue;
let match = text.match(/^\$(.+)$/);
if (match) {
let refName = match[1];
let refNameNode = new XB._calcNodes.ConstNodeProto(this._genNodeUID(), refName);
arg = new XB._calcNodes.FuncNodeProto(this._genNodeUID(), XB._functions["CN_value-of"]);
arg.attachArgument("name", refNameNode);
}
else {
arg = new XB._calcNodes.ConstNodeProto(this._genNodeUID(), text);
}
if (!calcNode.argumentAttached(argName))
calcNode.attachArgument(argName, arg);
else
this._logger.warn(this._consts.WARN_DUPLICATE_ARG + " '" + argName + "'");
}
},
_createValNode: function XBUnit_createValNode(srcXMLNode) {
if (srcXMLNode.hasAttribute("value") && srcXMLNode.hasChildNodes())
throw new XB._Parser.EWidgetSyntax(srcXMLNode.nodeName);
var raw;
if (valueType == "xml")
raw = srcXMLNode.childNodes;
else
raw = srcXMLNode.getAttribute("value") || sysutils.trimSpaces(srcXMLNode.textContent);
var val;
var valueType = srcXMLNode.getAttribute("type") || "string";
switch (valueType) {
case "string":
val = raw;
break;
case "xml":
val = XB._base.runtime.xToXML(raw);
break;
case "number":
val = XB._base.runtime.xToNumber(raw);
break;
case "bool":
val = XB._base.runtime.xToBool(raw);
break;
case "empty":
val = XB.types.empty;
break;
default:
throw new XB._Parser.EWidgetSyntax(srcXMLNode.nodeName);
}
return new XB._calcNodes.ConstNodeProto(this._genNodeUID(), val);
},
_genNodeUID: function XBUnit_genNodeUID() {
return this._nodeUID++;
},
_nodeFilter: {
acceptNode : function XBUnit_NF_acceptNode(node) {
if ( (node.nodeType == node.COMMENT_NODE) ||
((node.nodeType == node.TEXT_NODE) && !this._emptyTextRE.test(node.nodeValue)) )
return XB._Ci.nsIDOMNodeFilter.FILTER_REJECT;
return XB._Ci.nsIDOMNodeFilter.FILTER_ACCEPT;
},
_emptyTextRE: /[^\t\n\r ]/
},
_userDataHandler: {
handle: function XBUnit_UDH_handle(operation, key, data, srcNode, dstNode) {
try {
dstNode.setUserData(key, data, this);
}
catch (e) {
XB._base.logger.error("Failed setting userData " + misc.formatError(e));
}
}
}
};
XB._Parser.Unit.WidgetPrototype = XB._base.WidgetBase.extend({
constructor: function XBWidgetPrototype_constructor(protoID, srcDOMElement, unit) {
if ( !(srcDOMElement instanceof XB._Ci.nsIDOMElement) )
throw new CustomErrors.EArgType("srcDOMElement", "nsIDOMElement", typeof srcDOMElement);
this._srcDOMElement = srcDOMElement;
this.base(protoID);
if ( !(unit instanceof XB._Parser.Unit) )
throw new CustomErrors.EArgType("unit", "XB._Parser.Unit", typeof unit);
this._unit = unit;
let loggerName = XB._base.loggersRoot + "." + protoID;
this._logger = XB._base.application.core.Log4Moz.repository.getLogger(loggerName);
this._unique = (srcDOMElement.getAttribute("unique") != "false");
this._name = srcDOMElement.getAttribute("name") || undefined;
this._iconPath = srcDOMElement.getAttribute("icon") || undefined;
this._instSettings = [];
this._instVars = [];
this._spawnedWidgets = [];
},
createInstance: function XBWidgetPrototype_createInstance(instanceID, widgetHost, instanceSettings) {
var instance = new XB._Parser.Unit.WidgetInstance(instanceID,
this,
widgetHost,
this._refsMap,
this._dataMap,
this._instSettings,
this._instVars);
this._spawnedWidgets.push(instance);
if (instanceSettings != undefined)
XB._base.logger.debug("Instance settings:\n" + misc.dump(instanceSettings));
try {
for (let name in instanceSettings)
instance.applySetting(name, instanceSettings[name]);
}
catch (e) {
XB._base.logger.error("Couldn't apply widget instance settings. " + misc.formatError(e));
}
return instance;
},
get spawnedWidgets() {
return this._spawnedWidgets.slice(0);
},
get srcElement() {
return this._srcDOMElement;
},
registerReference: function XBWIdgetPrototype_registerReference(refID, calcNode) {
this._refsMap[refID] = calcNode;
},
registerVariable: function XBWidgetPrototype_registerVariable(varName, varScope, persistent, initialValue) {
XB._base.logger.trace("Widget prototype " + this.id + " registers var " + varName + ", scope " + varScope);
if (this._varsMap[varName])
XB._base.logger.warn(this._consts.WARN_VAR_REDEFINED + " " + varName);
switch (varScope) {
case XB._base.consts.ENUM_SCOPE_WIDGET:
var nodeID = this.id + "_var_" + varName;
this._varsMap[varName] = persistent ?
new XB._calcNodes.PersistentVarNode(nodeID, this, varName, initialValue) :
new XB._calcNodes.VarNode(nodeID, this, initialValue);
break;
case XB._base.consts.ENUM_SCOPE_INSTANCE:
this._instVars.push({name: varName, persistent: persistent, initialValue: initialValue});
break;
default:
throw new CustomErrors.EArgType("varScope", "ENUM_SCOPE_WIDGET | ENUM_SCOPE_INSTANCE", "" + varScope);
}
},
registerData: function XBWidgetPrototype_registerData(dataName, dataNode) {
if (this._dataMap[dataName])
XB._base.logger.warn(this._consts.WARN_DATA_REDEFINED + " " + dataName);
this._dataMap[dataName] = dataNode;
},
registerSetting: function XBWidgetPrototype_registerSetting(settingName, settingScope, defaultValue, controlInfo) {
XB._base.logger.trace("Widget prototype " + this.id + " registers setting " + settingName + ", scope " + settingScope);
switch (settingScope) {
case XB._base.consts.ENUM_SCOPE_WIDGET:
var nodeID = "setting_" + settingName;
var settingNode = new XB._calcNodes.SettingNode(nodeID, this, settingName, defaultValue);
this._settingsMap[settingName] = {node: settingNode, controlInfo: controlInfo};
break;
case XB._base.consts.ENUM_SCOPE_INSTANCE:
this._instSettings.push({name: settingName, defaultValue: defaultValue, controlInfo: controlInfo});
break;
default:
throw new CustomErrors.EArgType("settingScope", "ENUM_SCOPE_WIDGET | ENUM_SCOPE_INSTANCE", "" + settingScope);
}
},
instanceFinalized: function XBWidgetPrototype_instanceFinalized(widgetInstance) {
for (let index in this._spawnedWidgets)
if (this._spawnedWidgets[index] == widgetInstance) {
this._spawnedWidgets.splice(index, 1);
break;
}
},
get name() {
return this._name;
},
get iconURI() {
return this.pkg.resolvePath(this._iconPath);
},
get iconPath() {
return this._iconPath;
},
get isUnique() {
return this._unique;
},
get unit() {
return this._unit;
},
get pkg() {
return this._unit.unitPackage;
},
get logger() {
return this._logger;
},
_srcDOMElement: undefined,
_logger: null,
_name: undefined,
_iconPath: undefined,
_unit: null,
_unique: false,
_instSettings: null,
_instVars: null,
_spawnedIDs: null
});
XB._Parser.Unit.WidgetInstance = XB._base.WidgetBase.extend({
constructor: function XBWidgetInstance_constructor(IID, proto, host, refsMap, dataMap, settingsArr, varsArr) {
if ( !(proto instanceof XB._Parser.Unit.WidgetPrototype) )
throw new CustomErrors.EArgType("proto", "XB._Parser.Unit.WidgetPrototype", typeof proto);
this.base(IID);
this._proto = proto;
this._host = host;
for (let refID in refsMap)
this._refsMap[refID] = refsMap[refID].createInstance(this);
for (let dataName in dataMap)
this._dataMap[dataName] = dataMap[dataName].createInstance(this);
for each (let setting in settingsArr)
this._registerSetting(setting.name, setting.defaultValue, setting.controlInfo);
for each (let variable in varsArr)
this._registerVariable(variable.name, variable.persistent, variable.initialValue);
},
get prototype() {
return this._proto;
},
get host() {
return this._host;
},
applySetting: function XBWidgetInstance_applySetting(name, value) {
this._settingsMap[name].node.setValue(value);
},
findSetting: function XBWidgetInstance_findSetting(settingName) {
this.logger.trace("Looking for widget instance setting " + settingName);
var settingNode = this.base(settingName);
return settingNode? settingNode: this._proto.findSetting(settingName);
},
findVariable: function XBWidgetInstance_findVariable(varName) {
this.logger.trace("Looking for widget instance variable " + varName);
var varNode = this.base(varName);
return varNode? varNode: this._proto.findVariable(varName);
},
finalize: function XBWidgetInstance_finalize() {
function finalizeNodesInMap(map) {
for each (let node in map)
try {
node.finalize();
}
catch (e) {
XB._base.logger.error("Error while finalizing calc node. " + misc.formatError(e));
XB._base.logger.debug(e.stack);
}
}
finalizeNodesInMap(this._refsMap);
finalizeNodesInMap(this._varsMap);
finalizeNodesInMap(this._dataMap);
for each (let setting in this._settingsMap) {
try {
setting.node.finalize();
}
catch (e) {
this.logger.error("Error while finalizing setting node. " + misc.formatError(e));
}
}
var proto = this._proto;
this._proto = null;
this._host = null;
proto.instanceFinalized(this);
},
get logger() {
return this.prototype.logger;
},
_consts: {
ERR_PROTO_EXPECTED: "Widget prototype expected"
},
_proto: null,
_wndEngine: null,
_registerSetting: function XBWidgetInstance_registerSetting(settingName, defaultValue, controlInfo) {
var nodeID = "setting_" + settingName;
var settingNode = new XB._calcNodes.SettingNode(nodeID, this, settingName, defaultValue);
this._settingsMap[settingName] = {node: settingNode, controlInfo: controlInfo};
},
_registerVariable: function XBWidgetInstance_registerVariable(varName, persistent, initialValue) {
var nodeID = this.id + "_var_" + varName;
this._varsMap[varName] = persistent ?
new XB._calcNodes.PersistentVarNode(nodeID, this, varName, initialValue) :
new XB._calcNodes.VarNode(nodeID, this, initialValue);
}
});