本文整理汇总了TypeScript中src/exprEnv.ExprEnv类的典型用法代码示例。如果您正苦于以下问题:TypeScript ExprEnv类的具体用法?TypeScript ExprEnv怎么用?TypeScript ExprEnv使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExprEnv类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: calcResult
calcResult(index: number, resultA: number) {
if (this._range == 0)
return NaN;
var first = ExprEnv.get().getFirstIndex();
if (first < 0)
return resultA;
if (index > first) {
var prev = this._buf[index - 1];
return this._alpha * (resultA - prev.result) + prev.result;
}
return resultA;
}
示例2: execute
execute(ds, index) {
if (index < 0)
return;
this._exprEnv.setDataSource(ds);
ExprEnv.set(this._exprEnv);
try {
var i, cnt;
cnt = this._assigns.length;
for (i = 0; i < cnt; i++) {
this._assigns[i].assign(index);
}
cnt = this._outputs.length;
for (i = 0; i < cnt; i++) {
this._outputs[i].assign(index);
}
if (this._exprEnv.getFirstIndex() < 0)
this._exprEnv.setFirstIndex(index);
} catch (e) {
if (this._exprEnv.getFirstIndex() >= 0) {
throw e;
}
}
}
示例3: calcResult
calcResult(index, resultA) {
if (this._range == 0)
return NaN;
var first = ExprEnv.get().getFirstIndex();
if (first < 0)
return resultA;
if (index > first) {
var n = this._range;
if (n > index + 1 - first)
n = index + 1 - first;
return ((n - 1) * this._buf[index - 1].result + resultA * this._mul) / n;
}
return resultA;
}
示例4: calcResult
calcResult(index: number, resultA: number) {
var first = ExprEnv.get().getFirstIndex()
if (first < 0)
return resultA;
if (index > first) {
var n = this._range;
if (n == 0 || n >= index + 1 - first) {
return this._buf[index - 1].result + resultA;
}
return this._buf[index - 1].result + resultA - this._buf[index - n].resultA;
} else {
return resultA;
}
}
示例5: calcResult
calcResult(index, resultA) {
var first = ExprEnv.get().getFirstIndex()
if (first < 0)
return resultA;
if (index > first) {
var n = this._range;
var prev = this._buf[index - 1];
if (n >= index + 1 - first) {
n = index + 1 - first;
return prev.result * (1.0 - 1.0 / n) + (resultA / n);
}
return this._alpha * (resultA - prev.result) + prev.result;
}
return resultA;
}
示例6: calcResult
calcResult(index: number, resultA: number) {
if (this._range == 0)
return NaN;
var first = ExprEnv.get().getFirstIndex();
if (first < 0)
return resultA;
if (index > first) {
var n = this._range;
if (n >= index + 1 - first) {
n = index + 1 - first;
return this._buf[index - 1].result * (1.0 - 1.0 / n) + (resultA / n);
}
return this._buf[index - 1].result + (resultA - this._buf[index - n].resultA) / n;
} else {
return resultA;
}
}
示例7: calcResult
calcResult(index: number, resultA: number) {
if (this._range == 0)
return NaN;
var first = ExprEnv.get().getFirstIndex();
if (first < 0)
return 0;
if (index >= first) {
var n = this._range - 1;
if (n > index - first)
n = index - first;
var count = 0;
for (; n >= 0; n--) {
if (this._buf[index - n].resultA != 0.0)
count++;
}
return count;
} else {
return 0;
}
}
示例8: calcResult
calcResult(index: number, resultA: number) {
if (this._range == 0)
return NaN;
var first = ExprEnv.get().getFirstIndex();
if (first < 0)
return resultA;
if (index > first) {
var n = this._range;
var result = resultA;
var start = index - n + 1;
var i = Math.max(first, start);
for (; i < index; i++) {
var p = this._buf[i];
if (result < p.resultA)
result = p.resultA;
}
return result;
} else {
return resultA;
}
}
示例9: execute
execute(index) {
return ExprEnv.get().getDataSource().getDataAt(index).low
}
示例10: clear
clear() {
this._exprEnv.setFirstIndex(-1);
var i, cnt;
cnt = this._assigns.length;
for (i = 0; i < cnt; i++) {
this._assigns[i].clear();
}
cnt = this._outputs.length;
for (i = 0; i < cnt; i++) {
this._outputs[i].clear();
}
}