com.clarkparsia.pellet.rules.rete
Class Index<S,T>

java.lang.Object
  extended by com.clarkparsia.pellet.rules.rete.Index<S,T>
All Implemented Interfaces:
java.lang.Iterable<T>

public class Index<S,T>
extends java.lang.Object
implements java.lang.Iterable<T>

Title: Index

Description: An indexing structure that associates an object with a list of objects as the key.

Copyright: Copyright (c) 2007

Company: Clark & Parsia, LLC.

Author:
Ron Alford

Constructor Summary
Index()
           
 
Method Summary
 boolean add(java.util.List<S> key, T obj)
          Add an object to the index.
 void clear()
          Remove all nodes from the index.
 java.util.Iterator<T> iterator()
           
<U> java.util.Collection<Pair<T,U>>
join(Index<S,U> index, int shared)
          Return a join of this index to the given index, joining on the first shared variables.
 java.util.Collection<T> match(java.util.List<S> key)
          Return all matches to the key.
 boolean remove(java.util.List<S> key, T obj)
          Remove the element of the index stored under the key 'key'.
 int size()
          Return the number of objects added to the index.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Index

public Index()
Method Detail

add

public boolean add(java.util.List<S> key,
                   T obj)
Add an object to the index.

Parameters:
key - null key positions are counted as wild-cards.
obj -
Returns:

clear

public void clear()
Remove all nodes from the index.


iterator

public java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T>

join

public <U> java.util.Collection<Pair<T,U>> join(Index<S,U> index,
                                                int shared)
Return a join of this index to the given index, joining on the first shared variables.


match

public java.util.Collection<T> match(java.util.List<S> key)
Return all matches to the key. There may be no null values in the key. The returned objects will be stored under keys whose elements are either equal to the corresponding element of the given key or are null.


remove

public boolean remove(java.util.List<S> key,
                      T obj)
Remove the element of the index stored under the key 'key'. Return true if the element exists and was removed. Otherwise, remove false.


size

public int size()
Return the number of objects added to the index.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2004 Evren Sirin. All Rights Reserved.