Search in sources :

Example 1 with TaskCondition

use of nars.test.condition.TaskCondition in project narchy by automenta.

the class TestNAR method mustEmit.

@NotNull
TestNAR mustEmit(@NotNull Topic<Tasked>[] c, long cycleStart, long cycleEnd, @NotNull String sentenceTerm, byte punc, float freqMin, float freqMax, float confMin, float confMax, LongPredicate start, LongPredicate end, boolean must) throws Narsese.NarseseException {
    if (freqMin == -1)
        freqMin = freqMax;
    int tt = temporalTolerance;
    cycleStart -= tt;
    cycleEnd += tt;
    float hf = freqTolerance / 2.0f;
    float hc = confTolerance / 2.0f;
    TaskCondition tc = new TaskCondition(nar, cycleStart, cycleEnd, sentenceTerm, punc, freqMin - hf, freqMax + hf, confMin - hc, confMax + hc, start, end);
    for (Topic<Tasked> cc : c) {
        cc.on(tc);
    }
    finished = false;
    if (must) {
        succeedsIfAll.add(tc);
    } else {
        // require entire execution, not just finish early
        exitOnAllSuccess = false;
        failsIfAny.add(tc);
    }
    return this;
// 
// ExplainableTask et = new ExplainableTask(tc);
// if (showExplanations) {
// explanations.add(et);
// }
// return et;
}
Also used : TaskCondition(nars.test.condition.TaskCondition) Tasked(nars.task.Tasked) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Tasked (nars.task.Tasked)1 TaskCondition (nars.test.condition.TaskCondition)1 NotNull (org.jetbrains.annotations.NotNull)1