public final class Util
extends java.lang.Object
Copyright (C) 1998 Fred Dushin
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library Public License for more details.
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
atomListToStringArray(Term t) |
static Term |
intArrayArrayToList(int[][] a)
Converts an array of arrays of int to a corresponding JPL list of lists
|
static Term |
intArrayToList(int[] a)
Converts an array of int to a corresponding JPL list
|
static int |
listToLength(Term t) |
static Term[] |
listToTermArray(Term t)
converts a proper list to an array of terms, else throws an exception
|
static java.util.Map<term_t,Variable> |
namevarsToMap(Term nvs)
Converts a (JPL) list of Name=Var pairs (as yielded by atom_to_term/3) to a Map from Prolog variables (necessarily in term_t holders) to named JPL Variables
|
static Term |
stringArrayToList(java.lang.String[] a)
Converts an array of String to a corresponding JPL list
|
static Term |
termArrayToList(Term[] terms)
Converts an array of Terms to a JPL representation of a Prolog list of terms whose members correspond to the respective array elements.
|
static Term |
textParamsToTerm(java.lang.String text,
Term[] params)
Converts a Prolog source text to a corresponding JPL Term (in which each Variable has the appropriate name from the source text), replacing successive occurrences of ?
|
static Term |
textToTerm(java.lang.String text)
Converts a Prolog source text to a corresponding JPL Term (in which each Variable has the appropriate name from the source text).
|
static java.lang.String |
toString(java.util.Map<java.lang.String,Term> varnames_to_Terms)
Converts a substitution, in the form of a Map from variable names to Terms, to a String.
|
public static Term termArrayToList(Term[] terms)
terms
- An array of Termpublic static java.lang.String toString(java.util.Map<java.lang.String,Term> varnames_to_Terms)
varnames_to_Terms
- A Map from variable names to Terms.public static java.util.Map<term_t,Variable> namevarsToMap(Term nvs)
nvs
- A JPL list of Name=Var pairs (as yielded by atom_to_term/3)public static Term textToTerm(java.lang.String text)
text
- A Prolog source text denoting a termpublic static Term textParamsToTerm(java.lang.String text, Term[] params)
text
- A Prolog source text denoting a termpublic static Term stringArrayToList(java.lang.String[] a)
a
- An array of String objectspublic static Term intArrayToList(int[] a)
a
- An array of int valuespublic static Term intArrayArrayToList(int[][] a)
a
- An array of arrays of int valuespublic static int listToLength(Term t)
public static Term[] listToTermArray(Term t)
JPLException
public static java.lang.String[] atomListToStringArray(Term t)