| 1 | package tuffy.ra; |
| 2 | |
| 3 | import java.util.ArrayList; |
| 4 | import java.util.HashSet; |
| 5 | |
| 6 | import tuffy.mln.Predicate; |
| 7 | |
| 8 | /** |
| 9 | * STILL IN DEVELOPMENT. |
| 10 | * An atomic formula with possibly functional arguments. |
| 11 | * |
| 12 | */ |
| 13 | public class AtomEx{ |
| 14 | private Predicate pred; |
| 15 | private ArrayList<Expression> args = new ArrayList<Expression>(); |
| 16 | private HashSet<String> vars = new HashSet<String>(); |
| 17 | |
| 18 | public ArrayList<Expression> getArguments(){ |
| 19 | return args; |
| 20 | } |
| 21 | |
| 22 | public boolean isBuiltIn(){ |
| 23 | return pred.isBuiltIn(); |
| 24 | } |
| 25 | |
| 26 | public AtomEx(Predicate predicate){ |
| 27 | this.pred = predicate; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Returns the set of variable names in this literal. |
| 32 | */ |
| 33 | public HashSet<String> getVars(){ |
| 34 | return vars; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Returns the predicate of this literal. |
| 39 | */ |
| 40 | public Predicate getPred() { |
| 41 | return pred; |
| 42 | } |
| 43 | |
| 44 | public String toSQL(){ |
| 45 | // cast argument into correct types |
| 46 | return null; |
| 47 | } |
| 48 | |
| 49 | |
| 50 | /** |
| 51 | * Appends a new term. |
| 52 | * |
| 53 | * @param t the term to be appended |
| 54 | */ |
| 55 | public void appendTerm(Expression t){ |
| 56 | args.add(t); |
| 57 | vars.addAll(t.getVars()); |
| 58 | } |
| 59 | |
| 60 | |
| 61 | |
| 62 | } |