com.ugos.JIProlog.engine
Class JIPList

java.lang.Object
  |
  +--com.ugos.JIProlog.engine.JIPTerm
        |
        +--com.ugos.JIProlog.engine.JIPList
All Implemented Interfaces:
com.ugos.JIProlog.engine.Clearable, java.lang.Cloneable, java.io.Serializable

public class JIPList
extends JIPTerm

JIPList wraps a prolog list

Version:
2.0
Author:
Ugo Chirico 2002
Home Page: http://www.ugosweb.com/jiprolog
See Also:
JIPTerm, Serialized Form

Field Summary
static JIPList NIL
          Empty list or nil []
 
Method Summary
static JIPList append(JIPList head, JIPList tail)
          Returns a new JIPList object by appending list2 to list1
static JIPList create(JIPTerm head, JIPTerm tail)
          Creates a new List
 JIPTerm getHead()
          Returns the head of this JIPList object
 JIPTerm getNth(int n)
          Returns the nth term in this list.
 JIPTerm getTail()
          Returns the tail of this JIPList object
 boolean isNIL()
          Returns true if this list is [].
 JIPList reverse()
          Returns a new JIPList object by reversing this JIPList object
 
Methods inherited from class com.ugos.JIProlog.engine.JIPTerm
clear, clone, getVariables, getVariablesTable, toString, toString, toStringq, unifiable, unify
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NIL

public static final JIPList NIL
Empty list or nil []

Method Detail

create

public static final JIPList create(JIPTerm head,
                                   JIPTerm tail)
Creates a new List

Parameters:
head - the head of the List
tail - the tail the List
Returns:
new JIPList object
See Also:
JIPTerm

append

public static final JIPList append(JIPList head,
                                   JIPList tail)
Returns a new JIPList object by appending list2 to list1

Parameters:
head - the list1 of the first list
tail - the list2 the second list
Returns:
new JIPList object by appending list1 and list2

reverse

public final JIPList reverse()
Returns a new JIPList object by reversing this JIPList object

Returns:
new JIPList object by reversing this JIPList object

getHead

public final JIPTerm getHead()
Returns the head of this JIPList object

Returns:
head of this JIPList
See Also:
JIPTerm

getTail

public final JIPTerm getTail()
Returns the tail of this JIPList object

Returns:
tail of this JIPList object

getNth

public final JIPTerm getNth(int n)
Returns the nth term in this list.
Raises ArrayIndexOutOfBound if the parameter is out of bound

Parameters:
n - index ot the term to extract
Returns:
the nth term in this list.
See Also:
JIPTerm

isNIL

public final boolean isNIL()
Returns true if this list is [].