Skip to content

Commit 0d71d33

Browse files
committed
Change formatter plugin to @diffplug's Spotless plugin
Advantages of Spotless over current solution: - Error messages are (in my opinion) easier to understand. - We can easily adopt other formatters in the future, such as a formatter which checks that files have license headers that follow a certain template.
1 parent eed6692 commit 0d71d33

File tree

55 files changed

+195
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+195
-129
lines changed

Diff for: jung-algorithms/src/main/java/edu/uci/ics/jung/algorithms/generators/Lattice2DGenerator.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public class Lattice2DGenerator<N, E> {
5252
* @param toroidal
5353
*/
5454
public Lattice2DGenerator(int rowCount, int colCount, boolean toroidal) {
55-
// TODO: relax the row/col count restrictions to be >= 3 once we get the random selection mechanism
55+
// TODO: relax the row/col count restrictions to be >= 3 once we get the random selection
56+
// mechanism
5657
// in KleinbergSmallWorld to behave better
5758
Preconditions.checkArgument(rowCount >= 4, "row count must be >= 4");
5859
Preconditions.checkArgument(colCount >= 4, "column count must be >= 4");

Diff for: jung-algorithms/src/main/java/edu/uci/ics/jung/algorithms/generators/random/KleinbergSmallWorld.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
package edu.uci.ics.jung.algorithms.generators.random;
32

43
/*
@@ -110,7 +109,8 @@ public void addSmallWorldConnections(
110109
// without creating parallel edges or self-loops (both are disallowed)
111110
Preconditions.checkArgument(graph.nodes().size() - 5 >= connectionCount);
112111

113-
// TODO: For toroidal graphs, we can make this more clever by pre-creating the WeightedChoice object
112+
// TODO: For toroidal graphs, we can make this more clever by pre-creating the WeightedChoice
113+
// object
114114
// and using the output as an offset to the current node location.
115115

116116
for (N node : graph.nodes()) {
@@ -124,7 +124,8 @@ public void addSmallWorldConnections(
124124
while (targets.size() < connectionCount) {
125125
// the item returned is guaranteed by getWeightedChoiceForDistance() to not be equal to node
126126
// or any of its successors; we may try to add the same node to targets more than once
127-
// (see the note above re: selection w/o replacement) but the Set semantics disallows duplicates
127+
// (see the note above re: selection w/o replacement) but the Set semantics disallows
128+
// duplicates
128129
targets.add(weightedChoice.nextItem());
129130
}
130131

Diff for: jung-algorithms/src/main/java/edu/uci/ics/jung/algorithms/scoring/WeightedNIPaths.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
// TODO: versions for Graph/ValueGraph
4141
// TODO: extend AbstractIterativeScorer and provide for iterating one step (depth) at a time?
4242
// TODO: review this and make sure it's correctly implementing the algorithm
43-
// TODO: this takes in a MutableNetwork and factories as a hack; there's got to be a better way; options include:
43+
// TODO: this takes in a MutableNetwork and factories as a hack; there's got to be a better way;
44+
// options include:
4445
// (1) create a delegate class that pretends that the extra node/edge are there
4546
// (2) refactor the internal logic so that we can emulate the presence of that node/edge
4647
public class WeightedNIPaths<N, E> implements NodeScorer<N, Double> {

Diff for: jung-algorithms/src/main/java/edu/uci/ics/jung/algorithms/shortestpath/DijkstraShortestPath.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ public List<E> getPath(N source, N target) {
152152
Preconditions.checkArgument(
153153
g.nodes().contains(source), "Specified source node %s is not part of graph %s", source, g);
154154

155-
// TODO: Consider replacing this with an `ArrayList` (http://errorprone.info/bugpattern/JdkObsolete)
155+
// TODO: Consider replacing this with an `ArrayList`
156+
// (http://errorprone.info/bugpattern/JdkObsolete)
156157
LinkedList<E> path = new LinkedList<E>();
157158

158159
// collect path data; must use internal method rather than

Diff for: jung-algorithms/src/main/java/edu/uci/ics/jung/algorithms/shortestpath/MinimumSpanningTree.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
* @param <E> the edge type
2626
*/
2727
public class MinimumSpanningTree<N, E> {
28-
// TODO: consider providing a separate mechanism for extracting a spanning tree from an unweighted graph.
28+
// TODO: consider providing a separate mechanism for extracting a spanning tree from an unweighted
29+
// graph.
2930

3031
/**
3132
* Extracts a minimum spanning forest from {@code graph} based on the specified edge weights. (If

Diff for: jung-algorithms/src/main/java/edu/uci/ics/jung/layout/algorithms/DAGLayoutAlgorithm.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ protected void moveNodes() {
211211
setLocation(node, posX, posY);
212212
}
213213
}
214-
//System.out.println("MeanSquareAccel="+meanSquareVel);
214+
// System.out.println("MeanSquareAccel="+meanSquareVel);
215215
if (!stoppingIncrements && Math.abs(meanSquareVel - oldMSV) < MSV_THRESHOLD) {
216216
stoppingIncrements = true;
217217
incrementsLeft = COOL_DOWN_INCREMENTS;

Diff for: jung-algorithms/src/main/java/edu/uci/ics/jung/layout/algorithms/ISOMLayoutAlgorithm.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ public void initialize() {
9595
adaption = initialAdaption;
9696
minAdaption = 0;
9797

98-
//factor = 0; //Will be set later on
98+
// factor = 0; //Will be set later on
9999
coolingFactor = 2;
100100

101-
//temperature = 0.03;
102-
//initialJumpRadius = 100;
103-
//jumpRadius = initialJumpRadius;
101+
// temperature = 0.03;
102+
// initialJumpRadius = 100;
103+
// jumpRadius = initialJumpRadius;
104104

105-
//delay = 100;
105+
// delay = 100;
106106
}
107107

108108
/** Advances the current positions of the graph elements. */
@@ -123,11 +123,11 @@ public void step() {
123123
private synchronized void adjust() {
124124
double width = layoutModel.getWidth();
125125
double height = layoutModel.getHeight();
126-
//Generate random position in graph space
126+
// Generate random position in graph space
127127
// creates a new XY data location
128128
Point tempXYD = Point.of(10 + Math.random() * width, 10 + Math.random() * height);
129129

130-
//Get closest node to random position
130+
// Get closest node to random position
131131
N winner = elementAccessor.getNode(layoutModel, tempXYD.x, tempXYD.y);
132132

133133
while (true) {
@@ -148,8 +148,8 @@ private synchronized void updateParameters() {
148148
epoch++;
149149
double factor = Math.exp(-1 * coolingFactor * (1.0 * epoch / maxEpoch));
150150
adaption = Math.max(minAdaption, factor * initialAdaption);
151-
//jumpRadius = (int) factor * jumpRadius;
152-
//temperature = factor * temperature;
151+
// jumpRadius = (int) factor * jumpRadius;
152+
// temperature = factor * temperature;
153153
if ((radius > minRadius) && (epoch % radiusConstantTime == 0)) {
154154
radius--;
155155
}

Diff for: jung-algorithms/src/main/java/edu/uci/ics/jung/layout/algorithms/KKLayoutAlgorithm.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public void initialize() {
160160

161161
double L0 = Math.min(height, width);
162162
L = (L0 / diameter) * length_factor; // length_factor used to be hardcoded to 0.9
163-
//L = 0.75 * Math.sqrt(height * width / n);
163+
// L = 0.75 * Math.sqrt(height * width / n);
164164

165165
for (int i = 0; i < n - 1; i++) {
166166
for (int j = i + 1; j < n; j++) {

Diff for: jung-algorithms/src/main/java/edu/uci/ics/jung/layout/algorithms/TreeLayoutAlgorithm.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected void buildTree(LayoutModel<N> layoutModel) {
101101
protected void buildTree(LayoutModel<N> layoutModel, N node, int x) {
102102

103103
if (alreadyDone.add(node)) {
104-
//go one level further down
104+
// go one level further down
105105
double newY = this.currentY + this.distY;
106106
this.currentX = x;
107107
this.currentY = newY;

Diff for: jung-algorithms/src/main/java/edu/uci/ics/jung/layout/model/AbstractLayoutModel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public void setSize(int width, int height) {
215215
}
216216

217217
if (oldWidth != 0 || oldHeight != 0) {
218-
adjustLocations(oldWidth, oldHeight, width, height); //, size);
218+
adjustLocations(oldWidth, oldHeight, width, height); // , size);
219219
}
220220
this.width = width;
221221
this.height = height;

Diff for: jung-algorithms/src/main/java/edu/uci/ics/jung/layout/spatial/Node.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void insert(ForceObject<T> element) {
109109
}
110110
// we're already split, update the forceElement for this new element
111111
forceObject = forceObject.add(element);
112-
//and follow down the tree to insert
112+
// and follow down the tree to insert
113113
insertForceObject(element);
114114
}
115115
}

Diff for: jung-algorithms/src/test/java/edu/uci/ics/jung/algorithms/generators/random/TestEppsteinPowerLawGenerator.java

+10-5
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public void testSimpleDirectedCase() {
5353
// public void testPowerLawProperties() {
5454
//
5555
// //long start = System.currentTimeMillis();
56-
// EppsteinPowerLawGenerator generator = new EppsteinPowerLawGenerator(nodeFactory, edgeFactory,
56+
// EppsteinPowerLawGenerator generator = new EppsteinPowerLawGenerator(nodeFactory,
57+
// edgeFactory,
5758
// 500,1500,100000);
5859
// generator.setSeed(5);
5960
// Graph graph = (Graph) generator.generateGraph();
@@ -64,20 +65,24 @@ public void testSimpleDirectedCase() {
6465
// int maxDegree = (int) Descriptive.max(degreeList);
6566
// Histogram degreeHistogram = GraphStatistics.createHistogram(degreeList,0,maxDegree,1);
6667
// //for (int index=0;index<maxDegree;index++) {
67-
// // System.out.println(degreeHistogram.binIndex(index) + " " + degreeHistogram.binHeight(index));
68+
// // System.out.println(degreeHistogram.binIndex(index) + " " +
69+
// degreeHistogram.binHeight(index));
6870
// //}
6971
// //if it's power law, 0 is going to have the highest bin count
70-
// Assert.assertTrue(degreeHistogram.binHeight(0) + degreeHistogram.binHeight(1) > degreeHistogram.binHeight(2) + degreeHistogram.binHeight(3));
72+
// Assert.assertTrue(degreeHistogram.binHeight(0) + degreeHistogram.binHeight(1) >
73+
// degreeHistogram.binHeight(2) + degreeHistogram.binHeight(3));
7174
//
7275
// generator = new EppsteinPowerLawGenerator(500,1500,0);
7376
// graph = (Graph) generator.generateGraph();
7477
// degreeList = DegreeDistributions.getOutdegreeValues(graph.getNodes());
7578
// maxDegree = (int) Descriptive.max(degreeList);
7679
// degreeHistogram = GraphStatistics.createHistogram(degreeList,0,maxDegree,1);
7780
// //for (int index=0;index<maxDegree;index++) {
78-
// // System.out.println(degreeHistogram.binIndex(index) + " " + degreeHistogram.binHeight(index));
81+
// // System.out.println(degreeHistogram.binIndex(index) + " " +
82+
// degreeHistogram.binHeight(index));
7983
// //}
80-
// //if it's not power law, 0 is not going to have the highest bin count rather it will start to go up
84+
// //if it's not power law, 0 is not going to have the highest bin count rather it will
85+
// start to go up
8186
// Assert.assertTrue(degreeHistogram.binHeight(0) < degreeHistogram.binHeight(1));
8287
//
8388
//

Diff for: jung-algorithms/src/test/java/edu/uci/ics/jung/algorithms/scoring/TestHITS.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public void testRanker() {
5959
// Assert.assertEquals(t.transform(1).hub,
6060
// ranker.getAuthScore(2) + 0.2*ranker.getAuthScore(4));
6161
// Assert.assertEquals(t.transform(2).hub,
62-
// 0.5*ranker.getAuthScore(1) + ranker.getAuthScore(3) + 0.2*ranker.getAuthScore(4));
62+
// 0.5*ranker.getAuthScore(1) + ranker.getAuthScore(3) +
63+
// 0.2*ranker.getAuthScore(4));
6364
// Assert.assertEquals(t.transform(3).hub,
6465
// ranker.getAuthScore(0) + 0.2*ranker.getAuthScore(4));
6566
// Assert.assertEquals(t.transform(4).hub,
@@ -69,7 +70,8 @@ public void testRanker() {
6970
// Assert.assertEquals(t.transform(0).authority,
7071
// ranker.getNodeScore(3) + 0.2*ranker.getNodeScore(4));
7172
// Assert.assertEquals(t.transform(1).authority,
72-
// ranker.getNodeScore(0) + 0.5 * ranker.getNodeScore(2) + 0.2*ranker.getNodeScore(4));
73+
// ranker.getNodeScore(0) + 0.5 * ranker.getNodeScore(2) +
74+
// 0.2*ranker.getNodeScore(4));
7375
// Assert.assertEquals(t.transform(2).authority,
7476
// ranker.getNodeScore(1) + 0.2*ranker.getNodeScore(4));
7577
// Assert.assertEquals(t.transform(3).authority,

Diff for: jung-api/src/main/java/edu/uci/ics/jung/graph/TreeBuilder.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ public <N1 extends N> TreeBuilder<N1> nodeOrder(ElementOrder<N1> nodeOrder) {
7272
/** Returns an empty {@link MutableCTree} with the properties of this {@link TreeBuilder}. */
7373
// TODO(jrtom): decide how we're going to handle different implementations.
7474
// For the graph stuff, we don't really need different implementations, but
75-
// for trees, maybe we do; at least for binary trees vs. trees with no restrictions on outgoing edges...
75+
// for trees, maybe we do; at least for binary trees vs. trees with no restrictions on outgoing
76+
// edges...
7677
public <N1 extends N> MutableCTree<N1> build() {
7778
GraphBuilder<Object> graphBuilder = GraphBuilder.directed().allowsSelfLoops(false);
7879
if (expectedNodeCount.isPresent()) {

Diff for: jung-api/src/main/java/edu/uci/ics/jung/graph/TreeNetworkBuilder.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public <E1 extends E> TreeNetworkBuilder<N, E1> edgeOrder(ElementOrder<E1> edgeO
8080
*/
8181
// TODO(jrtom): decide how we're going to handle different implementations.
8282
// For the graph stuff, we don't really need different implementations, but
83-
// for trees, maybe we do; at least for binary trees vs. trees with no restrictions on outgoing edges...
83+
// for trees, maybe we do; at least for binary trees vs. trees with no restrictions on outgoing
84+
// edges...
8485
public <N1 extends N, E1 extends E> MutableCTreeNetwork<N1, E1> build() {
8586
NetworkBuilder<Object, Object> graphBuilder =
8687
NetworkBuilder.directed().allowsSelfLoops(false).allowsParallelEdges(false);

Diff for: jung-io/src/main/java/edu/uci/ics/jung/io/GraphMLReader.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ protected void createEdge(Attributes atts, TagState state) throws SAXNotSupporte
701701
}
702702

703703
if (state == TagState.EDGE) {
704-
assignEdgeSourceTarget(e, atts, edge_atts); //, id);
704+
assignEdgeSourceTarget(e, atts, edge_atts); // , id);
705705
}
706706

707707
// put remaining attribute/value pairs in edge_data
@@ -711,7 +711,7 @@ protected void createEdge(Attributes atts, TagState state) throws SAXNotSupporte
711711
}
712712

713713
protected void assignEdgeSourceTarget(
714-
E e, Attributes atts, Map<String, String> edge_atts) //, String id)
714+
E e, Attributes atts, Map<String, String> edge_atts) // , String id)
715715
throws SAXNotSupportedException {
716716
String source_id = edge_atts.remove("source");
717717
if (source_id == null) {

Diff for: jung-io/src/main/java/edu/uci/ics/jung/io/PajekNetReader.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ protected E createAddEdge(
388388
E e = edge_factory.get();
389389

390390
// don't error-check this: let the graph implementation do whatever it's going to do
391-
// (add the edge, replace the existing edge, throw an exception--depends on the graph implementation)
391+
// (add the edge, replace the existing edge, throw an exception--depends on the graph
392+
// implementation)
392393
g.addEdge(v1, v2, e);
393394
return e;
394395
}

Diff for: jung-io/src/main/java/edu/uci/ics/jung/io/graphml/parser/ElementParserRegistry.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public ElementParserRegistry(
5353
parserMap.put(GraphMLConstants.ENDPOINT_NAME, new EndpointElementParser<G, N, E>(context));
5454
parserMap.put(GraphMLConstants.EDGE_NAME, new EdgeElementParser<G, N, E>(context));
5555
// TODO: restore this once we have a Hypergraph type again
56-
// parserMap.put(GraphMLConstants.HYPEREDGE_NAME, new HyperEdgeElementParser<G,V,E>(context));
56+
// parserMap.put(GraphMLConstants.HYPEREDGE_NAME, new
57+
// HyperEdgeElementParser<G,V,E>(context));
5758
}
5859

5960
public ElementParser getUnknownElementParser() {

Diff for: jung-io/src/main/java/edu/uci/ics/jung/io/graphml/parser/GraphElementParser.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ public GraphMetadata parse(XMLEventReader xmlEventReader, StartElement start)
7878

7979
Map<String, N> idToNodeMap = new HashMap<String, N>();
8080
Collection<EdgeMetadata> edgeMetadata = new LinkedList<EdgeMetadata>();
81-
// Collection<HyperEdgeMetadata> hyperEdgeMetadata = new LinkedList<HyperEdgeMetadata>();
81+
// Collection<HyperEdgeMetadata> hyperEdgeMetadata = new
82+
// LinkedList<HyperEdgeMetadata>();
8283

8384
while (xmlEventReader.hasNext()) {
8485

@@ -133,7 +134,8 @@ public GraphMetadata parse(XMLEventReader xmlEventReader, StartElement start)
133134
// } else if (GraphMLConstants.HYPEREDGE_NAME.equals(name)) {
134135
//
135136
// // Parse the edge metadata
136-
// HyperEdgeMetadata metadata = (HyperEdgeMetadata) getParser(name).parse(
137+
// HyperEdgeMetadata metadata = (HyperEdgeMetadata)
138+
// getParser(name).parse(
137139
// xmlEventReader, element);
138140
//
139141
// // Create the edge object and store it in the metadata

Diff for: jung-io/src/test/java/edu/uci/ics/jung/io/TestGraphMLWriter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public String apply(Number n) {
4242
};
4343

4444
Function<String, String> node_name = Function.identity();
45-
//TransformerUtils.nopTransformer();
45+
// TransformerUtils.nopTransformer();
4646

4747
gmlw.addEdgeData("weight", "integer value for the edge", Integer.toString(-1), edge_weight);
4848
gmlw.addNodeData("name", "identifier for the node", null, node_name);

Diff for: jung-io/src/test/java/edu/uci/ics/jung/io/graphml/DummyGraphObjectBase.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ public MutableNetwork<DummyNode, DummyEdge> apply(GraphMetadata arg0) {
1414
return NetworkBuilder.undirected().allowsParallelEdges(false).allowsSelfLoops(true).build();
1515
}
1616
}
17-
// public static class UndirectedSparseGraphFactory implements Function<GraphMetadata, Hypergraph<DummyNode, DummyEdge>> {
17+
// public static class UndirectedSparseGraphFactory implements Function<GraphMetadata,
18+
// Hypergraph<DummyNode, DummyEdge>> {
1819
//
1920
// public Hypergraph<DummyNode, DummyEdge> apply(GraphMetadata arg0) {
2021
// return new UndirectedSparseGraph<DummyNode, DummyEdge>();
2122
// }
2223
// }
2324
//
24-
// public static class SetHypergraphFactory implements Function<GraphMetadata, Hypergraph<DummyNode, DummyEdge>> {
25+
// public static class SetHypergraphFactory implements Function<GraphMetadata,
26+
// Hypergraph<DummyNode, DummyEdge>> {
2527
//
2628
// public Hypergraph<DummyNode, DummyEdge> apply(GraphMetadata arg0) {
2729
// return new SetHypergraph<DummyNode, DummyEdge>();

0 commit comments

Comments
 (0)