Class PrologList

    • Field Detail

      • LIST_FUNCTOR

        public static final PrologTerm LIST_FUNCTOR
      • EMPTY_ANONYMOUS_VAR

        private static final PrologVar EMPTY_ANONYMOUS_VAR
    • Constructor Detail

      • PrologList

        public PrologList()
      • PrologList

        public PrologList​(int line,
                          int pos)
      • PrologList

        public PrologList​(PrologTerm[] array)
      • PrologList

        public PrologList​(PrologTerm[] array,
                          int line,
                          int pos)
      • PrologList

        public PrologList​(PrologTerm head)
      • PrologList

        public PrologList​(PrologTerm head,
                          int line,
                          int pos)
    • Method Detail

      • getTermAt

        public PrologTerm getTermAt​(int index)
        Description copied from class: PrologCompound
        Get element for its position
        Overrides:
        getTermAt in class PrologStruct
        Parameters:
        index - zero-based element position
        Returns:
        element in position
      • isEmpty

        public boolean isEmpty()
        Description copied from class: PrologStruct
        Check that the structure has elements.
        Overrides:
        isEmpty in class PrologStruct
        Returns:
        true if there is not elements, false otherwise
      • getHead

        public PrologTerm getHead()
        Get the current head element of the list.
        Returns:
        the head element, can be null
      • setHead

        public void setHead​(PrologTerm term)
        Replace the head element.
        Parameters:
        term - the new head term, can be null
      • getTail

        public PrologTerm getTail()
        Get the current tail element
        Returns:
        the current tail element, can be null
      • setTail

        public void setTail​(PrologTerm term)
        Set the current tail element
        Parameters:
        term - the new tail element, can be null
      • addAsNewListToEndOfListChain

        public PrologList addAsNewListToEndOfListChain​(PrologTerm term)
        Add term as new list into the end of the list chain.
        Parameters:
        term - to be added as new list in the end of chain
        Returns:
        generated list (may be this)
      • replaceEndListElement

        public void replaceEndListElement​(PrologTerm newTailElement)
        Replace last tail element in list chain.
        Parameters:
        newTailElement - new element
      • getArity

        public int getArity()
        Description copied from class: PrologTerm
        Arity of element.
        Overrides:
        getArity in class PrologStruct
        Returns:
        arity of element, make sense for compound terms, for primitive terms is 1
      • setElementAt

        public void setElementAt​(int index,
                                 PrologTerm term)
        Description copied from class: PrologStruct
        Set element for its position.
        Overrides:
        setElementAt in class PrologStruct
        Parameters:
        index - zero based index
        term - term to set to position