Class ListFactory


  • public final class ListFactory
    extends java.lang.Object
    Static factory methods for creating new instances of List.
    See Also:
    List, ListUtils
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String LIST_PREDICATE_NAME
      A "." is the functor name for all lists in Prolog.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ListFactory()
      Private constructor as all methods are static.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Term createList​(java.util.Collection<? extends Term> terms)
      Returns a new List with the specified terms and a empty list as the final tail element.
      static Term createList​(Term[] terms)
      Returns a new List with the specified terms and a empty list as the final tail element.
      static Term createList​(Term[] terms, Term tail)
      Returns a new List with the specified terms and the second parameter as the tail element.
      static List createList​(Term head, Term tail)
      Returns a new List with specified head and tail.
      static Term createListOfLength​(int length)
      Returns a new list of the specified length where is each element is a variable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LIST_PREDICATE_NAME

        public static final java.lang.String LIST_PREDICATE_NAME
        A "." is the functor name for all lists in Prolog.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ListFactory

        private ListFactory()
        Private constructor as all methods are static.
    • Method Detail

      • createList

        public static List createList​(Term head,
                                      Term tail)
        Returns a new List with specified head and tail.
        Parameters:
        head - the first argument in the list
        tail - the second argument in the list
        Returns:
        a new List with specified head and tail
      • createList

        public static Term createList​(java.util.Collection<? extends Term> terms)
        Returns a new List with the specified terms and a empty list as the final tail element.
        Parameters:
        terms - contents of the list
        Returns:
        a new List with the specified terms and a empty list as the final tail element
      • createList

        public static Term createList​(Term[] terms)
        Returns a new List with the specified terms and a empty list as the final tail element.

        By having a List with a List as its tail it is possible to represent an ordered sequence of the specified terms.

        Parameters:
        terms - contents of the list
        Returns:
        a new List with the specified terms and a empty list as the final tail element
      • createList

        public static Term createList​(Term[] terms,
                                      Term tail)
        Returns a new List with the specified terms and the second parameter as the tail element.

        By having a List with a List as its tail it is possible to represent an ordered sequence of the specified terms.

        Parameters:
        terms - contents of the list
        Returns:
        a new List with the specified terms and the second parameter as the tail element
      • createListOfLength

        public static Term createListOfLength​(int length)
        Returns a new list of the specified length where is each element is a variable.