Search in sources :

Example 1 with ParsedAtom

use of at.ac.tuwien.kr.alpha.grounder.parser.ParsedAtom in project Alpha by alpha-asp.

the class NonGroundRule method constructNonGroundRule.

public static NonGroundRule constructNonGroundRule(IntIdGenerator intIdGenerator, ParsedRule parsedRule) {
    final List<Atom> pos = new ArrayList<>(parsedRule.body.size() / 2);
    final List<Atom> neg = new ArrayList<>(parsedRule.body.size() / 2);
    for (ParsedAtom bodyAtom : parsedRule.body) {
        (bodyAtom.isNegated() ? neg : pos).add(bodyAtom.toAtom());
    }
    // Construct head if the given parsedRule is no constraint
    final Atom head = parsedRule.head != null ? parsedRule.head.toAtom() : null;
    return new NonGroundRule(intIdGenerator.getNextId(), pos, neg, head);
}
Also used : BuiltinAtom(at.ac.tuwien.kr.alpha.common.BuiltinAtom) ParsedAtom(at.ac.tuwien.kr.alpha.grounder.parser.ParsedAtom) BasicAtom(at.ac.tuwien.kr.alpha.common.BasicAtom) Atom(at.ac.tuwien.kr.alpha.common.Atom) ParsedAtom(at.ac.tuwien.kr.alpha.grounder.parser.ParsedAtom)

Aggregations

Atom (at.ac.tuwien.kr.alpha.common.Atom)1 BasicAtom (at.ac.tuwien.kr.alpha.common.BasicAtom)1 BuiltinAtom (at.ac.tuwien.kr.alpha.common.BuiltinAtom)1 ParsedAtom (at.ac.tuwien.kr.alpha.grounder.parser.ParsedAtom)1