Class PositiveAtom
java.lang.Object
edu.harvard.seas.pl.abcdatalog.ast.PositiveAtom
A non-negated atom; i.e., a predicate symbol, and a sequence of terms.
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
PositiveAtom
(PredicateSym pred, Term[] args) Constructs an atom from a predicate symbol and a list of arguments. -
Method Summary
Modifier and TypeMethodDescription<I,
O> O accept
(HeadVisitor<I, O> visitor, I state) <I,
O> O accept
(PremiseVisitor<I, O> visitor, I state) applySubst
(Substitution subst) Apply a substitution to the terms in this atom.static PositiveAtom
create
(PredicateSym pred, Term[] args) A static factory method for the creation of atoms.boolean
Term[]
getArgs()
getPred()
int
hashCode()
boolean
isGround()
toString()
unify
(PositiveAtom fact) Attempts to unify this atom with a fact (i.e., a ground atom).
-
Field Details
-
pred
Predicate symbol of this atom. -
args
Arguments of this atom. -
isGround
Is the atom ground (i.e., all arguments are constants)?
-
-
Constructor Details
-
PositiveAtom
Constructs an atom from a predicate symbol and a list of arguments.- Parameters:
pred
- predicate symbolargs
- arguments
-
-
Method Details
-
create
A static factory method for the creation of atoms. Returns an atom with the provided predicate symbol and arguments. The argument array becomes "owned" by this atom and should not be modified.- Parameters:
pred
- the predicate symbolargs
- the arguments- Returns:
- an atom with the provided predicate symbol and arguments
-
getArgs
-
getPred
-
isGround
public boolean isGround() -
unify
Attempts to unify this atom with a fact (i.e., a ground atom).- Parameters:
fact
- the fact- Returns:
- a substitution, or null if the atoms do not unify
-
applySubst
Apply a substitution to the terms in this atom.- Specified by:
applySubst
in interfaceHead
- Specified by:
applySubst
in interfacePremise
- Parameters:
subst
- the substitution- Returns:
- a new atom with the substitution applied
-
toString
-
hashCode
public int hashCode() -
equals
-
accept
-
accept
-