jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1179281 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
Date Wed, 05 Oct 2011 15:52:53 GMT
Author: reschke
Date: Wed Oct  5 15:52:53 2011
New Revision: 1179281

URL: http://svn.apache.org/viewvc?rev=1179281&view=rev
Log:
generics

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java?rev=1179281&r1=1179280&r2=1179281&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
Wed Oct  5 15:52:53 2011
@@ -83,6 +83,16 @@ public class IndexingConfigurationImpl
     private static final PathFactory PATH_FACTORY = PathFactoryImpl.getInstance();
 
     /**
+     * An Iterator over an empty list of node states.
+     */
+    private static final Iterator<NodeState> EMPTY_NODESTATE_ITERATOR;
+    static {
+        Collection<NodeState> empty = Collections.emptyList();
+        EMPTY_NODESTATE_ITERATOR = empty.iterator();
+    }
+
+    
+    /**
      * The indexing configuration.
      */
     private Element configuration;
@@ -930,11 +940,11 @@ public class IndexingConfigurationImpl
          */
         boolean evaluate(final NodeState context) {
             // get iterator along specified axis
-            Iterator nodeStates;
+            Iterator<NodeState> nodeStates;
             if (axis == SELF) {
                 nodeStates = Collections.singletonList(context).iterator();
             } else if (axis == CHILD) {
-                nodeStates = new AbstractIteratorDecorator(
+                nodeStates = (Iterator<NodeState>) new AbstractIteratorDecorator(
                         context.getChildNodeEntries().iterator()) {
                     public Object next() {
                         ChildNodeEntry cne =
@@ -950,7 +960,7 @@ public class IndexingConfigurationImpl
                 };
             } else if (axis == ANCESTOR) {
                 try {
-                    nodeStates = new Iterator() {
+                    nodeStates = new Iterator<NodeState>() {
 
                         private NodeState next = context.getParentId() == null ? null :
                                 (NodeState) ism.getItemState(context.getParentId());
@@ -963,7 +973,7 @@ public class IndexingConfigurationImpl
                             return next != null;
                         }
 
-                        public Object next() {
+                        public NodeState next() {
                             NodeState tmp = next;
                             try {
                                 if (next.getParentId() != null) {
@@ -978,7 +988,7 @@ public class IndexingConfigurationImpl
                         }
                     };
                 } catch (ItemStateException e) {
-                    nodeStates = Collections.EMPTY_LIST.iterator();
+                    nodeStates = EMPTY_NODESTATE_ITERATOR;
                 }
             } else if (axis == PARENT) {
                 try {
@@ -986,20 +996,20 @@ public class IndexingConfigurationImpl
                         NodeState state = (NodeState) ism.getItemState(context.getParentId());
                         nodeStates = Collections.singletonList(state).iterator();
                     } else {
-                        nodeStates = Collections.EMPTY_LIST.iterator();
+                        nodeStates = EMPTY_NODESTATE_ITERATOR;
                     }
                 } catch (ItemStateException e) {
-                    nodeStates = Collections.EMPTY_LIST.iterator();
+                    nodeStates = EMPTY_NODESTATE_ITERATOR;
                 }
             } else {
                 // unsupported axis
-                nodeStates = Collections.EMPTY_LIST.iterator();
+                nodeStates = EMPTY_NODESTATE_ITERATOR;
             }
 
             // check node type, name and property value for each
             while (nodeStates.hasNext()) {
                 try {
-                    NodeState current = (NodeState) nodeStates.next();
+                    NodeState current = nodeStates.next();
                     if (elementTest != null
                             && !current.getNodeTypeName().equals(elementTest)) {
                         continue;



Mime
View raw message