File: use-apache-commons-collections

package info (click to toggle)
libjung-free-java 2.0.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,172 kB
  • sloc: makefile: 30
file content (201 lines) | stat: -rw-r--r-- 10,506 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
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());