edu.uci.ics.jung.algorithms.util
Class Indexer

java.lang.Object
  extended by edu.uci.ics.jung.algorithms.util.Indexer

public class Indexer
extends Object

A class providing static methods useful for improving the performance of graph algorithms.

Author:
Tom Nelson

Constructor Summary
Indexer()
           
 
Method Summary
static
<T> org.apache.commons.collections15.BidiMap<T,Integer>
create(Collection<T> collection)
          Returns a BidiMap mapping each element of the collection to its index as encountered while iterating over the collection.
static
<T> org.apache.commons.collections15.BidiMap<T,Integer>
create(Collection<T> collection, int start)
          Returns a BidiMap mapping each element of the collection to its index as encountered while iterating over the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Indexer

public Indexer()
Method Detail

create

public static <T> org.apache.commons.collections15.BidiMap<T,Integer> create(Collection<T> collection)
Returns a BidiMap mapping each element of the collection to its index as encountered while iterating over the collection. The purpose of the index operation is to supply an O(1) replacement operation for the O(n) indexOf(element) method of a List

Type Parameters:
T -
Parameters:
collection -
Returns:
a bidirectional map from collection elements to 0-based indices

create

public static <T> org.apache.commons.collections15.BidiMap<T,Integer> create(Collection<T> collection,
                                                                             int start)
Returns a BidiMap mapping each element of the collection to its index as encountered while iterating over the collection. The purpose of the index operation is to supply an O(1) replacement operation for the O(n) indexOf(element) method of a List

Type Parameters:
T -
Parameters:
collection -
start - start index
Returns:
a bidirectional map from collection elements to start-based indices


Copyright © 2009. All Rights Reserved.