jpl::Util Class Reference

List of all members.

Static Public Member Functions

static String[] atomListToStringArray (Term t)
static Term[] bindingsToTermArray (Map varnames_to_Terms)
static Term intArrayArrayToList (int[][] a)
static Term intArrayToList (int[] a)
static int listToLength (Term t)
static Term[] listToTermArray (Term t)
static Map namevarsToMap (Term nvs)
static Term stringArrayToList (String[] a)
static Term termArrayToList (Term[] terms)
static Term textParamsToTerm (String text, Term[] params)
static Term textToTerm (String text)
static String toString (Map varnames_to_Terms)

Detailed Description

This class provides a bunch of static utility methods for the JPL High-Level Interface.


Copyright (C) 2004 Paul Singleton

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.


Author:
Fred Dushin <fadushin@syr.edu>
Version:
$Revision$

Definition at line 56 of file Util.java.


Member Function Documentation

static String [] jpl::Util::atomListToStringArray ( Term  t  )  [inline, static]

Definition at line 260 of file Util.java.

static Term [] jpl::Util::bindingsToTermArray ( Map  varnames_to_Terms  )  [inline, static]

Converts a solution hashtable to an array of Terms.

Parameters:
varnames_to_Terms A Map from variable names to Terms
Returns:
Term[] An array of the Terms to which successive variables are bound

Definition at line 81 of file Util.java.

static Term jpl::Util::intArrayArrayToList ( int  a[][]  )  [inline, static]

Converts an array of arrays of int to a corresponding JPL list of lists

Parameters:
a An array of arrays of int values
Returns:
Term a JPL list of lists corresponding to the given int array of arrays

Definition at line 224 of file Util.java.

static Term jpl::Util::intArrayToList ( int[]  a  )  [inline, static]

Converts an array of int to a corresponding JPL list

Parameters:
a An array of int values
Returns:
Term a JPL list corresponding to the given int array

Definition at line 209 of file Util.java.

static int jpl::Util::listToLength ( Term  t  )  [inline, static]

Definition at line 231 of file Util.java.

static Term [] jpl::Util::listToTermArray ( Term  t  )  [inline, static]

converts a proper list to an array of terms, else throws an exception

Exceptions:
JPLException 
Returns:
an array of terms whose successive elements are the corresponding members of the list (if it is a list)

Definition at line 245 of file Util.java.

static Map jpl::Util::namevarsToMap ( Term  nvs  )  [inline, static]

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

Parameters:
nvs A JPL list of Name=Var pairs (as yielded by atom_to_term/3)
Returns:
Map A Map from Prolog variables (necessarily in term_t holders) to named JPL Variables

Definition at line 122 of file Util.java.

static Term jpl::Util::stringArrayToList ( String[]  a  )  [inline, static]

Converts an array of String to a corresponding JPL list

Parameters:
a An array of String objects
Returns:
Term a JPL list corresponding to the given String array

Definition at line 194 of file Util.java.

static Term jpl::Util::termArrayToList ( Term[]  terms  )  [inline, static]

Converts an array of Terms to a JPL representation of a Prolog list of terms whose members correspond to the respective array elements.

Parameters:
terms An array of Term
Returns:
Term a list of the array elements

Definition at line 66 of file Util.java.

static Term jpl::Util::textParamsToTerm ( String  text,
Term[]  params 
) [inline, static]

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 ? in the text by the corresponding element of Term[] params. (New in JPL 3.0.4)

Throws PrologException containing error(syntax_error(_),_) if text is invalid.

Parameters:
text A Prolog source text denoting a term
Returns:
Term a JPL Term equivalent to the given source text

Definition at line 183 of file Util.java.

static Term jpl::Util::textToTerm ( String  text  )  [inline, static]

Converts a Prolog source text to a corresponding JPL Term (in which each Variable has the appropriate name from the source text). Throws PrologException containing error(syntax_error(_),_) if text is invalid.

Parameters:
text A Prolog source text denoting a term
Returns:
Term a JPL Term equivalent to the given source text

Definition at line 159 of file Util.java.

static String jpl::Util::toString ( Map  varnames_to_Terms  )  [inline, static]

Converts a substitution, in the form of a Map from variable names to Terms, to a String.

Parameters:
varnames_to_Terms A Map from variable names to Terms.
Returns:
String A String representation of the variable bindings

Definition at line 99 of file Util.java.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Defines


jpl
Author(s): Lorenz Moesenlechner
autogenerated on Fri Jan 11 09:40:31 2013