jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1309327 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java
Date Wed, 04 Apr 2012 10:34:37 GMT
Author: mduerig
Date: Wed Apr  4 10:34:37 2012
New Revision: 1309327

URL: http://svn.apache.org/viewvc?rev=1309327&view=rev
Log:
OAK-9: Internal tree builder
add methods for count and existence of nodes/properties

Modified:
    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/TransientNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java?rev=1309327&r1=1309326&r2=1309327&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 10:34:37 2012
@@ -78,6 +78,18 @@ public class TransientNodeState {
             ? null
             : persistentState.getProperty(name);
     }
+    
+    public boolean hasProperty(String name) {
+        return getProperty(name) != null;
+    }
+    
+    public long getPropertyCount() {
+        long persistentCount = persistentState == null
+            ? 0
+            : persistentState.getPropertyCount();
+        
+        return persistentCount + addedProperties.size() - removedProperties.size();
+    }
 
     public TransientNodeState getChildNode(String name) {
         TransientNodeState state = addedNodes.get(name);
@@ -93,6 +105,14 @@ public class TransientNodeState {
     public boolean hasNode(String name) {
         return getChildNode(name) != null;
     }
+    
+    public long getChildNodeCount() {
+        long persistentCount = persistentState == null
+                ? 0
+                : persistentState.getChildNodeCount();
+
+        return persistentCount + addedNodes.size() - removedNodes.size();
+    }
 
     public Iterable<PropertyState> getProperties() {
         final Set<String> removed = new HashSet<String>();



Mime
View raw message