Search in sources :

Example 51 with Term

use of at.ac.tuwien.kr.alpha.api.terms.Term in project Alpha by alpha-asp.

the class ThreeColouringTestWithRandom method fact.

private Atom fact(String predicateName, int... iTerms) {
    List<Term> terms = new ArrayList<>(iTerms.length);
    Predicate predicate = Predicates.getPredicate(predicateName, iTerms.length);
    for (int i : iTerms) {
        terms.add(Terms.newConstant(i));
    }
    return Atoms.newBasicAtom(predicate, terms);
}
Also used : ArrayList(java.util.ArrayList) Term(at.ac.tuwien.kr.alpha.api.terms.Term) Predicate(at.ac.tuwien.kr.alpha.api.programs.Predicate)

Example 52 with Term

use of at.ac.tuwien.kr.alpha.api.terms.Term in project Alpha by alpha-asp.

the class TestUtils method basicAtomWithStringTerms.

public static BasicAtom basicAtomWithStringTerms(String predicate, String... terms) {
    Predicate pred = Predicates.getPredicate(predicate, terms.length);
    List<Term> trms = new ArrayList<>();
    for (String str : terms) {
        trms.add(Terms.newConstant(str));
    }
    return Atoms.newBasicAtom(pred, trms);
}
Also used : ArrayList(java.util.ArrayList) Term(at.ac.tuwien.kr.alpha.api.terms.Term) Predicate(at.ac.tuwien.kr.alpha.api.programs.Predicate)

Aggregations

Term (at.ac.tuwien.kr.alpha.api.terms.Term)52 VariableTerm (at.ac.tuwien.kr.alpha.api.terms.VariableTerm)36 ArrayList (java.util.ArrayList)16 ConstantTerm (at.ac.tuwien.kr.alpha.api.terms.ConstantTerm)15 FunctionTerm (at.ac.tuwien.kr.alpha.api.terms.FunctionTerm)15 IntervalTerm (at.ac.tuwien.kr.alpha.commons.terms.IntervalTerm)12 ArithmeticTerm (at.ac.tuwien.kr.alpha.api.terms.ArithmeticTerm)10 Predicate (at.ac.tuwien.kr.alpha.api.programs.Predicate)9 Test (org.junit.jupiter.api.Test)8 Literal (at.ac.tuwien.kr.alpha.api.programs.literals.Literal)7 Atom (at.ac.tuwien.kr.alpha.api.programs.atoms.Atom)6 BasicSubstitution (at.ac.tuwien.kr.alpha.commons.substitutions.BasicSubstitution)6 HashSet (java.util.HashSet)6 AggregateLiteral (at.ac.tuwien.kr.alpha.api.programs.literals.AggregateLiteral)4 Instance (at.ac.tuwien.kr.alpha.commons.substitutions.Instance)4 Substitution (at.ac.tuwien.kr.alpha.api.grounder.Substitution)3 BasicAtom (at.ac.tuwien.kr.alpha.api.programs.atoms.BasicAtom)3 ComparisonLiteral (at.ac.tuwien.kr.alpha.api.programs.literals.ComparisonLiteral)3 Unifier (at.ac.tuwien.kr.alpha.commons.substitutions.Unifier)3 MinusTerm (at.ac.tuwien.kr.alpha.commons.terms.ArithmeticTermImpl.MinusTerm)3