Package org.projog.core.term
Class ListFactory
- java.lang.Object
-
- org.projog.core.term.ListFactory
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLIST_PREDICATE_NAMEA "." is the functor name for all lists in Prolog.
-
Constructor Summary
Constructors Modifier Constructor Description privateListFactory()Private constructor as all methods are static.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TermcreateList(java.util.Collection<? extends Term> terms)Returns a newListwith the specified terms and a empty list as the final tail element.static TermcreateList(Term[] terms)Returns a newListwith the specified terms and a empty list as the final tail element.static TermcreateList(Term[] terms, Term tail)Returns a newListwith the specified terms and the second parameter as the tail element.static ListcreateList(Term head, Term tail)Returns a newListwith specified head and tail.static TermcreateListOfLength(int length)Returns a new list of the specified length where is each element is a variable.
-
-
-
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
-
-
Method Detail
-
createList
public static List createList(Term head, Term tail)
Returns a newListwith specified head and tail.- Parameters:
head- the first argument in the listtail- the second argument in the list- Returns:
- a new
Listwith specified head and tail
-
createList
public static Term createList(java.util.Collection<? extends Term> terms)
Returns a newListwith the specified terms and a empty list as the final tail element.- Parameters:
terms- contents of the list- Returns:
- a new
Listwith the specified terms and a empty list as the final tail element
-
createList
public static Term createList(Term[] terms)
Returns a newListwith the specified terms and a empty list as the final tail element.By having a
Listwith aListas its tail it is possible to represent an ordered sequence of the specified terms.- Parameters:
terms- contents of the list- Returns:
- a new
Listwith the specified terms and a empty list as the final tail element
-
createList
public static Term createList(Term[] terms, Term tail)
Returns a newListwith the specified terms and the second parameter as the tail element.By having a
Listwith aListas its tail it is possible to represent an ordered sequence of the specified terms.- Parameters:
terms- contents of the list- Returns:
- a new
Listwith 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.
-
-