Package org.prolog4j

Class Compound

  • All Implemented Interfaces:
    Serializable

    public class Compound
    extends Object
    implements Serializable
    Represents a Prolog compound term. Prolog compound terms for which no default way of conversion exists will be converted to a Compound object.
    See Also:
    Serialized Form
    • Constructor Detail

      • Compound

        public Compound​(String functor,
                        Object... args)
        Constructs a compound term. A compound term must have at least one argument. Please note, that the array is not cloned.
        Parameters:
        functor - the functor of the compound term
        args - the arguments of the compound term
    • Method Detail

      • getFunctor

        public String getFunctor()
        Returns the functor of the compound term.
        Returns:
        the functor of the compound term
      • getArity

        public int getArity()
        Returns the arity (the number of arguments) of the compound term.
        Returns:
        the arity of the compound term
      • getArgs

        public Object[] getArgs()
        Returns the arguments of the compound term.
        Returns:
        the arguments of the compound term
      • getArg

        public Object getArg​(int index)
        Returns the index-th argument of the compound term. Numbering starts from 0.
        Parameters:
        index - the number of the required argument
        Returns:
        the index-th argument of the compound term
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object