com.ugos.JIProlog.client
Class JIPClient

java.lang.Object
  |
  +--com.ugos.JIProlog.client.JIPClient

public class JIPClient
extends java.lang.Object

JIPClient implements the methods to talk with JIProlog server.
For more information see the section "How to call JIProlog Server" in the Reference Manual

Version:
2.0
Author:
Ugo Chirico 2003
Home Page: http://www.ugosweb.com/jiprolog
See Also:
JIPSolution

Field Summary
static int DEFAUL_PORT
           
 
Constructor Summary
JIPClient(java.net.InetAddress inetAdd)
          Creates a new JIProlog client object and connect it to the specified host on the default port number.
JIPClient(java.net.InetAddress inetAdd, int nPort)
          Creates a new JIProlog client object and connect it to the specified host on the given port number.
JIPClient(java.lang.String strHost)
          Creates a new JIProlog client object and connect it to the specified host on the default port number.
JIPClient(java.lang.String strHost, int nPort)
          Creates a new JIProlog client object and connect it to the specified host on the given port number.
 
Method Summary
 void closeQuery()
          Closes the previously opened query.
 void leave()
          Leaves the connection to JIProlog server.
 JIPSolution nextSolution()
          Returns next solution related to the previously opened query.
 void openQuery(java.lang.String strQuery)
          Opens a query with JIProlog server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAUL_PORT

public static final int DEFAUL_PORT
See Also:
Constant Field Values
Constructor Detail

JIPClient

public JIPClient(java.lang.String strHost)
          throws java.io.IOException
Creates a new JIProlog client object and connect it to the specified host on the default port number.

Parameters:
strHost - Host where JIProlog server is running.
Throws:
java.io.IOException

JIPClient

public JIPClient(java.net.InetAddress inetAdd)
          throws java.io.IOException
Creates a new JIProlog client object and connect it to the specified host on the default port number.

Parameters:
inetAdd - InetAddress of the host where JIProlog server is running.
Throws:
java.io.IOException

JIPClient

public JIPClient(java.lang.String strHost,
                 int nPort)
          throws java.io.IOException
Creates a new JIProlog client object and connect it to the specified host on the given port number.

Parameters:
strHost - Host where JIProlog server is running.
nPort - Port number.
Throws:
java.io.IOException

JIPClient

public JIPClient(java.net.InetAddress inetAdd,
                 int nPort)
          throws java.io.IOException
Creates a new JIProlog client object and connect it to the specified host on the given port number.

Parameters:
inetAdd - InetAddress of the host where JIProlog server is running.
nPort - Port number.
Throws:
java.io.IOException
Method Detail

openQuery

public final void openQuery(java.lang.String strQuery)
                     throws java.io.IOException,
                            JIPServerException
Opens a query with JIProlog server. Raises JIPServerException if JIProlog server returns an error.

Parameters:
strQuery - The query.
Throws:
java.io.IOException
JIPServerException
See Also:
nextSolution(), closeQuery()

nextSolution

public final JIPSolution nextSolution()
                               throws java.io.IOException,
                                      JIPServerException
Returns next solution related to the previously opened query. Raises JIPServerException if JIProlog server returns an error.

Returns:
JIPSolution object containing the information about the solution returned.
Throws:
java.io.IOException
JIPServerException
See Also:
JIPSolution, openQuery(java.lang.String), closeQuery()

closeQuery

public final void closeQuery()
                      throws java.io.IOException,
                             JIPServerException
Closes the previously opened query. Raises JIPServerException if JIProlog server returns an error.

Throws:
java.io.IOException
JIPServerException
See Also:
openQuery(java.lang.String), nextSolution()

leave

public void leave()
           throws java.io.IOException
Leaves the connection to JIProlog server. After that other queries are not permetted.

Throws:
java.io.IOException
See Also:
openQuery(java.lang.String), nextSolution(), closeQuery()