Author: elecharny
Date: Tue Jun 26 15:01:31 2012
New Revision: 1354047
URL: http://svn.apache.org/viewvc?rev=1354047&view=rev
Log:
Added some DeleteResult instances
Added:
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BorrowedFromSiblingResult.java
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/MergedWithSiblingResult.java
Modified:
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/RemoveResult.java
Added:
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BorrowedFromSiblingResult.java
URL:
http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BorrowedFromSiblingResult.java?rev=1354047&view=auto
==============================================================================
---
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BorrowedFromSiblingResult.java
(added)
+++
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BorrowedFromSiblingResult.java
Tue Jun 26 15:01:31 2012
@@ -0,0 +1,110 @@
+/*
+ * 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.mavibot.btree;
+
+/**
+ * The result of a delete operation, when the child has not been merged. It
contains the
+ * reference to the modified page, and the removed element.
+ *
+ * @param <K> The type for the Key
+ * @param <V> The type for the stored value
+
+ * @author <a href="mailto:[email protected]">Mavibot labs Project</a>
+ */
+/* No qualifier */ class BorrowedFromSiblingResult<K, V> implements
DeleteResult<K, V>
+{
+ /** The modified page reference */
+ protected Page<K, V> modifiedPage;
+
+ /** The modified sibling reference */
+ protected Page<K, V> modifiedSibling;
+
+ /** The removed element if the key was found in the tree*/
+ protected Tuple<K, V> removedElement;
+
+ /** The new leftmost element if the removed k was on position 0. Null
otherwise */
+ protected K newLeftMost;
+
+ /**
+ * The default constructor for RemoveResult.
+ *
+ * @param modifiedPage The modified page
+ * @param
+ * @param removedElement The removed element (can be null if the key
wasn't present in the tree)
+ */
+ public BorrowedFromSiblingResult( Page<K, V> modifiedPage, Page<K, V>
modifiedSibling, Tuple<K, V> removedElement, K newLeftMost )
+ {
+ this.modifiedPage = modifiedPage;
+ this.modifiedSibling = modifiedSibling;
+ this.removedElement = removedElement;
+ this.newLeftMost = newLeftMost;
+ }
+
+
+ /**
+ * @return the modifiedPage
+ */
+ public Page<K, V> getModifiedPage()
+ {
+ return modifiedPage;
+ }
+
+
+ /**
+ * @return the modifiedSibling
+ */
+ public Page<K, V> getModifiedSibling()
+ {
+ return modifiedSibling;
+ }
+
+
+ /**
+ * @return the removed element
+ */
+ public Tuple<K, V> getRemovedElement()
+ {
+ return removedElement;
+ }
+
+
+ /**
+ * @return the newLeftMost
+ */
+ public K getNewLeftMost()
+ {
+ return newLeftMost;
+ }
+
+
+ /**
+ * @see Object#toString()
+ */
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append( "RemoveResult, removed element = " ).append( removedElement
);
+ sb.append( ", modifiedPage = " ).append( modifiedPage );
+ sb.append( ", new LeftMost = " ).append( newLeftMost );
+
+ return sb.toString();
+ }
+}
Added:
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/MergedWithSiblingResult.java
URL:
http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/MergedWithSiblingResult.java?rev=1354047&view=auto
==============================================================================
---
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/MergedWithSiblingResult.java
(added)
+++
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/MergedWithSiblingResult.java
Tue Jun 26 15:01:31 2012
@@ -0,0 +1,98 @@
+/*
+ * 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.mavibot.btree;
+
+/**
+ * The result of a delete operation, when the child has not been merged. It
contains the
+ * reference to the modified page, and the removed element.
+ *
+ * @param <K> The type for the Key
+ * @param <V> The type for the stored value
+
+ * @author <a href="mailto:[email protected]">Mavibot labs Project</a>
+ */
+/* No qualifier */ class MergedWithSiblingResult<K, V> implements
DeleteResult<K, V>
+{
+ /** The modified page reference */
+ protected Page<K, V> modifiedPage;
+
+ /** The removed element if the key was found in the tree*/
+ protected Tuple<K, V> removedElement;
+
+ /** The new leftmost element if the removed k was on position 0. Null
otherwise */
+ protected K newLeftMost;
+
+ /**
+ * The default constructor for RemoveResult.
+ *
+ * @param modifiedPage The modified page
+ * @param
+ * @param removedElement The removed element (can be null if the key
wasn't present in the tree)
+ */
+ public MergedWithSiblingResult( Page<K, V> modifiedPage, Tuple<K, V>
removedElement, K newLeftMost )
+ {
+ this.modifiedPage = modifiedPage;
+ this.removedElement = removedElement;
+ this.newLeftMost = newLeftMost;
+ }
+
+
+ /**
+ * @return the modifiedPage
+ */
+ public Page<K, V> getModifiedPage()
+ {
+ return modifiedPage;
+ }
+
+
+
+ /**
+ * @return the removed element
+ */
+ public Tuple<K, V> getRemovedElement()
+ {
+ return removedElement;
+ }
+
+
+ /**
+ * @return the newLeftMost
+ */
+ public K getNewLeftMost()
+ {
+ return newLeftMost;
+ }
+
+
+ /**
+ * @see Object#toString()
+ */
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append( "MergedWithSiblingResult, removed element = " ).append(
removedElement );
+ sb.append( ", modifiedPage = " ).append( modifiedPage );
+ sb.append( ", new LeftMost = " ).append( newLeftMost );
+
+ return sb.toString();
+ }
+}
Modified:
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/RemoveResult.java
URL:
http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/RemoveResult.java?rev=1354047&r1=1354046&r2=1354047&view=diff
==============================================================================
---
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/RemoveResult.java
(original)
+++
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/RemoveResult.java
Tue Jun 26 15:01:31 2012
@@ -36,16 +36,20 @@ package org.apache.mavibot.btree;
/** The removed element if the key was found in the tree*/
protected Tuple<K, V> removedElement;
+ /** The new leftmost element if the removed k was on position 0. Null
otherwise */
+ protected K newLeftMost;
+
/**
* The default constructor for RemoveResult.
*
* @param modifiedPage The modified page
* @param removedElement The removed element (can be null if the key
wasn't present in the tree)
*/
- public RemoveResult( Page<K, V> modifiedPage, Tuple<K, V> removedElement )
+ public RemoveResult( Page<K, V> modifiedPage, Tuple<K, V> removedElement,
K newLeftMost )
{
this.modifiedPage = modifiedPage;
this.removedElement = removedElement;
+ this.newLeftMost = newLeftMost;
}
@@ -65,6 +69,15 @@ package org.apache.mavibot.btree;
{
return removedElement;
}
+
+
+ /**
+ * @return the newLeftMost
+ */
+ public K getNewLeftMost()
+ {
+ return newLeftMost;
+ }
/**
@@ -76,6 +89,7 @@ package org.apache.mavibot.btree;
sb.append( "RemoveResult, removed element = " ).append( removedElement
);
sb.append( ", modifiedPage = " ).append( modifiedPage );
+ sb.append( ", new LeftMost = " ).append( newLeftMost );
return sb.toString();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]