You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/12/30 14:53:43 UTC
[1/3] ignite git commit: IGNITE-2263: Removed "nodeForNodes" method.
Repository: ignite
Updated Branches:
refs/heads/ignite-2263 9a417ce96 -> 2f1fbb955
IGNITE-2263: Removed "nodeForNodes" method.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/74b56178
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/74b56178
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/74b56178
Branch: refs/heads/ignite-2263
Commit: 74b5617820d32459b7702fd1967c3e162ae0f96b
Parents: 9a417ce
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 16:47:06 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 16:47:06 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/cluster/ClusterGroupAdapter.java | 3 ++-
.../org/apache/ignite/internal/util/lang/GridFunc.java | 13 -------------
2 files changed, 2 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/74b56178/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
index 75168a1..74e63a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
@@ -51,6 +51,7 @@ import org.apache.ignite.internal.IgniteServicesImpl;
import org.apache.ignite.internal.IgnitionEx;
import org.apache.ignite.internal.executor.GridExecutorService;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
+import org.apache.ignite.internal.util.lang.GridNodePredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -919,7 +920,7 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
ClusterNode node = isOldest ? U.oldest(super.nodes(), null) : U.youngest(super.nodes(), null);
- IgnitePredicate<ClusterNode> p = F.nodeForNodes(node);
+ IgnitePredicate<ClusterNode> p = new GridNodePredicate(Collections.singleton(node.id()));
state = new AgeClusterGroupState(node, p, lastTopVer);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/74b56178/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
index 9c5cad7..f932e7b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
@@ -970,19 +970,6 @@ public class GridFunc {
}
/**
- * Creates predicates that evaluates to {@code true} for each node in given collection.
- * Note that if collection is empty the result predicate will always evaluate to {@code false}.
- * Implementation simply creates {@link GridNodePredicate} instance.
- *
- * @param nodes Collection of nodes. If none provided - result predicate will always
- * return {@code false}.
- * @return Predicates that evaluates to {@code true} for each node in given collection.
- */
- public static IgnitePredicate<ClusterNode> nodeForNodes(ClusterNode... nodes) {
- return new GridNodePredicate(nodes);
- }
-
- /**
* Retains all elements in input collection that are contained in {@code filter}.
*
* @param c Input collection.
[3/3] ignite git commit: IGNITE-2263: Simplified iterator(Iterator,
transformer) method - no predicates are ever passed.
Posted by vo...@apache.org.
IGNITE-2263: Simplified iterator(Iterator, transformer) method - no predicates are ever passed.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2f1fbb95
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2f1fbb95
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2f1fbb95
Branch: refs/heads/ignite-2263
Commit: 2f1fbb95570bd7199c1fa4fdcf05daf039167142
Parents: 28b984a
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 16:54:40 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 16:54:40 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/util/lang/GridFunc.java | 64 +-------------------
1 file changed, 3 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f1fbb95/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
index e563616..e1d7b82 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
@@ -1993,80 +1993,22 @@ public class GridFunc {
* @param trans Transforming closure to convert from T1 to T2.
* @param readOnly If {@code true}, then resulting iterator will not allow modifications
* to the underlying collection.
- * @param p Optional filtering predicates.
* @return Iterator from given iterator and optional filtering predicate.
*/
public static <T1, T2> Iterator<T2> iterator(final Iterator<? extends T1> c,
- final IgniteClosure<? super T1, T2> trans,
- final boolean readOnly,
- @Nullable final IgnitePredicate<? super T1>... p)
- {
+ final IgniteClosure<? super T1, T2> trans, final boolean readOnly) {
A.notNull(c, "c", trans, "trans");
- if (isAlwaysFalse(p))
- return F.emptyIterator();
-
return new GridIteratorAdapter<T2>() {
/** */
- private T1 elem;
-
- /** */
- private boolean moved = true;
-
- /** */
- private boolean more;
-
- /** */
private Iterator<? extends T1> iter = c;
@Override public boolean hasNextX() {
- if (isEmpty(p))
- return iter.hasNext();
- else {
- if (!moved)
- return more;
- else {
- more = false;
-
- while (iter.hasNext()) {
- elem = iter.next();
-
- boolean isAll = true;
-
- for (IgnitePredicate<? super T1> r : p)
- if (r != null && !r.apply(elem)) {
- isAll = false;
-
- break;
- }
-
- if (isAll) {
- more = true;
- moved = false;
-
- return true;
- }
- }
-
- elem = null; // Give to GC.
-
- return false;
- }
- }
+ return iter.hasNext();
}
@Nullable @Override public T2 nextX() {
- if (isEmpty(p))
- return trans.apply(iter.next());
- else {
- if (hasNext()) {
- moved = true;
-
- return trans.apply(elem);
- }
- else
- throw new NoSuchElementException();
- }
+ return trans.apply(iter.next());
}
@Override public void removeX() {
[2/3] ignite git commit: IGNITE-2263: Rename iterator0 ->
identityIterator.
Posted by vo...@apache.org.
IGNITE-2263: Rename iterator0 -> identityIterator.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/28b984a4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/28b984a4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/28b984a4
Branch: refs/heads/ignite-2263
Commit: 28b984a4e11a288cd05e25b2cad3c902dfb53e27
Parents: 74b5617
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Dec 30 16:51:16 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 30 16:51:16 2015 +0300
----------------------------------------------------------------------
.../internal/processors/cache/GridCacheIterator.java | 2 +-
.../cache/distributed/near/GridNearCacheAdapter.java | 8 ++++----
.../org/apache/ignite/internal/util/lang/GridFunc.java | 10 +++++-----
3 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/28b984a4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIterator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIterator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIterator.java
index 19da4a8..4644e59 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIterator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIterator.java
@@ -57,7 +57,7 @@ public class GridCacheIterator<K, V, T> implements GridSerializableIterator<T> {
) {
this.cctx = cctx;
- it = F.iterator0(c, false, filter);
+ it = F.identityIterator(c, false, filter);
this.trans = trans;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/28b984a4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index ce17d03..51f795a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -559,12 +559,12 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
/** {@inheritDoc} */
@NotNull @Override public Iterator<Cache.Entry<K, V>> iterator() {
return new EntryIterator(nearSet.iterator(),
- F.iterator0(dhtSet, false, new P1<Cache.Entry<K, V>>() {
- @Override public boolean apply(Cache.Entry<K, V> e) {
+ F.identityIterator(dhtSet, false, new P1<Cache.Entry<K, V>>() {
+ @Override
+ public boolean apply(Cache.Entry<K, V> e) {
try {
return GridNearCacheAdapter.super.localPeek(e.getKey(), NEAR_PEEK_MODE, null) == null;
- }
- catch (IgniteCheckedException ex) {
+ } catch (IgniteCheckedException ex) {
throw new IgniteException(ex);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/28b984a4/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
index f932e7b..e563616 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
@@ -1363,7 +1363,7 @@ public class GridFunc {
@NotNull
@Override public Iterator<T> iterator() {
- return F.iterator0(c, false, p);
+ return F.identityIterator(c, false, p);
}
@Override public int size() {
@@ -1449,7 +1449,7 @@ public class GridFunc {
return new GridSerializableSet<Map.Entry<K, V>>() {
@NotNull
@Override public Iterator<Entry<K, V>> iterator() {
- return iterator0(m.entrySet(), false, ep);
+ return identityIterator(m.entrySet(), false, ep);
}
@Override public int size() {
@@ -1535,7 +1535,7 @@ public class GridFunc {
@NotNull
@Override public Iterator<Entry<K, V1>> iterator() {
return new Iterator<Entry<K, V1>>() {
- private Iterator<Entry<K, V>> it = iterator0(m.entrySet(), true, ep);
+ private Iterator<Entry<K, V>> it = identityIterator(m.entrySet(), true, ep);
@Override public boolean hasNext() {
return it.hasNext();
@@ -1652,7 +1652,7 @@ public class GridFunc {
return new GridSerializableSet<Entry<K, V>>() {
@NotNull @Override public Iterator<Entry<K, V>> iterator() {
return new Iterator<Entry<K, V>>() {
- private Iterator<K> it = iterator0(c, true, ep);
+ private Iterator<K> it = identityIterator(c, true, ep);
@Override public boolean hasNext() {
return it.hasNext();
@@ -1887,7 +1887,7 @@ public class GridFunc {
* @return Iterator from given collection and optional filtering predicate.
*/
@SuppressWarnings({"unchecked"})
- public static <T> GridIterator<T> iterator0(Iterable<? extends T> c, boolean readOnly,
+ public static <T> GridIterator<T> identityIterator(Iterable<? extends T> c, boolean readOnly,
IgnitePredicate<? super T>... p) {
return F.iterator(c, IDENTITY, readOnly, p);
}