You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/10/11 10:43:03 UTC
[05/17] ignite git commit: ignite-5937
ignite-5937
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f8be46d8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f8be46d8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f8be46d8
Branch: refs/heads/ignite-5932
Commit: f8be46d80875890f95970af34e55a418c7892434
Parents: e6940bd
Author: sboikov <sb...@gridgain.com>
Authored: Wed Oct 4 11:44:31 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Oct 4 11:44:31 2017 +0300
----------------------------------------------------------------------
.../cache/persistence/tree/BPlusTree.java | 62 ++++++++++++--------
1 file changed, 36 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8be46d8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
index 05adb41..b6c5c96 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
@@ -973,6 +973,35 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure implements
}
}
+ /**
+ * @param lower Lower bound inclusive.
+ * @param upper Upper bound inclusive.
+ * @param x Implementation specific argument, {@code null} always means that we need to return full detached data row.
+ * @return First found item which meets bounds and pass predicate.
+ * @throws IgniteCheckedException If failed.
+ */
+ public T findOneBounded(L lower, L upper, RowPredicate<L, T> p, Object x) throws IgniteCheckedException {
+ checkDestroyed();
+
+ try {
+ FindOneCursor cursor = new FindOneCursor(lower, upper, p, x);
+
+ return cursor.findOne();
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteCheckedException("Runtime failure on bounds: [lower=" + lower + ", upper=" + upper + "]", e);
+ }
+ catch (RuntimeException e) {
+ throw new IgniteException("Runtime failure on bounds: [lower=" + lower + ", upper=" + upper + "]", e);
+ }
+ catch (AssertionError e) {
+ throw new AssertionError("Assertion error on bounds: [lower=" + lower + ", upper=" + upper + "]", e);
+ }
+ finally {
+ checkDestroyed();
+ }
+ }
+
/** {@inheritDoc} */
@Override public T findFirst() throws IgniteCheckedException {
checkDestroyed();
@@ -4385,32 +4414,6 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure implements
*/
protected abstract T getRow(BPlusIO<L> io, long pageAddr, int idx, Object x) throws IgniteCheckedException;
- public interface RowPredicate<L, T extends L> {
- public boolean apply(BPlusTree<L, T> tree, BPlusIO<L> io, long pageAddr, int idx) throws IgniteCheckedException;
- }
-
- public T findOneBounded(L lower, L upper, RowPredicate<L, T> p, Object x) throws IgniteCheckedException {
- checkDestroyed();
-
- try {
- FindOneCursor cursor = new FindOneCursor(lower, upper, p, x);
-
- return cursor.findOne();
- }
- catch (IgniteCheckedException e) {
- throw new IgniteCheckedException("Runtime failure on bounds: [lower=" + lower + ", upper=" + upper + "]", e);
- }
- catch (RuntimeException e) {
- throw new IgniteException("Runtime failure on bounds: [lower=" + lower + ", upper=" + upper + "]", e);
- }
- catch (AssertionError e) {
- throw new AssertionError("Assertion error on bounds: [lower=" + lower + ", upper=" + upper + "]", e);
- }
- finally {
- checkDestroyed();
- }
- }
-
/**
*
*/
@@ -4996,4 +4999,11 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure implements
/** */
DONE
}
+
+ /**
+ *
+ */
+ public interface RowPredicate<L, T extends L> {
+ public boolean apply(BPlusTree<L, T> tree, BPlusIO<L> io, long pageAddr, int idx) throws IgniteCheckedException;
+ }
}