Author: marcosperanza
Date: Thu Jul 12 08:32:46 2012
New Revision: 1360578
URL: http://svn.apache.org/viewvc?rev=1360578&view=rev
Log:
code formatting, no functional modifications
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/elo/DefaultKFactorBuilder.java
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/AbstractExporter.java
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/scc/KosarajuSharirAlgorithm.java
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SuperVertex.java
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/utils/Objects.java
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/elo/DefaultKFactorBuilder.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/elo/DefaultKFactorBuilder.java?rev=1360578&r1=1360577&r2=1360578&view=diff
==============================================================================
---
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/elo/DefaultKFactorBuilder.java
(original)
+++
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/elo/DefaultKFactorBuilder.java
Thu Jul 12 08:32:46 2012
@@ -97,12 +97,12 @@ final class DefaultKFactorBuilder<P>
private double calculateQFactor( P player )
{
double ranking = playerRanking.getRanking( player );
- return pow( DEFAULT_POW_BASE, ranking / DEFAULT_DIVISOR);
+ return pow( DEFAULT_POW_BASE, ranking / DEFAULT_DIVISOR );
}
private static double calculateEFactor( double qA, double qB )
{
- return qA / (qA + qB);
+ return qA / ( qA + qB );
}
private void updateRanking( P player, double kFactor, double sFactor,
double eFactor )
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/AbstractExporter.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/AbstractExporter.java?rev=1360578&r1=1360577&r2=1360578&view=diff
==============================================================================
---
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/AbstractExporter.java
(original)
+++
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/AbstractExporter.java
Thu Jul 12 08:32:46 2012
@@ -161,14 +161,14 @@ abstract class AbstractExporter<V, E, T
return writer;
}
- protected void addVertexProperty(String propertyName, Mapper<V, ?>
vertexProperty)
+ protected void addVertexProperty( String propertyName, Mapper<V, ?>
vertexProperty )
{
- this.vertexProperties.put(propertyName, vertexProperty);
+ this.vertexProperties.put( propertyName, vertexProperty );
}
- protected void addEdgeProperty(String propertyName, Mapper<E, ?>
edgeProperty)
+ protected void addEdgeProperty( String propertyName, Mapper<E, ?>
edgeProperty )
{
- this.edgeProperties.put(propertyName, edgeProperty);
+ this.edgeProperties.put( propertyName, edgeProperty );
}
protected abstract void startSerialization()
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java?rev=1360578&r1=1360577&r2=1360578&view=diff
==============================================================================
---
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java
(original)
+++
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java
Thu Jul 12 08:32:46 2012
@@ -30,7 +30,7 @@ import org.apache.commons.graph.Mapper;
/**
* This class is NOT thread-safe!
- *
+ *
* @param <V>
* @param <E>
*/
@@ -45,35 +45,35 @@ final class DotExporter<V, E>
private static final String CONNECTOR = "--";
private static final String DICONNECTOR = "->";
-
+
private static final String WEIGHT = "weight";
-
+
private static final String LABEL = "label";
-
+
private final Map<V, Integer> vertexIdentifiers;
+ private PrintWriter printWriter;
+
+ private String connector;
+
DotExporter( Graph<V, E> graph, String name )
{
super( graph, name );
this.vertexIdentifiers = generateVertexIdentifiers( graph );
}
- private Map<V, Integer> generateVertexIdentifiers(Graph<V, E> graph)
+ private Map<V, Integer> generateVertexIdentifiers( Graph<V, E> graph )
{
- Map<V, Integer> vertexIdentifiers = new HashMap<V, Integer>();
- int count = 1;
-
- for(V vertex : graph.getVertices())
- {
- vertexIdentifiers.put( vertex, count++ );
- }
-
- return vertexIdentifiers;
- }
+ Map<V, Integer> vertexIdentifiers = new HashMap<V, Integer>();
+ int count = 1;
- private PrintWriter printWriter;
+ for ( V vertex : graph.getVertices() )
+ {
+ vertexIdentifiers.put( vertex, count++ );
+ }
- private String connector;
+ return vertexIdentifiers;
+ }
@Override
protected void startSerialization()
@@ -152,24 +152,23 @@ final class DotExporter<V, E>
throws Exception
{
printWriter.format( " %s %s %s",
- vertexIdentifiers.get( head ),
+ vertexIdentifiers.get( head ),
connector,
vertexIdentifiers.get( tail ) );
printVertexOrEdgeProperties( properties );
}
-
+
private void printVertexOrEdgeProperties( Map<String, Object> properties )
{
if ( !properties.isEmpty() )
{
- int countAddedProperties = 0;
+ int countAddedProperties = 0;
printWriter.write( " [" );
for ( Entry<String, Object> property : properties.entrySet() )
{
- String formattedString = countAddedProperties ==
properties.size() - 1 ? "%s=\"%s\"" :
-
"%s=\"%s\" ";
+ String formattedString = countAddedProperties ==
properties.size() - 1 ? "%s=\"%s\"" : "%s=\"%s\" ";
printWriter.format( formattedString, property.getKey(),
property.getValue() );
countAddedProperties++;
}
@@ -180,20 +179,19 @@ final class DotExporter<V, E>
public <N extends Number> DotExporter<V, E> withEdgeWeights( Mapper<E, N>
edgeWeights )
{
- super.addEdgeProperty(WEIGHT, edgeWeights);
+ super.addEdgeProperty( WEIGHT, edgeWeights );
return this;
}
public DotExporter<V, E> withEdgeLabels( Mapper<E, String> edgeLabels )
{
- super.addEdgeProperty(LABEL, edgeLabels);
+ super.addEdgeProperty( LABEL, edgeLabels );
return this;
}
public DotExporter<V, E> withVertexLabels( Mapper<V, String> vertexLabels )
{
- super.addVertexProperty(LABEL, vertexLabels);
+ super.addVertexProperty( LABEL, vertexLabels );
return this;
}
-
-}
+}
\ No newline at end of file
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/scc/KosarajuSharirAlgorithm.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/scc/KosarajuSharirAlgorithm.java?rev=1360578&r1=1360577&r2=1360578&view=diff
==============================================================================
---
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/scc/KosarajuSharirAlgorithm.java
(original)
+++
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/scc/KosarajuSharirAlgorithm.java
Thu Jul 12 08:32:46 2012
@@ -98,7 +98,7 @@ final class KosarajuSharirAlgorithm<V, E
final LinkedHashSet<V> stack = new LinkedHashSet<V>();
for ( int i = expandedVertexList.size() - 1; i >= 0; i-- )
{
- stack.add(expandedVertexList.get( i ) );
+ stack.add( expandedVertexList.get( i ) );
}
while ( stack.size() > 0 )
@@ -125,7 +125,7 @@ final class KosarajuSharirAlgorithm<V, E
*/
private List<V> getExpandedVertexList( final V source, final Set<V>
visitedVertices )
{
- final int size = (source != null) ? 13 : graph.getOrder();
+ final int size = ( source != null ) ? 13 : graph.getOrder();
final Set<V> vertices = new HashSet<V>( size );
if ( source != null )
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java?rev=1360578&r1=1360577&r2=1360578&view=diff
==============================================================================
---
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java
(original)
+++
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java
Thu Jul 12 08:32:46 2012
@@ -235,8 +235,9 @@ final class DefaultSpanningTreeAlgorithm
WE edge = graph.getEdge( vertex, v );
// if the edge has not been already visited and its weight is
// less then the current Vertex weight
- boolean weightLessThanCurrent = !shortestEdges.hasWeight( v )
||
- weightOperations.compare( weightedEdges.map( edge ),
shortestEdges.getWeight( v ) ) < 0;
+ boolean weightLessThanCurrent =
+ !shortestEdges.hasWeight( v )
+ || weightOperations.compare( weightedEdges.map( edge
), shortestEdges.getWeight( v ) ) < 0;
if ( settledEdges.add( edge ) && weightLessThanCurrent )
{
if ( !unsettledNodes.contains( v ) )
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SuperVertex.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SuperVertex.java?rev=1360578&r1=1360577&r2=1360578&view=diff
==============================================================================
---
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SuperVertex.java
(original)
+++
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SuperVertex.java
Thu Jul 12 08:32:46 2012
@@ -38,7 +38,8 @@ import org.apache.commons.graph.VertexPa
* @param <WC> the weight operations
*/
class SuperVertex<V, W, WE>
- implements Iterable<V> {
+ implements Iterable<V>
+{
/** The reference to the graph. */
private final Graph<V, WE> graph;
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/utils/Objects.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/utils/Objects.java?rev=1360578&r1=1360577&r2=1360578&view=diff
==============================================================================
---
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/utils/Objects.java
(original)
+++
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/utils/Objects.java
Thu Jul 12 08:32:46 2012
@@ -18,6 +18,7 @@ package org.apache.commons.graph.utils;
* specific language governing permissions and limitations
* under the License.
*/
+
/**
* Object simple utility methods.
*/