Class PredicateKey
java.lang.Object
org.projog.core.predicate.PredicateKey
- All Implemented Interfaces:
Comparable<PredicateKey>
Represents the structure of a
Term.
Defines Terms by their name (functor) and number of arguments (arity). This "metadata" or "descriptor
information" allows rules whose heads (consequences) share the same structure to be grouped together.
As terms of type TermType.ATOM and TermType.STRUCTURE are the only terms that can be the head
(consequent) of a rule they are the only subclasses of Term that PredicateKey is intended to
describe.
PredicateKeys are constant; their values cannot be changed after they are created.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintOrdered on name or, if names identical, number of arguments.static PredicateKeyReturns aPredicateKeyfor the specified term.static PredicateKeybooleangetName()intinthashCode()toString()toTerm()
-
Constructor Details
-
PredicateKey
-
-
Method Details
-
createForTerm
Returns aPredicateKeyfor the specified term.- Parameters:
t- a term the returnedPredicateKeyshould represent (needs to have aTerm.getType()value ofTermType.ATOMorTermType.STRUCTURE)- Returns:
- a
PredicateKeyfor the specified term. - Throws:
ProjogException- iftis not of typeTermType.ATOMorTermType.STRUCTURE
-
createFromNameAndArity
- Parameters:
t- must be a structure named/where the first argument is the name of the predicate to represent and the second (and final) argument is the arity.
-
getName
-
getNumArgs
public int getNumArgs() -
toTerm
-
equals
-
hashCode
-
toString
-
compareTo
Ordered on name or, if names identical, number of arguments.- Specified by:
compareToin interfaceComparable<PredicateKey>
-