cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject cayenne git commit: modernizing syntax, no change
Date Mon, 16 Nov 2015 20:11:29 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master d252bf37b -> ce0a34d07


modernizing syntax, no change


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/ce0a34d0
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/ce0a34d0
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/ce0a34d0

Branch: refs/heads/master
Commit: ce0a34d07b131a715ed3c5e5c492846cd7f107d9
Parents: d252bf3
Author: aadamchik <aadamchik@apache.org>
Authored: Mon Nov 16 14:33:40 2015 -0500
Committer: aadamchik <aadamchik@apache.org>
Committed: Mon Nov 16 15:10:47 2015 -0500

----------------------------------------------------------------------
 .../cayenne/ashwood/graph/ArcIterator.java      | 31 +----------
 .../cayenne/ashwood/graph/EmptyIterator.java    | 57 ++++++++++++++++++++
 .../cayenne/ashwood/graph/FilterIteration.java  |  4 +-
 .../cayenne/ashwood/graph/MapDigraph.java       |  4 +-
 4 files changed, 63 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/ce0a34d0/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/ArcIterator.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/ArcIterator.java
b/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/ArcIterator.java
index 2e28a7c..22466a8 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/ArcIterator.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/ArcIterator.java
@@ -60,40 +60,13 @@
 package org.apache.cayenne.ashwood.graph;
 
 import java.util.Iterator;
-import java.util.NoSuchElementException;
 
 /**
  * @since 3.1
  */
 public interface ArcIterator<E, V> extends Iterator<V> {
 
-    @SuppressWarnings("all")
-    static final ArcIterator EMPTY_ITERATOR = new ArcIterator.EmptyIterator();
+	E getOrigin();
 
-    E getOrigin();
-
-    E getDestination();
-
-    static class EmptyIterator<E, V> implements ArcIterator<E, V> {
-
-        public E getOrigin() {
-            return null;
-        }
-
-        public E getDestination() {
-            return null;
-        }
-
-        public boolean hasNext() {
-            return false;
-        }
-
-        public V next() {
-            throw new NoSuchElementException("Iterator contains no elements");
-        }
-
-        public void remove() {
-            throw new IllegalStateException("Iterator contains no elements");
-        }
-    }
+	E getDestination();
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ce0a34d0/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/EmptyIterator.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/EmptyIterator.java
b/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/EmptyIterator.java
new file mode 100644
index 0000000..2730c7e
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/EmptyIterator.java
@@ -0,0 +1,57 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+package org.apache.cayenne.ashwood.graph;
+
+import java.util.NoSuchElementException;
+
+class EmptyIterator<E, V> implements ArcIterator<E, V> {
+
+	@SuppressWarnings({ "rawtypes" })
+	private static final ArcIterator EMPTY_ITERATOR = new EmptyIterator<>();
+	
+	@SuppressWarnings("unchecked")
+	static <E, V> ArcIterator<E, V> instance() {
+		return EMPTY_ITERATOR;
+	}
+
+	@Override
+	public E getOrigin() {
+		return null;
+	}
+
+	@Override
+	public E getDestination() {
+		return null;
+	}
+
+	@Override
+	public boolean hasNext() {
+		return false;
+	}
+
+	@Override
+	public V next() {
+		throw new NoSuchElementException("Iterator contains no elements");
+	}
+
+	@Override
+	public void remove() {
+		throw new IllegalStateException("Iterator contains no elements");
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ce0a34d0/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/FilterIteration.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/FilterIteration.java
b/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/FilterIteration.java
index 6e8fd17..16d0e77 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/FilterIteration.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/FilterIteration.java
@@ -95,7 +95,7 @@ public class FilterIteration<E, V> implements DigraphIteration<E,
V> {
 
     public ArcIterator<E, V> outgoingIterator(E vertex) {
         if (!acceptVertex.evaluate(vertex))
-            return ArcIterator.EMPTY_ITERATOR;
+            return EmptyIterator.instance();
         return new FilterArcIterator<E, V>(
                 digraph.outgoingIterator(vertex),
                 TruePredicate.INSTANCE,
@@ -105,7 +105,7 @@ public class FilterIteration<E, V> implements DigraphIteration<E,
V> {
 
     public ArcIterator<E, V> incomingIterator(E vertex) {
         if (!acceptVertex.evaluate(vertex))
-            return ArcIterator.EMPTY_ITERATOR;
+            return EmptyIterator.instance();
         return new FilterArcIterator<E, V>(
                 digraph.incomingIterator(vertex),
                 acceptVertex,

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ce0a34d0/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/MapDigraph.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/MapDigraph.java
b/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/MapDigraph.java
index 2402261..9045eef 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/MapDigraph.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/ashwood/graph/MapDigraph.java
@@ -204,7 +204,7 @@ public class MapDigraph<E, V> implements Digraph<E, V> {
 	@Override
 	public ArcIterator<E, V> outgoingIterator(E vertex) {
 		if (!containsVertex(vertex)) {
-			return ArcIterator.EMPTY_ITERATOR;
+			return EmptyIterator.instance();
 		}
 
 		return new OutgoingArcIterator(vertex);
@@ -213,7 +213,7 @@ public class MapDigraph<E, V> implements Digraph<E, V> {
 	@Override
 	public ArcIterator<E, V> incomingIterator(E vertex) {
 		if (!containsVertex(vertex)) {
-			return ArcIterator.EMPTY_ITERATOR;
+			return EmptyIterator.instance();
 		}
 
 		return new IncomingArcIterator(vertex);


Mime
View raw message