public final class ListUtils extends Object
List
,
ListFactory
,
TermUtils
Modifier and Type | Method and Description |
---|---|
static boolean |
isMember(Term element,
Term list)
Checks is a term can be unified with at least one element of a list.
|
static List<Term> |
toJavaUtilList(Term list)
Returns a new
java.util.List containing the contents of the specified org.projog.core.term.List . |
static List<Term> |
toSortedJavaUtilList(Term unsorted)
Returns a new
java.util.List containing the sorted contents of the specified
org.projog.core.term.List . |
public static List<Term> toJavaUtilList(Term list)
java.util.List
containing the contents of the specified org.projog.core.term.List
.
Will return null
if list
is neither of type TermType.LIST
or TermType.EMPTY_LIST
,
or if list
represents a partial list (i.e. a list that does not have an empty list as its tail).
toSortedJavaUtilList(Term)
public static List<Term> toSortedJavaUtilList(Term unsorted)
java.util.List
containing the sorted contents of the specified
org.projog.core.term.List
.
The elements in the returned list will be ordered using the standard ordering of terms, as implemented by
TermComparator
.
Will return null
if list
is neither of type TermType.LIST
or TermType.EMPTY_LIST
,
or if list
represents a partial list (i.e. a list that does not have an empty list as its tail).
toJavaUtilList(Term)
public static boolean isMember(Term element, Term list)
Iterates through each element of list
attempting to unify with element
. Returns true
immediately after the first unifiable element is found. If list
contains no elements that can be unified
with element
then false
is returned.
ProjogException
- if list
is not of type TermType#LIST
or TermType#EMPTY_LIST
Copyright © 2024. All rights reserved.