commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1136430 - in /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph: domain/ model/InvertedEdgeAdapter.java spanning/ spanning/Prim.java
Date Thu, 16 Jun 2011 13:28:10 GMT
Author: simonetripodi
Date: Thu Jun 16 13:28:10 2011
New Revision: 1136430

URL: http://svn.apache.org/viewvc?rev=1136430&view=rev
Log:
dropped old obsolete domain subpackage

Added:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InvertedEdgeAdapter.java
  (with props)
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/Prim.java
  (with props)
Removed:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/domain/

Added: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InvertedEdgeAdapter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InvertedEdgeAdapter.java?rev=1136430&view=auto
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InvertedEdgeAdapter.java
(added)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InvertedEdgeAdapter.java
Thu Jun 16 13:28:10 2011
@@ -0,0 +1,84 @@
+package org.apache.commons.graph.model;
+
+/*
+ * 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 static java.lang.reflect.Proxy.newProxyInstance;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+import org.apache.commons.graph.Edge;
+import org.apache.commons.graph.Vertex;
+
+/**
+ * 
+ *
+ * @param <V>
+ */
+final class InvertedEdgeAdapter<V extends Vertex>
+    implements Edge<V>, InvocationHandler
+{
+
+    public static <V extends Vertex, E extends Edge<V>> E invertHeadAndTail(
E edge )
+    {
+        @SuppressWarnings( "unchecked" ) // type driven by input
+        E edgeProxy = (E) newProxyInstance( edge.getClass().getClassLoader(), edge.getClass().getInterfaces(),
+                                            new InvertedEdgeAdapter<V>( edge ) );
+        return edgeProxy;
+    }
+
+    private final Edge<V> adapted;
+
+    private InvertedEdgeAdapter( Edge<V> adapted )
+    {
+        this.adapted = adapted;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public V getHead()
+    {
+        return adapted.getTail();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public V getTail()
+    {
+        return adapted.getHead();
+    }
+
+    /**
+     * 
+     * @param arg0
+     * @param arg1
+     * @param arg2
+     * @return
+     * @throws Throwable
+     */
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        return method.invoke( this, args );
+    }
+
+}

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

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

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

Added: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/Prim.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/Prim.java?rev=1136430&view=auto
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/Prim.java
(added)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/Prim.java
Thu Jun 16 13:28:10 2011
@@ -0,0 +1,37 @@
+package org.apache.commons.graph.spanning;
+
+/*
+ * 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.Vertex;
+import org.apache.commons.graph.WeightedEdge;
+import org.apache.commons.graph.WeightedGraph;
+
+/**
+ * 
+ */
+public final class Prim
+{
+
+    public static <V extends Vertex, WE extends WeightedEdge<V>> void minimumSpanningTree(
 WeightedGraph<V, WE> graph )
+    {
+        
+    }
+
+}

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

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

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



Mime
View raw message