com.svincent.moksa
Class CompoundTerm.ListWrapper

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--com.svincent.moksa.CompoundTerm.ListWrapper
All Implemented Interfaces:
java.util.Collection, java.util.List
Enclosing class:
CompoundTerm

public static class CompoundTerm.ListWrapper
extends java.util.AbstractList

A wrapper for a CompoundTerm as a list.

There is a caveat: since Prolog can have lists like this: [term, term, term | term], this list implementation ignores the last term (as it is not part of the list proper). If you want to see it, use the prologIterator method to get a PrologIterator, which will provide you with this information.


Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CompoundTerm.ListWrapper(CompoundTerm _compoundTerm)
           
 
Method Summary
 PrologTerm findUnifiable(PrologTerm key)
          Finds the first term in this list which can unify (without variable binding) with the given key.
 java.lang.Object get(int index)
          Part of java.util.List implementation.
 java.lang.String getOption(PrologTerm key)
           
 java.util.Iterator iterator()
          Part of java.util.List implementation.
 CompoundTerm.PrologIterator prologIterator()
           
 int size()
          Part of java.util.List implementation.
 java.lang.String tag()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompoundTerm.ListWrapper

public CompoundTerm.ListWrapper(CompoundTerm _compoundTerm)
Method Detail

prologIterator

public CompoundTerm.PrologIterator prologIterator()

findUnifiable

public PrologTerm findUnifiable(PrologTerm key)

Finds the first term in this list which can unify (without variable binding) with the given key.

For example, in the list:

[foo(3), bar (4)]

findUnifiable (bar (X)) would result in bar(4)

If no such term is found, null is returned.


getOption

public java.lang.String getOption(PrologTerm key)

iterator

public java.util.Iterator iterator()
Part of java.util.List implementation. Return an iterator over the elements of this list.
Overrides:
iterator in class java.util.AbstractList

get

public java.lang.Object get(int index)
Part of java.util.List implementation. Return the element of this list at the specified index.
Overrides:
get in class java.util.AbstractList

size

public int size()
Part of java.util.List implementation. Return the size of this list.
Overrides:
size in class java.util.AbstractCollection

tag

public java.lang.String tag()



This is documentation for Moksa Prolog, which can be found at http://www.svincent.com/moksa/

Copyright © 1999 Shawn P. Vincent.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.