Search in sources :

Example 1 with Want

use of nars.operator.mental.Want in project opennars by opennars.

the class ConceptProcessing method processTask.

/**
 * Directly process a new task. Called exactly once on each task. Using
 * local information and finishing in a constant time. Provide feedback in
 * the taskBudget value of the task.
 * <p>
 * called in Memory.immediateProcess only
 *
 * @param task The task to be processed
 * @return whether it was processed
 */
public static boolean processTask(Concept concept, final DerivationContext nal, final Task task) {
    if (task.isInput()) {
        if (task.sentence.isJudgment() && !task.sentence.isEternal() && task.sentence.term instanceof Operation) {
            Operation op = (Operation) task.sentence.term;
            Operator o = (Operator) op.getPredicate();
            // only consider these mental ops an operation to track when executed not already when generated as internal event
            if (!(o instanceof Believe) && !(o instanceof Want) && !(o instanceof Wonder) && !(o instanceof Evaluate) && !(o instanceof Anticipate)) {
                TemporalInferenceControl.NewOperationFrame(nal.memory, task);
            }
        }
        concept.observable = true;
    }
    char type = task.sentence.punctuation;
    switch(type) {
        case Symbols.JUDGMENT_MARK:
            // memory.logic.JUDGMENT_PROCESS.commit();
            processJudgment(concept, nal, task);
            break;
        case Symbols.GOAL_MARK:
            // memory.logic.GOAL_PROCESS.commit();
            processGoal(concept, nal, task, true);
            break;
        case Symbols.QUESTION_MARK:
        case Symbols.QUEST_MARK:
            // memory.logic.QUESTION_PROCESS.commit();
            processQuestion(concept, nal, task);
            break;
        default:
            return false;
    }
    maintainDisappointedAnticipations(concept);
    if (task.aboveThreshold()) {
        // still need to be processed
        // memory.logic.LINK_TO_TASK.commit();
        concept.linkToTask(task, nal);
    }
    return true;
}
Also used : Operator(nars.operator.Operator) FunctionOperator(nars.operator.FunctionOperator) Believe(nars.operator.mental.Believe) Anticipate(nars.operator.mental.Anticipate) Evaluate(nars.operator.mental.Evaluate) Want(nars.operator.mental.Want) Operation(nars.operator.Operation) Wonder(nars.operator.mental.Wonder)

Aggregations

FunctionOperator (nars.operator.FunctionOperator)1 Operation (nars.operator.Operation)1 Operator (nars.operator.Operator)1 Anticipate (nars.operator.mental.Anticipate)1 Believe (nars.operator.mental.Believe)1 Evaluate (nars.operator.mental.Evaluate)1 Want (nars.operator.mental.Want)1 Wonder (nars.operator.mental.Wonder)1