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);
}
Aggregations