Class PrologTerm

    • Field Detail

      • quotation

        protected final Quotation quotation
      • text

        protected final String text
    • Constructor Detail

      • PrologTerm

        public PrologTerm​(String text,
                          Quotation quotation,
                          int line,
                          int pos)
    • Method Detail

      • findQuotation

        public static Quotation findQuotation​(String atomText)
        Find appropriate quotation for text.
        Parameters:
        atomText - text, must not be null
        Returns:
        founded quotation
      • assertNonEmptyString

        protected static String assertNonEmptyString​(String str)
      • flatComma

        public List<PrologTerm> flatComma​(List<PrologTerm> list)
        Flat content of the term for comma, make sense for structures.
        Parameters:
        list - list to be filled by comma separated terms
        Returns:
        the same list
      • getArity

        public int getArity()
        Arity of element.
        Returns:
        arity of element, make sense for compound terms, for primitive terms is 1
      • isAnyBlock

        public boolean isAnyBlock()
        Check the term describes '()' or '{}' block.
        Returns:
        true if the term is structure describes any kind of supported block
        Since:
        2.0.1
      • isBlock

        public boolean isBlock()
        Check the term describes '()' block.
        Returns:
        true if the term is structure with '()' as functor
      • isCurlyBlock

        public boolean isCurlyBlock()
        Check the term describes '{}' block.
        Returns:
        true if the term is structure with '{}' as functor
      • getQuotation

        public Quotation getQuotation()
        Get quotation for the term.
        Returns:
        the quotation for the term, must not be null
      • getPos

        public final int getPos()
        Position of the term in the line, first position is 1
        Returns:
        position in line or -1 if unknown
      • setPos

        public final void setPos​(int pos)
      • getLine

        public final int getLine()
        Line of the term, first line is 1
        Returns:
        line or -1 if unknown
      • setLine

        public final void setLine​(int line)
      • getText

        public String getText()
        Get the term text.
        Returns:
        the term text, must not be null
      • getPrecedence

        public int getPrecedence()
        Get precedence of the term.
        Returns:
        precedence, must not be negative
      • getType

        public abstract TermType getType()
        Get term type.
        Returns:
        term type, must not be null
      • getFunctor

        public PrologTerm getFunctor()
        Get the functor, make sense of structure and its successors, for primitive returns the same term.
        Returns:
        functor for structure or the same term