ignite-3682 review
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/13dbff06 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/13dbff06 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/13dbff06 Branch: refs/heads/master Commit: 13dbff06a1089eca499e46b35c59c5e31b8f295c Parents: 7e1d583 Author: agura <[email protected]> Authored: Mon Apr 10 21:17:55 2017 +0300 Committer: agura <[email protected]> Committed: Wed Apr 12 18:20:48 2017 +0300 ---------------------------------------------------------------------- .../ignite/internal/util/lang/GridFunc.java | 149 ++----------------- .../ignite/internal/util/lang/GridTupleV.java | 1 - .../lang/gridfunc/AlwaysFalsePredicate.java | 2 +- .../lang/gridfunc/ArrayListFactoryCallable.java | 41 ----- .../gridfunc/AtomicBooleanFactoryCallable.java | 40 ----- .../gridfunc/AtomicLongFactoryCallable.java | 40 ----- .../AtomicReferenceFactoryCallable.java | 40 ----- .../lang/gridfunc/CacheEntryGetKeyClosure.java | 40 ----- .../lang/gridfunc/ClusterNodeGetId8Closure.java | 41 ----- .../EntryByValueEvaluationPredicate.java | 53 ------- .../gridfunc/IsAssignableFromPredicate.java | 51 ------- .../util/lang/gridfunc/IsNotDonePredicate.java | 40 ----- .../util/lang/gridfunc/IsNullPredicate.java | 44 ------ .../gridfunc/LinkedListFactoryCallable.java | 40 ----- .../util/lang/gridfunc/UuidToId8Closure.java | 41 ----- .../datastreamer/DataStreamerImplSelfTest.java | 36 ----- 16 files changed, 14 insertions(+), 685 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/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 c93f077..64a364d 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 @@ -48,23 +48,15 @@ import org.apache.ignite.internal.util.GridLeanSet; import org.apache.ignite.internal.util.lang.gridfunc.AlwaysFalsePredicate; import org.apache.ignite.internal.util.lang.gridfunc.AlwaysTruePredicate; import org.apache.ignite.internal.util.lang.gridfunc.AlwaysTrueReducer; -import org.apache.ignite.internal.util.lang.gridfunc.ArrayListFactoryCallable; -import org.apache.ignite.internal.util.lang.gridfunc.AtomicBooleanFactoryCallable; import org.apache.ignite.internal.util.lang.gridfunc.AtomicIntegerFactoryCallable; -import org.apache.ignite.internal.util.lang.gridfunc.AtomicLongFactoryCallable; -import org.apache.ignite.internal.util.lang.gridfunc.AtomicReferenceFactoryCallable; -import org.apache.ignite.internal.util.lang.gridfunc.CacheEntryGetKeyClosure; import org.apache.ignite.internal.util.lang.gridfunc.CacheEntryGetValueClosure; import org.apache.ignite.internal.util.lang.gridfunc.CacheEntryHasPeekPredicate; -import org.apache.ignite.internal.util.lang.gridfunc.ClusterNodeGetId8Closure; import org.apache.ignite.internal.util.lang.gridfunc.ClusterNodeGetIdClosure; import org.apache.ignite.internal.util.lang.gridfunc.ConcurrentDequeFactoryCallable; import org.apache.ignite.internal.util.lang.gridfunc.ConcurrentHashSetFactoryCallable; import org.apache.ignite.internal.util.lang.gridfunc.ConcurrentMapFactoryCallable; import org.apache.ignite.internal.util.lang.gridfunc.ContainsNodeIdsPredicate; import org.apache.ignite.internal.util.lang.gridfunc.ContainsPredicate; -import org.apache.ignite.internal.util.lang.gridfunc.EntryByKeyEvaluationPredicate; -import org.apache.ignite.internal.util.lang.gridfunc.EntryByValueEvaluationPredicate; import org.apache.ignite.internal.util.lang.gridfunc.EqualsClusterNodeIdPredicate; import org.apache.ignite.internal.util.lang.gridfunc.EqualsUuidPredicate; import org.apache.ignite.internal.util.lang.gridfunc.FlatCollectionWrapper; @@ -74,12 +66,8 @@ import org.apache.ignite.internal.util.lang.gridfunc.HasNotEqualIdPredicate; import org.apache.ignite.internal.util.lang.gridfunc.IdentityClosure; import org.apache.ignite.internal.util.lang.gridfunc.IntSumReducer; import org.apache.ignite.internal.util.lang.gridfunc.IsAllPredicate; -import org.apache.ignite.internal.util.lang.gridfunc.IsAssignableFromPredicate; import org.apache.ignite.internal.util.lang.gridfunc.IsNotAllPredicate; -import org.apache.ignite.internal.util.lang.gridfunc.IsNotDonePredicate; import org.apache.ignite.internal.util.lang.gridfunc.IsNotNullPredicate; -import org.apache.ignite.internal.util.lang.gridfunc.IsNullPredicate; -import org.apache.ignite.internal.util.lang.gridfunc.LinkedListFactoryCallable; import org.apache.ignite.internal.util.lang.gridfunc.LongSumReducer; import org.apache.ignite.internal.util.lang.gridfunc.MapFactoryCallable; import org.apache.ignite.internal.util.lang.gridfunc.MultipleIterator; @@ -99,7 +87,6 @@ import org.apache.ignite.internal.util.lang.gridfunc.TransformCollectionView; import org.apache.ignite.internal.util.lang.gridfunc.TransformFilteringIterator; import org.apache.ignite.internal.util.lang.gridfunc.TransformMapView; import org.apache.ignite.internal.util.lang.gridfunc.TransformMapView2; -import org.apache.ignite.internal.util.lang.gridfunc.UuidToId8Closure; 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; @@ -153,12 +140,6 @@ public class GridFunc { private static final IgnitePredicate<Object> IS_NOT_NULL = new IsNotNullPredicate(); /** */ - private static final IgniteCallable<?> LIST_FACTORY = new ArrayListFactoryCallable(); - - /** */ - private static final IgniteCallable<?> LINKED_LIST_FACTORY = new LinkedListFactoryCallable(); - - /** */ private static final IgniteCallable<?> SET_FACTORY = new SetFactoryCallable(); /** */ @@ -174,9 +155,6 @@ public class GridFunc { private static final IgniteCallable<?> CONCURRENT_SET_FACTORY = new ConcurrentHashSetFactoryCallable(); /** */ - private static final IgniteClosure CACHE_ENTRY_KEY = new CacheEntryGetKeyClosure(); - - /** */ private static final IgniteClosure CACHE_ENTRY_VAL_GET = new CacheEntryGetValueClosure(); /** */ @@ -185,15 +163,6 @@ public class GridFunc { /** */ private static final IgniteClosure<ClusterNode, UUID> NODE2ID = new ClusterNodeGetIdClosure(); - /** */ - private static final IgniteClosure<ClusterNode, String> NODE2ID8 = new ClusterNodeGetId8Closure(); - - /** */ - private static final IgniteClosure<UUID, String> ID2ID8 = new UuidToId8Closure(); - - /** */ - private static final IgnitePredicate<IgniteInternalFuture<?>> UNFINISHED_FUTURE = new IsNotDonePredicate(); - /** * Gets predicate that evaluates to {@code true} only for given local node ID. * @@ -314,17 +283,6 @@ public class GridFunc { } /** - * Gets reducer closure that concatenates strings using provided delimiter. - * - * @param delim Delimiter (optional). - * @return Reducer that concatenates strings using provided delimeter. - */ - @Deprecated - public static IgniteReducer<String, String> concatReducer(@Nullable final String delim) { - return new StringConcatReducer(delim); - } - - /** * Concatenates strings using provided delimiter. * * @param c Input collection. @@ -334,7 +292,13 @@ public class GridFunc { public static String concat(Iterable<String> c, @Nullable String delim) { A.notNull(c, "c"); - return reduce(c, concatReducer(delim)); + IgniteReducer<? super String, String> f = new StringConcatReducer(delim); + + for (String x : c) + if (!f.collect(x)) + break; + + return f.reduce(); } /** @@ -355,43 +319,6 @@ public class GridFunc { } /** - * Convenient utility method that returns collection of node ID8s for a given - * collection of grid nodes. ID8 is a shorter string representation of node ID, - * mainly the first 8 characters. - * <p> - * Note that this method doesn't create a new collection but simply iterates - * over the input one. - * - * @param nodes Collection of grid nodes. - * @return Collection of node IDs for given collection of grid nodes. - */ - public static Collection<String> nodeId8s(@Nullable Collection<? extends ClusterNode> nodes) { - if (nodes == null || nodes.isEmpty()) - return Collections.emptyList(); - - return F.viewReadOnly(nodes, NODE2ID8); - } - - /** - * Convenient utility method that returns collection of node ID8s for a given - * collection of node IDs. ID8 is a shorter string representation of node ID, - * mainly the first 8 characters. - * <p> - * Note that this method doesn't create a new collection but simply iterates - * over the input one. - * - * @param ids Collection of nodeIds. - * @return Collection of node IDs for given collection of grid nodes. - */ - @Deprecated - public static Collection<String> id8s(@Nullable Collection<UUID> ids) { - if (ids == null || ids.isEmpty()) - return Collections.emptyList(); - - return F.viewReadOnly(ids, ID2ID8); - } - - /** * Gets random value from given collection. * * @param c Input collection (no {@code null} and not emtpy). @@ -1064,9 +991,7 @@ public class GridFunc { if (isEmpty(c) || isAlwaysFalse(p)) return Collections.emptyList(); - assert c != null; - - return new TransformCollectionView<T2, T1>(c, trans, p); + return new TransformCollectionView<>(c, trans, p); } /** @@ -1109,7 +1034,7 @@ public class GridFunc { if (isEmpty(m) || isAlwaysFalse(p)) return Collections.emptyMap(); - return isEmpty(p) || isAlwaysTrue(p) ? m : new PredicateMapView<K, V>(m, p); + return isEmpty(p) || isAlwaysTrue(p) ? m : new PredicateMapView<>(m, p); } /** @@ -1134,9 +1059,7 @@ public class GridFunc { if (isEmpty(m) || isAlwaysFalse(p)) return Collections.emptyMap(); - assert m != null; - - return new TransformMapView<K, V1, V>(m, trans, p); + return new TransformMapView<>(m, trans, p); } /** @@ -1162,7 +1085,7 @@ public class GridFunc { if (isEmpty(m) || isAlwaysFalse(p)) return Collections.emptyMap(); - return new TransformMapView2<K, V, V1>(m, trans, p); + return new TransformMapView2<>(m, trans, p); } /** @@ -1189,7 +1112,7 @@ public class GridFunc { if (isEmpty(c) || isAlwaysFalse(p)) return Collections.emptyMap(); - return new PredicateSetView<K, V>(c, mapClo, p); + return new PredicateSetView<>(c, mapClo, p); } /** @@ -1906,27 +1829,6 @@ public class GridFunc { } /** - * Reduces collection into single value using given for-all closure. - * - * @param c Collection to reduce. - * @param f For-all closure used for reduction. - * @param <X> Type of the free variable for the closure and type of the - * collection elements. - * @param <Y> Type of the closure's return value. - * @return Single value as a result of collection reduction. - */ - @Deprecated - public static <X, Y> Y reduce(Iterable<? extends X> c, IgniteReducer<? super X, Y> f) { - A.notNull(c, "c", f, "f"); - - for (X x : c) - if (!f.collect(x)) - break; - - return f.reduce(); - } - - /** * Calls given {@code side-effect only} closure over the each element of the provided * collection. * @@ -2543,19 +2445,6 @@ public class GridFunc { } /** - * Creates vararg tuple with given values. - * - * @param objs Values for vararg tuple. - * @return Vararg tuple with given values. - */ - @Deprecated - public static GridTupleV tv(Object... objs) { - assert objs != null; - - return new GridTupleV(objs); - } - - /** * Factory method returning new empty tuple. * * @param <V1> Type of the 1st tuple parameter. @@ -2794,7 +2683,7 @@ public class GridFunc { * @param <T> Element's type. * @return Created set. */ - @SuppressWarnings( {"RedundantTypeArguments"}) + @SuppressWarnings({"RedundantTypeArguments"}) @Deprecated public static <T> Set<T> asSet(@Nullable T... t) { if (t == null || t.length == 0) @@ -3087,18 +2976,6 @@ public class GridFunc { } /** - * Gets closure that returns key for cache entry. The closure internally - * delegates to {@link javax.cache.Cache.Entry#getKey()} method. - * - * @param <K> Key type. - * @return Closure that returns key for an entry. - */ - @SuppressWarnings({"unchecked"}) - public static <K, V> IgniteClosure<Cache.Entry<K, V>, K> cacheEntry2Key() { - return (IgniteClosure<Cache.Entry<K, V>, K>)CACHE_ENTRY_KEY; - } - - /** * Gets closure that returns value for an entry. The closure internally * delegates to {@link javax.cache.Cache.Entry#get(Object)} method. * http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java index 89c8ee2..9fcb69c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java @@ -35,7 +35,6 @@ import org.apache.ignite.internal.util.typedef.internal.U; * This class doesn't provide any synchronization for multi-threaded access * and it is responsibility of the user of this class to provide outside * synchronization, if needed. - * @see GridFunc#tv(Object...) */ @Deprecated public class GridTupleV implements Iterable<Object>, Externalizable, Cloneable { http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AlwaysFalsePredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AlwaysFalsePredicate.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AlwaysFalsePredicate.java index 6e1dbb5..3689e75 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AlwaysFalsePredicate.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AlwaysFalsePredicate.java @@ -36,7 +36,7 @@ public class AlwaysFalsePredicate<E> implements IgnitePredicate<E> { * @return Always <code>false</code> */ @Override public boolean apply(E e) { - return true; + return false; } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ArrayListFactoryCallable.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ArrayListFactoryCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ArrayListFactoryCallable.java deleted file mode 100644 index 7612e49..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ArrayListFactoryCallable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import java.util.ArrayList; -import java.util.List; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteCallable; - -/** - * Array list factory. - */ -public class ArrayListFactoryCallable implements IgniteCallable<List> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public ArrayList call() { - return new ArrayList(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(ArrayListFactoryCallable.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicBooleanFactoryCallable.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicBooleanFactoryCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicBooleanFactoryCallable.java deleted file mode 100644 index 7084e70..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicBooleanFactoryCallable.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteCallable; - -/** - * Atomic boolean factory. - */ -public class AtomicBooleanFactoryCallable implements IgniteCallable<AtomicBoolean> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public AtomicBoolean call() { - return new AtomicBoolean(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(AtomicBooleanFactoryCallable.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicLongFactoryCallable.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicLongFactoryCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicLongFactoryCallable.java deleted file mode 100644 index c7074b2..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicLongFactoryCallable.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import java.util.concurrent.atomic.AtomicLong; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteCallable; - -/** - * Atomic long factory. - */ -public class AtomicLongFactoryCallable implements IgniteCallable<AtomicLong> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public AtomicLong call() { - return new AtomicLong(0); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(AtomicLongFactoryCallable.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicReferenceFactoryCallable.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicReferenceFactoryCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicReferenceFactoryCallable.java deleted file mode 100644 index 6c20880..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/AtomicReferenceFactoryCallable.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import java.util.concurrent.atomic.AtomicReference; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteCallable; - -/** - * Atomic reference factory. - */ -public class AtomicReferenceFactoryCallable implements IgniteCallable<AtomicReference> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public AtomicReference call() { - return new AtomicReference(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(AtomicReferenceFactoryCallable.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/CacheEntryGetKeyClosure.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/CacheEntryGetKeyClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/CacheEntryGetKeyClosure.java deleted file mode 100644 index 98d1c8a..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/CacheEntryGetKeyClosure.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import javax.cache.Cache; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteClosure; - -/** - * Map entry to key transformer closure. - */ -public class CacheEntryGetKeyClosure implements IgniteClosure { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public Object apply(Object o) { - return ((Cache.Entry)o).getKey(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(CacheEntryGetKeyClosure.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ClusterNodeGetId8Closure.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ClusterNodeGetId8Closure.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ClusterNodeGetId8Closure.java deleted file mode 100644 index 9568cdf..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ClusterNodeGetId8Closure.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteClosure; - -/** - * Grid node to node ID8 transformer closure. - */ -public class ClusterNodeGetId8Closure implements IgniteClosure<ClusterNode, String> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public String apply(ClusterNode n) { - return U.id8(n.id()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(ClusterNodeGetId8Closure.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/EntryByValueEvaluationPredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/EntryByValueEvaluationPredicate.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/EntryByValueEvaluationPredicate.java deleted file mode 100644 index 77099da..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/EntryByValueEvaluationPredicate.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import java.util.Map; -import org.apache.ignite.internal.util.lang.GridFunc; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * Predicate evaluates to true for given value. - * Note that evaluation will be short-circuit when first predicate evaluated to false is found. - */ -public class EntryByValueEvaluationPredicate<K, V> implements IgnitePredicate<Map.Entry<K, V>> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final IgnitePredicate<? super V>[] preds; - - /** - * @param preds Optional set of predicates to use for filtration. If none provided - original map (or its copy) will be - * returned. - */ - public EntryByValueEvaluationPredicate(IgnitePredicate<? super V>... preds) { - this.preds = preds; - } - - /** {@inheritDoc} */ - @Override public boolean apply(Map.Entry<K, V> e) { - return GridFunc.isAll(e.getValue(), preds); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(EntryByValueEvaluationPredicate.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsAssignableFromPredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsAssignableFromPredicate.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsAssignableFromPredicate.java deleted file mode 100644 index 51838e4..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsAssignableFromPredicate.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import org.apache.ignite.internal.util.typedef.P1; -import org.apache.ignite.internal.util.typedef.internal.S; - -/** - * Predicate that evaluates to {@code true} if its free variable is instance of the given class. - * - * @param <T> Type of the free variable, i.e. the element the predicate is called on. - */ -public class IsAssignableFromPredicate<T> implements P1<T> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final Class<?> cls; - - /** - * @param cls Class to compare to. - */ - public IsAssignableFromPredicate(Class<?> cls) { - this.cls = cls; - } - - /** {@inheritDoc} */ - @Override public boolean apply(T t) { - return t != null && cls.isAssignableFrom(t.getClass()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IsAssignableFromPredicate.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsNotDonePredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsNotDonePredicate.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsNotDonePredicate.java deleted file mode 100644 index 4d9762d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsNotDonePredicate.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * IgniteInternalFuture is not done predicate. - */ -public class IsNotDonePredicate implements IgnitePredicate<IgniteInternalFuture<?>> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public boolean apply(IgniteInternalFuture<?> f) { - return !f.isDone(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IsNotDonePredicate.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsNullPredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsNullPredicate.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsNullPredicate.java deleted file mode 100644 index 7972928..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IsNullPredicate.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * Defines a predicate which checks a parameter on <code>null</code>. - * - * @param <E> Type of predicate parameter. - */ -public class IsNullPredicate<E> implements IgnitePredicate<E> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param e Parameter for check. - * @return 'true' if parameter equals to <code>null</code>, otherwise 'false'. - */ - @Override public boolean apply(E e) { - return e == null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IsNullPredicate.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/LinkedListFactoryCallable.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/LinkedListFactoryCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/LinkedListFactoryCallable.java deleted file mode 100644 index 4bf9948..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/LinkedListFactoryCallable.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import java.util.LinkedList; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteCallable; - -/** - * Linked list factory. - */ -public class LinkedListFactoryCallable implements IgniteCallable<LinkedList> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public LinkedList call() { - return new LinkedList(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(LinkedListFactoryCallable.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/UuidToId8Closure.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/UuidToId8Closure.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/UuidToId8Closure.java deleted file mode 100644 index dcf165b..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/UuidToId8Closure.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.ignite.internal.util.lang.gridfunc; - -import java.util.UUID; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteClosure; - -/** - * UUID to ID8 transformer closure. - */ -public class UuidToId8Closure implements IgniteClosure<UUID, String> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public String apply(UUID id) { - return U.id8(id); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(UuidToId8Closure.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/13dbff06/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java index 514c070..ca8b192 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java @@ -17,7 +17,6 @@ package org.apache.ignite.internal.processors.datastreamer; -import java.io.Serializable; import java.util.Map; import java.util.Random; import java.util.concurrent.Callable; @@ -249,39 +248,4 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest { return cacheCfg; } - - /** - * - */ - private static class TestObject implements Serializable { - /** */ - private int val; - - /** - */ - private TestObject() { - // No-op. - } - - /** - * @param val Value. - */ - private TestObject(int val) { - this.val = val; - } - - public Integer val() { - return val; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return val; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object obj) { - return obj instanceof TestObject && ((TestObject)obj).val == val; - } - } }
