Search in sources :

Example 1 with ImaginationSpace

use of nars.operator.ImaginationSpace in project opennars by opennars.

the class VisualSpace method ConstructSpace.

@Override
public ImaginationSpace ConstructSpace(Conjunction program) {
    if (program.isSpatial || program.getTemporalOrder() != TemporalRules.ORDER_FORWARD) {
        // would be a strange program :)
        return null;
    }
    Term beginning = program.term[0];
    if (beginning.imagination == null) {
        return null;
    }
    ImaginationSpace cur = beginning.imagination;
    // "execute program":
    for (int i = 1; i < program.term.length; i += 1) {
        if (!(program.term[i] instanceof Operation)) {
            return null;
        }
        Operation oper = (Operation) program.term[i];
        if (!IsOperationInSpace(oper)) {
            return null;
        }
        cur = cur.ProgressSpace(oper, cur);
        i++;
    }
    return null;
}
Also used : ImaginationSpace(nars.operator.ImaginationSpace) Term(nars.language.Term) Operation(nars.operator.Operation)

Aggregations

Term (nars.language.Term)1 ImaginationSpace (nars.operator.ImaginationSpace)1 Operation (nars.operator.Operation)1