jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1309303 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel: KernelNodeStateEditor.java TransientNodeState.java
Date Wed, 04 Apr 2012 09:39:44 GMT
Author: mduerig
Date: Wed Apr  4 09:39:43 2012
New Revision: 1309303

URL: http://svn.apache.org/viewvc?rev=1309303&view=rev
Log:
OAK-9: Internal tree builder
Refactor: add hasNode() method to TransientNodeState

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java?rev=1309303&r1=1309302&r2=1309303&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java
Wed Apr  4 09:39:43 2012
@@ -56,7 +56,7 @@ public class KernelNodeStateEditor imple
 
     @Override
     public void addNode(String name) {
-        if (!hasNode(transientState, name)) {
+        if (!transientState.hasNode(name)) {
             transientState.addNode(name);
             jsop.append("+\"").append(path(name)).append("\":{}");
         }
@@ -64,7 +64,7 @@ public class KernelNodeStateEditor imple
 
     @Override
     public void removeNode(String name) {
-        if (hasNode(transientState, name)) {
+        if (transientState.hasNode(name)) {
             transientState.removeNode(name);
             jsop.append("-\"").append(path(name)).append('"');
         }
@@ -87,13 +87,13 @@ public class KernelNodeStateEditor imple
     public void move(String sourcePath, String destPath) {
         TransientNodeState sourceParent = getTransientState(PathUtils.getAncestorPath(sourcePath,
1));
         String sourceName = PathUtils.getName(sourcePath);
-        if (sourceParent == null || !hasNode(sourceParent, sourceName)) {
+        if (sourceParent == null || !sourceParent.hasNode(sourceName)) {
             return;
         }
         
         TransientNodeState destParent = getTransientState(PathUtils.getAncestorPath(destPath,
1));
         String destName = PathUtils.getName(destPath);
-        if (destParent == null || hasNode(destParent, destName)) {
+        if (destParent == null || destParent.hasNode(destName)) {
             return;
         }
 
@@ -106,13 +106,13 @@ public class KernelNodeStateEditor imple
     public void copy(String sourcePath, String destPath) {
         TransientNodeState sourceParent = getTransientState(PathUtils.getAncestorPath(sourcePath,
1));
         String sourceName = PathUtils.getName(sourcePath);
-        if (sourceParent == null || !hasNode(sourceParent, sourceName)) {
+        if (sourceParent == null || !sourceParent.hasNode(sourceName)) {
             return;
         }
 
         TransientNodeState destParent = getTransientState(PathUtils.getAncestorPath(destPath,
1));
         String destName = PathUtils.getName(destPath);
-        if (destParent == null || hasNode(destParent, destName)) {
+        if (destParent == null || destParent.hasNode(destName)) {
             return;
         }
 
@@ -169,8 +169,4 @@ public class KernelNodeStateEditor imple
         return path.isEmpty() ? name : path + '/' + name;
     }
 
-    private static boolean hasNode(TransientNodeState state, String name) {
-        return state.getChildNode(name) != null;
-    }
-
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java?rev=1309303&r1=1309302&r2=1309303&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java
Wed Apr  4 09:39:43 2012
@@ -90,6 +90,10 @@ public class TransientNodeState {
             : getExistingChildNode(name);
     }
 
+    public boolean hasNode(String name) {
+        return getChildNode(name) != null;
+    }
+
     public Iterable<PropertyState> getProperties() {
         final Set<String> removed = new HashSet<String>();
         removed.addAll(removedProperties);



Mime
View raw message