You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2012/01/23 10:15:55 UTC

svn commit: r1234712 - in /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph: CommonsGraph.java export/ExportSelctor.java export/NamedExportSelctor.java export/ToStreamBuilder.java

Author: simonetripodi
Date: Mon Jan 23 09:15:55 2012
New Revision: 1234712

URL: http://svn.apache.org/viewvc?rev=1234712&view=rev
Log:
started defining the graph export EDSL (impl is still a TODO)

Added:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ExportSelctor.java   (with props)
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/NamedExportSelctor.java   (with props)
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ToStreamBuilder.java   (with props)
Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/CommonsGraph.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/CommonsGraph.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/CommonsGraph.java?rev=1234712&r1=1234711&r2=1234712&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/CommonsGraph.java (original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/CommonsGraph.java Mon Jan 23 09:15:55 2012
@@ -24,6 +24,7 @@ import static org.apache.commons.graph.u
 import org.apache.commons.graph.builder.DefaultLinkedConnectionBuilder;
 import org.apache.commons.graph.builder.GraphConnection;
 import org.apache.commons.graph.builder.LinkedConnectionBuilder;
+import org.apache.commons.graph.export.ToStreamBuilder;
 import org.apache.commons.graph.model.DirectedMutableGraph;
 import org.apache.commons.graph.model.DirectedMutableWeightedGraph;
 import org.apache.commons.graph.model.UndirectedMutableGraph;
@@ -37,6 +38,12 @@ import org.apache.commons.graph.visit.Vi
 public final class CommonsGraph<V extends Vertex, E extends Edge, G extends Graph<V, E>>
 {
 
+    public static <V extends Vertex, E extends Edge, G extends Graph<V, E>> ToStreamBuilder<V, E, G> export( G graph )
+    {
+        graph = checkNotNull( graph, "Null graph can not be exported" );
+        return null;
+    }
+
     /**
      * Allows select a series of algorithms to apply on input graph.
      *

Added: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ExportSelctor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ExportSelctor.java?rev=1234712&view=auto
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ExportSelctor.java (added)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ExportSelctor.java Mon Jan 23 09:15:55 2012
@@ -0,0 +1,31 @@
+package org.apache.commons.graph.export;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.graph.Edge;
+import org.apache.commons.graph.Graph;
+import org.apache.commons.graph.Vertex;
+
+public interface ExportSelctor<V extends Vertex, E extends Edge, G extends Graph<V, E>>
+{
+
+    void usingDotNotation();
+
+}

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ExportSelctor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ExportSelctor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ExportSelctor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/NamedExportSelctor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/NamedExportSelctor.java?rev=1234712&view=auto
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/NamedExportSelctor.java (added)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/NamedExportSelctor.java Mon Jan 23 09:15:55 2012
@@ -0,0 +1,32 @@
+package org.apache.commons.graph.export;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.graph.Edge;
+import org.apache.commons.graph.Graph;
+import org.apache.commons.graph.Vertex;
+
+public interface NamedExportSelctor<V extends Vertex, E extends Edge, G extends Graph<V, E>>
+    extends ExportSelctor<V, E, G>
+{
+
+    ExportSelctor<V, E, G> withName( String name );
+
+}

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/NamedExportSelctor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/NamedExportSelctor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/NamedExportSelctor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ToStreamBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ToStreamBuilder.java?rev=1234712&view=auto
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ToStreamBuilder.java (added)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ToStreamBuilder.java Mon Jan 23 09:15:55 2012
@@ -0,0 +1,42 @@
+package org.apache.commons.graph.export;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.Writer;
+
+import org.apache.commons.graph.Edge;
+import org.apache.commons.graph.Graph;
+import org.apache.commons.graph.Vertex;
+
+public interface ToStreamBuilder<V extends Vertex, E extends Edge, G extends Graph<V, E>>
+{
+
+    NamedExportSelctor<V, E, G> to( File outputFile );
+
+    NamedExportSelctor<V, E, G> to( OutputStream outputStream );
+
+    NamedExportSelctor<V, E, G> to( Writer writer );
+
+    NamedExportSelctor<V, E, G> to( PrintStream printStream );
+
+}

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ToStreamBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ToStreamBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/ToStreamBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain