Description: Fix incompatibilities between collections15 and collection4
Author: Michael R. Crusoe <mcrusoe@msu.edu>
Forwarded: no
Last-Updated: 2015-02-21

Inspired by
http://sources.debian.net/data/main/g/geogebra/4.0.34.0+dfsg1-3/debian/patches/use-apache-commons-collections.patch

References include http://commons.apache.org/proper/commons-collections/javadocs/api-release/index.html
and http://commons.apache.org/proper/commons-collections/release_4_0.html

--- a/jung-algorithms-2.0.1-sources/edu/uci/ics/jung/algorithms/scoring/PageRank.java
+++ b/jung-algorithms-2.0.1-sources/edu/uci/ics/jung/algorithms/scoring/PageRank.java
@@ -52,7 +52,7 @@
      * @param edge_weight the edge weights (transition probabilities)
      * @param alpha the probability of taking a random jump to an arbitrary vertex
      */
-    public PageRank(Hypergraph<V,E> graph, Transformer<E, ? extends Number> edge_weight, double alpha)
+    public PageRank(Hypergraph<V,E> graph, Transformer/*<E, ? extends Number>*/ edge_weight, double alpha)
     {
         super(graph, edge_weight, ScoringUtils.getUniformRootPrior(graph.getVertices()), alpha);
     }
--- a/jung-algorithms-2.0.1-sources/edu/uci/ics/jung/algorithms/shortestpath/DijkstraDistance.java
+++ b/jung-algorithms-2.0.1-sources/edu/uci/ics/jung/algorithms/shortestpath/DijkstraDistance.java
@@ -65,7 +65,7 @@
 public class DijkstraDistance<V,E> implements Distance<V>
 {
     protected Hypergraph<V,E> g;
-    protected Transformer<E,? extends Number> nev;
+    protected Transformer/*<E,? extends Number> */ nev;
     protected Map<V,SourceData> sourceMap;   // a map of source vertices to an instance of SourceData
     protected boolean cached;
     protected double max_distance;
@@ -81,7 +81,7 @@
      * @param nev   the class responsible for returning weights for edges
      * @param cached    specifies whether the results are to be cached
      */
-    public DijkstraDistance(Hypergraph<V,E> g, Transformer<E,? extends Number> nev, boolean cached) {
+    public DijkstraDistance(Hypergraph<V,E> g, Transformer/*<E,? extends Number>*/ nev, boolean cached) {
         this.g = g;
         this.nev = nev;
         this.sourceMap = new HashMap<V,SourceData>();
@@ -98,7 +98,7 @@
      * @param g     the graph on which distances will be calculated
      * @param nev   the class responsible for returning weights for edges
      */
-    public DijkstraDistance(Hypergraph<V,E> g, Transformer<E,? extends Number> nev) {
+    public DijkstraDistance(Hypergraph<V,E> g, Transformer/*<E,? extends Number> */ nev) {
         this(g, nev, true);
     }
     
@@ -198,7 +198,7 @@
                 {
                     if (!sd.distances.containsKey(w))
                     {
-                        double edge_weight = nev.transform(e).doubleValue();
+                        double edge_weight = ((Number) nev.transform(e)).doubleValue();
                         if (edge_weight < 0)
                             throw new IllegalArgumentException("Edges weights must be non-negative");
                         double new_dist = v_dist + edge_weight;
--- a/jung-algorithms-2.0.1-sources/edu/uci/ics/jung/algorithms/layout/AbstractLayout.java
+++ b/jung-algorithms-2.0.1-sources/edu/uci/ics/jung/algorithms/layout/AbstractLayout.java
@@ -69,9 +69,9 @@
 	}
 	
     @SuppressWarnings("unchecked")
-    protected AbstractLayout(Graph<V,E> graph, Transformer<V,Point2D> initializer) {
+    protected AbstractLayout(Graph<V,E> graph, Transformer/*<V,Point2D>*/ initializer) {
 		this.graph = graph;
-		Transformer<V, ? extends Object> chain = 
+		Transformer/*<V, ? extends Object>*/ chain = 
 			ChainedTransformer.chainedTransformer(initializer, CloneTransformer.cloneTransformer());
 		this.locations = LazyMap.lazyMap(new HashMap<V,Point2D>(), (Transformer<V,Point2D>)chain);
 		initialized = true;
@@ -83,9 +83,9 @@
 	}
 	
 	@SuppressWarnings("unchecked")
-    protected AbstractLayout(Graph<V,E> graph, Transformer<V,Point2D> initializer, Dimension size) {
+    protected AbstractLayout(Graph<V,E> graph, Transformer/*<V,Point2D>*/ initializer, Dimension size) {
 		this.graph = graph;
-		Transformer<V, ? extends Object> chain = 
+		Transformer/*<V, ? extends Object>*/ chain = 
 			ChainedTransformer.chainedTransformer(initializer, CloneTransformer.cloneTransformer());
 		this.locations = LazyMap.lazyMap(new HashMap<V,Point2D>(), (Transformer<V,Point2D>)chain);
 		this.size = size;
@@ -139,11 +139,11 @@
     }
     
     @SuppressWarnings("unchecked")
-    public void setInitializer(Transformer<V,Point2D> initializer) {
+    public void setInitializer(Transformer/*<V,Point2D>*/ initializer) {
     	if(this.equals(initializer)) {
     		throw new IllegalArgumentException("Layout cannot be initialized with itself");
     	}
-		Transformer<V, ? extends Object> chain = 
+		Transformer/*<V, ? extends Object>*/ chain = 
 			ChainedTransformer.chainedTransformer(initializer, CloneTransformer.cloneTransformer());
     	this.locations = LazyMap.lazyMap(new HashMap<V,Point2D>(), (Transformer<V, Point2D>)chain);
     	initialized = true;
--- a/jung-algorithms-2.0.1-sources/edu/uci/ics/jung/algorithms/shortestpath/MinimumSpanningForest2.java
+++ b/jung-algorithms-2.0.1-sources/edu/uci/ics/jung/algorithms/shortestpath/MinimumSpanningForest2.java
@@ -28,8 +28,8 @@
 	
 	protected Graph<V,E> graph;
 	protected Forest<V,E> forest;
-	protected Transformer<E,Double> weights = 
-		(Transformer<E,Double>)new ConstantTransformer<Double>(1.0);
+	protected Transformer/*<E,Double>*/ weights = 
+		ConstantTransformer.constantTransformer(1.0);
 	
 	/**
 	 * create a Forest from the supplied Graph and supplied Factory, which
--- a/jung-visualization-2.0.1-sources/edu/uci/ics/jung/visualization/layout/CachingLayout.java
+++ b/jung-visualization-2.0.1-sources/edu/uci/ics/jung/visualization/layout/CachingLayout.java
@@ -39,8 +39,8 @@
 
     public CachingLayout(Layout<V, E> delegate) {
     	super(delegate);
-    	this.locationMap = LazyMap.<V,Point2D>decorate(new HashMap<V,Point2D>(), 
-    			new ChainedTransformer<V, Point2D>(new Transformer[]{delegate, CloneTransformer.cloneTransformer()}));
+    	this.locationMap = LazyMap.lazyMap(new HashMap<V,Point2D>(), 
+    			ChainedTransformer.chainedTransformer(new Transformer[]{delegate, CloneTransformer.cloneTransformer()}));
     }
     
     @Override
--- a/jung-visualization-2.0.1-sources/edu/uci/ics/jung/visualization/layout/ObservableCachingLayout.java
+++ b/jung-visualization-2.0.1-sources/edu/uci/ics/jung/visualization/layout/ObservableCachingLayout.java
@@ -47,8 +47,8 @@
 
     public ObservableCachingLayout(Layout<V, E> delegate) {
     	super(delegate);
-    	this.locationMap = LazyMap.<V,Point2D>decorate(new HashMap<V,Point2D>(), 
-    			new ChainedTransformer<V, Point2D>(new Transformer[]{delegate, CloneTransformer.cloneTransformer()}));
+    	this.locationMap = LazyMap.lazyMap(new HashMap<V,Point2D>(), 
+    			ChainedTransformer.chainedTransformer(new Transformer[]{delegate, CloneTransformer.cloneTransformer()}));
     }
     
     /**
--- a/jung-samples-2.0.1-sources/edu/uci/ics/jung/samples/ClusteringDemo.java
+++ b/jung-samples-2.0.1-sources/edu/uci/ics/jung/samples/ClusteringDemo.java
@@ -80,10 +80,10 @@
 //	Factory<Graph<Number,Number>> graphFactory;
 	
 	Map<Number,Paint> vertexPaints = 
-		LazyMap.<Number,Paint>decorate(new HashMap<Number,Paint>(),
+		LazyMap.lazyMap(new HashMap<Number,Paint>(),
 				new ConstantTransformer(Color.white));
 	Map<Number,Paint> edgePaints =
-	LazyMap.<Number,Paint>decorate(new HashMap<Number,Paint>(),
+	LazyMap.lazyMap(new HashMap<Number,Paint>(),
 			new ConstantTransformer(Color.blue));
 
 	public final Color[] similarColors =
@@ -154,7 +154,7 @@
 		vv = new VisualizationViewer<Number,Number>(layout);
 		vv.setBackground( Color.white );
 		//Tell the renderer to use our own customized color rendering
-		vv.getRenderContext().setVertexFillPaintTransformer(MapTransformer.<Number,Paint>getInstance(vertexPaints));
+		vv.getRenderContext().setVertexFillPaintTransformer(MapTransformer.mapTransformer(vertexPaints));
 		vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Number,Paint>() {
 			public Paint transform(Number v) {
 				if(vv.getPickedVertexState().isPicked(v)) {
@@ -165,7 +165,7 @@
 			}
 		});
 
-		vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number,Paint>getInstance(edgePaints));
+		vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.mapTransformer(edgePaints));
 
 		vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number,Stroke>() {
                 protected final Stroke THIN = new BasicStroke(1);
--- a/jung-samples-2.0.1-sources/edu/uci/ics/jung/samples/VertexLabelAsShapeDemo.java
+++ b/jung-samples-2.0.1-sources/edu/uci/ics/jung/samples/VertexLabelAsShapeDemo.java
@@ -90,7 +90,7 @@
         vv.getRenderContext().setVertexLabelTransformer(
         		// this chains together Transformers so that the html tags
         		// are prepended to the toString method output
-        		new ChainedTransformer<String,String>(new Transformer[]{
+        		ChainedTransformer.chainedTransformer(new Transformer[]{
         		new ToStringLabeller<String>(),
         		new Transformer<String,String>() {
 					public String transform(String input) {
--- a/jung-samples-2.0.1-sources/edu/uci/ics/jung/samples/GraphEditorDemo.java
+++ b/jung-samples-2.0.1-sources/edu/uci/ics/jung/samples/GraphEditorDemo.java
@@ -146,11 +146,11 @@
         vv =  new VisualizationViewer<Number,Number>(layout);
         vv.setBackground(Color.white);
 
-        vv.getRenderContext().setVertexLabelTransformer(MapTransformer.<Number,String>getInstance(
-        		LazyMap.<Number,String>decorate(new HashMap<Number,String>(), new ToStringLabeller<Number>())));
+        vv.getRenderContext().setVertexLabelTransformer(MapTransformer.mapTransformer(
+        		LazyMap.lazyMap(new HashMap<Number,String>(), new ToStringLabeller<Number>())));
         
-        vv.getRenderContext().setEdgeLabelTransformer(MapTransformer.<Number,String>getInstance(
-        		LazyMap.<Number,String>decorate(new HashMap<Number,String>(), new ToStringLabeller<Number>())));
+        vv.getRenderContext().setEdgeLabelTransformer(MapTransformer.mapTransformer(
+        		LazyMap.lazyMap(new HashMap<Number,String>(), new ToStringLabeller<Number>())));
 
         vv.setVertexToolTipTransformer(vv.getRenderContext().getVertexLabelTransformer());
         
