commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1302669 - in /commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export: AbstractExporter.java DotExporter.java GraphMLExporter.java
Date Mon, 19 Mar 2012 21:42:23 GMT
Author: simonetripodi
Date: Mon Mar 19 21:42:23 2012
New Revision: 1302669

URL: http://svn.apache.org/viewvc?rev=1302669&view=rev
Log:
avoid to return the abstract exporter implementation, it would lose the state - return the
concrete impl instead

Modified:
    commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/AbstractExporter.java
    commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/DotExporter.java
    commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/GraphMLExporter.java

Modified: commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/AbstractExporter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/AbstractExporter.java?rev=1302669&r1=1302668&r2=1302669&view=diff
==============================================================================
--- commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/AbstractExporter.java
(original)
+++ commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/AbstractExporter.java
Mon Mar 19 21:42:23 2012
@@ -34,7 +34,7 @@ import org.apache.commons.graph.Graph;
 import org.apache.commons.graph.Mapper;
 import org.apache.commons.graph.VertexPair;
 
-abstract class AbstractExporter<V, E>
+abstract class AbstractExporter<V, E, T extends AbstractExporter<V, E, T>>
 {
 
     private static final String G = "G";
@@ -61,41 +61,44 @@ abstract class AbstractExporter<V, E>
         this.name = name != null ? name : G;
     }
 
-    public AbstractExporter(Graph<V, E> graph) {
-    	this( graph, null );
-	}
-
-	public AbstractExporter(Graph<V, E> graph, String name) {
-		// TODO Auto-generated constructor stub
-		this.graph = graph;
-		this.writer = null;
-		this.vertexProperties = new HashMap<String, Mapper<V, ?>>();
-		this.edgeProperties = new HashMap<String, Mapper<E, ?>>();
-		this.name = name != null ? name : G;
-	}
-	
-	public abstract <N extends Number> AbstractExporter<V, E> withEdgeWeights(Mapper<E,
N> edgeWeights);
-
-	public abstract <N extends Number> AbstractExporter<V, E> withVertexWeights(
Mapper<V, N> vertexWeights );
-	
-	public abstract AbstractExporter<V, E> withEdgeLabels( Mapper<E, String> edgeLabels
);
-	
-	public abstract AbstractExporter<V, E> withVertexLabels( Mapper<V, String> vertexLabels
);
-	
-	public void to( File outputFile ) {
-		// TODO
-	}
-	
-	public void to( OutputStream outputStream ) {
-		// TODO
-	}
-
-    public void to( Writer writer ) {
-    	// TODO
-    }
-	
-	
-	protected final Graph<V, E> getGraph()
+    public AbstractExporter( Graph<V, E> graph )
+    {
+        this( graph, null );
+    }
+
+    public AbstractExporter( Graph<V, E> graph, String name )
+    {
+        this.graph = graph;
+        this.writer = null;
+        this.vertexProperties = new HashMap<String, Mapper<V, ?>>();
+        this.edgeProperties = new HashMap<String, Mapper<E, ?>>();
+        this.name = name != null ? name : G;
+    }
+
+    public abstract <N extends Number> T withEdgeWeights( Mapper<E, N> edgeWeights
);
+
+    public abstract <N extends Number> T withVertexWeights( Mapper<V, N> vertexWeights
);
+
+    public abstract T withEdgeLabels( Mapper<E, String> edgeLabels );
+
+    public abstract T withVertexLabels( Mapper<V, String> vertexLabels );
+
+    public void to( File outputFile )
+    {
+        // TODO
+    }
+
+    public void to( OutputStream outputStream )
+    {
+        // TODO
+    }
+
+    public void to( Writer writer )
+    {
+        // TODO
+    }
+
+    protected final Graph<V, E> getGraph()
     {
         return graph;
     }
@@ -117,7 +120,7 @@ abstract class AbstractExporter<V, E>
 
             // this is basically for the GraphML
 
-            
+
 
             // END
 

Modified: commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/DotExporter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/DotExporter.java?rev=1302669&r1=1302668&r2=1302669&view=diff
==============================================================================
--- commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/DotExporter.java
(original)
+++ commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/DotExporter.java
Mon Mar 19 21:42:23 2012
@@ -35,7 +35,7 @@ import org.apache.commons.graph.Mapper;
  * @param <E>
  */
 final class DotExporter<V, E>
-    extends AbstractExporter<V, E>
+    extends AbstractExporter<V, E, DotExporter<V, E>>
 {
 
     private static final String GRAPH = "graph";
@@ -171,7 +171,7 @@ final class DotExporter<V, E>
     }
 
 	@Override
-	public <N extends Number> DotExporter<V, E> 
+	public <N extends Number> DotExporter<V, E>
 	    withEdgeWeights(Mapper<E, N> edgeWeights) {
 		// TODO Auto-generated method stub
 		return null;

Modified: commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/GraphMLExporter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/GraphMLExporter.java?rev=1302669&r1=1302668&r2=1302669&view=diff
==============================================================================
--- commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/GraphMLExporter.java
(original)
+++ commons/sandbox/graph/branches/exporters-with-mappers/src/main/java/org/apache/commons/graph/export/GraphMLExporter.java
Mon Mar 19 21:42:23 2012
@@ -27,7 +27,7 @@ import org.apache.commons.graph.Graph;
 import org.apache.commons.graph.Mapper;
 
 final class GraphMLExporter<V, E>
-    extends AbstractExporter<V, E>
+    extends AbstractExporter<V, E, GraphMLExporter<V, E>>
 {
 
     private static final String GRAPHML = "graphml";
@@ -192,7 +192,7 @@ final class GraphMLExporter<V, E>
     }
 
 	@Override
-	public <N extends Number> GraphMLExporter<V, E> 
+	public <N extends Number> GraphMLExporter<V, E>
 	    withEdgeWeights(Mapper<E, N> edgeWeights) {
 		// TODO Auto-generated method stub
 		return null;



Mime
View raw message