ix.util
Class FanComposer

java.lang.Object
  extended by ix.util.FanComposer

public class FanComposer
extends java.lang.Object

Composes Object-to-Collection mappings ("fans"). A "fan" is just a convenient term for a one-to-many mapping: think of each one-to-many as having a fan-like shape.

The result is not constructed until requested by a call to the getResultMap() method. The "apply" methods just remember the map or graph and invalidate any existing result.

The result is a map made by a call to makeResultMap(), and the values in that map are collections each made by the makeValueCollection() method. In this class, they construct a StableHashMap and a HashSet respectively. Subclasses should override those methods if different classes are desired.


Field Summary
protected  LListCollector allFans
           
protected  java.util.Collection keys
           
protected  java.util.Map result
           
 
Constructor Summary
FanComposer(java.util.Collection keys)
          Construct a FanComposer that will build a map that has the specified keys.
 
Method Summary
 void apply(DirectedGraph g)
           
 void apply(Function1 f)
           
 void apply(java.util.Map m)
           
 java.util.Map getResultMap()
          Return the result as a Map.
protected  java.util.Map makeResultMap()
           
protected  java.util.Collection makeValueCollection()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keys

protected java.util.Collection keys

allFans

protected LListCollector allFans

result

protected java.util.Map result
Constructor Detail

FanComposer

public FanComposer(java.util.Collection keys)
Construct a FanComposer that will build a map that has the specified keys.

Method Detail

apply

public void apply(java.util.Map m)

apply

public void apply(DirectedGraph g)

apply

public void apply(Function1 f)

getResultMap

public java.util.Map getResultMap()
Return the result as a Map.


makeResultMap

protected java.util.Map makeResultMap()

makeValueCollection

protected java.util.Collection makeValueCollection()