Class ListUtils
java.lang.Object
org.projog.core.term.ListUtils
Helper methods for performing common tasks with Prolog list data structures.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanChecks is a term can be unified with at least one element of a list.toJavaUtilList(Term list) Returns a newjava.util.Listcontaining the contents of the specifiedorg.projog.core.term.List.toSortedJavaUtilList(Term unsorted) Returns a newjava.util.Listcontaining the sorted contents of the specifiedorg.projog.core.term.List.
-
Method Details
-
toJavaUtilList
Returns a newjava.util.Listcontaining the contents of the specifiedorg.projog.core.term.List.Will return
nulliflistis neither of typeTermType.LISTorTermType.EMPTY_LIST, or iflistrepresents a partial list (i.e. a list that does not have an empty list as its tail).- See Also:
-
toSortedJavaUtilList
Returns a newjava.util.Listcontaining the sorted contents of the specifiedorg.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
nulliflistis neither of typeTermType.LISTorTermType.EMPTY_LIST, or iflistrepresents a partial list (i.e. a list that does not have an empty list as its tail).- See Also:
-
isMember
Checks is a term can be unified with at least one element of a list.Iterates through each element of
listattempting to unify withelement. Returnstrueimmediately after the first unifiable element is found. Iflistcontains no elements that can be unified withelementthenfalseis returned.- Throws:
ProjogException- iflistis not of typeTermType#LISTorTermType#EMPTY_LIST
-