本文整理匯總了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();
}
}