http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableConcurrentHashMapFactory.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableConcurrentHashMapFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableConcurrentHashMapFactory.java deleted file mode 100644 index ca50a0b..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableConcurrentHashMapFactory.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.concurrent.ConcurrentMap; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteCallable; -import org.jsr166.ConcurrentHashMap8; - -/** - * Concurrent hash map factory. - */ -public class IgniteCallableConcurrentHashMapFactory implements IgniteCallable<ConcurrentMap> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public ConcurrentMap call() { - return new ConcurrentHashMap8(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteCallableConcurrentHashMapFactory.class, this); - } -}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableConcurrentHashSetFactory.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableConcurrentHashSetFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableConcurrentHashSetFactory.java deleted file mode 100644 index 0a52e4d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableConcurrentHashSetFactory.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.util.GridConcurrentHashSet; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteCallable; - -/** - * Concurrent hash set factory. - */ -public class IgniteCallableConcurrentHashSetFactory implements IgniteCallable<GridConcurrentHashSet> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public GridConcurrentHashSet call() { - return new GridConcurrentHashSet(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteCallableConcurrentHashSetFactory.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableDequeFactory.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableDequeFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableDequeFactory.java deleted file mode 100644 index 9dcc3b5..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableDequeFactory.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.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteCallable; -import org.jsr166.ConcurrentLinkedDeque8; - -/** - * Deque factory. - */ -public class IgniteCallableDequeFactory implements IgniteCallable<ConcurrentLinkedDeque8> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public ConcurrentLinkedDeque8 call() { - return new ConcurrentLinkedDeque8(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteCallableDequeFactory.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableHashMapFactory.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableHashMapFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableHashMapFactory.java deleted file mode 100644 index b361354..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableHashMapFactory.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.HashMap; -import java.util.Map; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteCallable; - -/** - * Hash map factory. - */ -public class IgniteCallableHashMapFactory implements IgniteCallable<Map> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public Map call() { - return new HashMap(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteCallableHashMapFactory.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableHashSetFactory.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableHashSetFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableHashSetFactory.java deleted file mode 100644 index 22d0d10..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableHashSetFactory.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.HashSet; -import java.util.Set; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteCallable; - -/** - * Hash set factory. - */ -public class IgniteCallableHashSetFactory implements IgniteCallable<Set> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public Set call() { - return new HashSet(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteCallableHashSetFactory.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableLinkedListFactory.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableLinkedListFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableLinkedListFactory.java deleted file mode 100644 index 34c4eab..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteCallableLinkedListFactory.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 IgniteCallableLinkedListFactory 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(IgniteCallableLinkedListFactory.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureCacheGet.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureCacheGet.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureCacheGet.java deleted file mode 100644 index 2fef35e..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureCacheGet.java +++ /dev/null @@ -1,42 +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; -import org.jetbrains.annotations.Nullable; - -/** - * Cache entry to get-value transformer closure. - */ -public class IgniteClosureCacheGet implements IgniteClosure { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @SuppressWarnings({"unchecked"}) - @Nullable @Override public Object apply(Object o) { - return ((Cache.Entry)o).getValue(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteClosureCacheGet.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureCacheGetKey.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureCacheGetKey.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureCacheGetKey.java deleted file mode 100644 index e9cb267..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureCacheGetKey.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 IgniteClosureCacheGetKey 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(IgniteClosureCacheGetKey.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureClusterNodeGetId.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureClusterNodeGetId.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureClusterNodeGetId.java deleted file mode 100644 index 155b075..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureClusterNodeGetId.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.cluster.ClusterNode; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteClosure; - -/** - * Grid node to node ID transformer closure. - */ -public class IgniteClosureClusterNodeGetId implements IgniteClosure<ClusterNode, UUID> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public UUID apply(ClusterNode n) { - return n.id(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteClosureClusterNodeGetId.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureClusterNodeGetId8.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureClusterNodeGetId8.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureClusterNodeGetId8.java deleted file mode 100644 index af1641e..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureClusterNodeGetId8.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 IgniteClosureClusterNodeGetId8 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(IgniteClosureClusterNodeGetId8.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureIdentity.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureIdentity.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureIdentity.java deleted file mode 100644 index 52d872a..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureIdentity.java +++ /dev/null @@ -1,39 +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.IgniteClosure; - -/** - * Identity closure. - */ -public class IgniteClosureIdentity implements IgniteClosure { - /** */ - private static final long serialVersionUID = -6338573080046225172L; - - /** {@inheritDoc} */ - @Override public Object apply(Object o) { - return o; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteClosureIdentity.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureToString.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureToString.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureToString.java deleted file mode 100644 index a5adfea..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureToString.java +++ /dev/null @@ -1,42 +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.C1; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.jetbrains.annotations.Nullable; - -/** - * Closure that return {@code toString()} value for its free variable. - * - * @param <T> Type of the free variable for the closure. - */ -public class IgniteClosureToString<T> implements C1<T, String> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public String apply(@Nullable T t) { - return String.valueOf(t); // This is null-safe. - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteClosureToString.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureUUIDToId8Transformer.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureUUIDToId8Transformer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureUUIDToId8Transformer.java deleted file mode 100644 index fc5fc04..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteClosureUUIDToId8Transformer.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 IgniteClosureUUIDToId8Transformer 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(IgniteClosureUUIDToId8Transformer.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteOutClosureWrapper.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteOutClosureWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteOutClosureWrapper.java deleted file mode 100644 index fdf1245..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteOutClosureWrapper.java +++ /dev/null @@ -1,58 +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.IgniteClosure; -import org.apache.ignite.lang.IgniteOutClosure; - -/** - * Wraps given closure. - * - * @param <T> Input type. - * @param <R> Output type. - */ -public class IgniteOutClosureWrapper<T, R> implements IgniteOutClosure<R> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final IgniteClosure<? super T, R> closure; - - /** */ - private final T closureArgument; - - /** - * @param closure Closure - * @param closureArgument Parameter - */ - public IgniteOutClosureWrapper(IgniteClosure<? super T, R> closure, T closureArgument) { - this.closure = closure; - this.closureArgument = closureArgument; - } - - /** {@inheritDoc} */ - @Override public R apply() { - return closure.apply(closureArgument); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteOutClosureWrapper.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateAlwaysFalse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateAlwaysFalse.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateAlwaysFalse.java deleted file mode 100644 index 297e749..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateAlwaysFalse.java +++ /dev/null @@ -1,46 +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 accepts a parameter and always returns {@code false} - * - * @param <E> Type of predicate parameter. - */ -public class IgnitePredicateAlwaysFalse<E> implements IgnitePredicate<E> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Predicate body. - * - * @param e Predicate parameter. - * @return Always <code>false</code> - */ - @Override public boolean apply(E e) { - return true; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateAlwaysFalse.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateAlwaysTrue.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateAlwaysTrue.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateAlwaysTrue.java deleted file mode 100644 index ff0f96e..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateAlwaysTrue.java +++ /dev/null @@ -1,46 +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 accepts a parameter and always returns {@code true} - * - * @param <E> Type of predicate parameter. - */ -public class IgnitePredicateAlwaysTrue<E> implements IgnitePredicate<E> { - /** */ - private static final long serialVersionUID = 6101914246981105862L; - - /** - * Predicate body. - * - * @param e Predicate parameter. - * @return Always <code>true</code>. - */ - @Override public boolean apply(E e) { - return true; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateAlwaysTrue.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateCacheHasPeek.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateCacheHasPeek.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateCacheHasPeek.java deleted file mode 100644 index b286f50..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateCacheHasPeek.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 javax.cache.Cache; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * Cache entry has-peek-value predicate. - */ -public class IgnitePredicateCacheHasPeek implements IgnitePredicate { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @SuppressWarnings({"unchecked"}) - @Override public boolean apply(Object o) { - return ((Cache.Entry)o).getValue() != null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateCacheHasPeek.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateContainNodeId.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateContainNodeId.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateContainNodeId.java deleted file mode 100644 index 0911e37..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateContainNodeId.java +++ /dev/null @@ -1,52 +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.Collection; -import java.util.UUID; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * Grid node predicate evaluating on the given node IDs. - */ -public class IgnitePredicateContainNodeId<T extends ClusterNode> implements IgnitePredicate<T> { - /** */ - private static final long serialVersionUID = -5664060422647374863L; - - /** */ - private final Collection<UUID> nodeIds; - - /** - * @param nodeIds (Collection) - */ - public IgnitePredicateContainNodeId(Collection<UUID> nodeIds) { - this.nodeIds = nodeIds; - } - - /** {@inheritDoc} */ - @Override public boolean apply(ClusterNode e) { - return nodeIds.contains(e.id()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateContainNodeId.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateContainWrapper.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateContainWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateContainWrapper.java deleted file mode 100644 index 546686c..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateContainWrapper.java +++ /dev/null @@ -1,55 +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.Collection; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * Predicate which returns {@code true} if it receives an element that is contained in the passed in - * collection. - * - * @param <T> Type of the free variable for the predicate and type of the collection elements. - */ -public class IgnitePredicateContainWrapper<T> implements IgnitePredicate<T> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final Collection<? extends T> c; - - /** - * @param c Collection to check for containment. - */ - public IgnitePredicateContainWrapper(Collection<? extends T> c) { - this.c = c; - } - - /** {@inheritDoc} */ - @Override public boolean apply(T t) { - assert c != null; - - return c.contains(t); - } - - /** {@inheritDoc} */ - public String toString() { - return S.toString(IgnitePredicateContainWrapper.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEqualsClusterNodeId.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEqualsClusterNodeId.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEqualsClusterNodeId.java deleted file mode 100644 index 4283068..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEqualsClusterNodeId.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 java.util.UUID; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * Creates grid node predicate evaluating on the given node ID. - */ -public class IgnitePredicateEqualsClusterNodeId<T extends ClusterNode> implements IgnitePredicate<T> { - /** */ - private static final long serialVersionUID = -7082730222779476623L; - - /** */ - private final UUID nodeId; - - /** - * @param nodeId (Collection) - */ - public IgnitePredicateEqualsClusterNodeId(UUID nodeId) { - this.nodeId = nodeId; - } - - /** {@inheritDoc} */ - @Override public boolean apply(ClusterNode e) { - return e.id().equals(nodeId); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateEqualsClusterNodeId.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEqualsUUID.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEqualsUUID.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEqualsUUID.java deleted file mode 100644 index 326fe95..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEqualsUUID.java +++ /dev/null @@ -1,50 +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.lang.IgnitePredicate; - -/** - * UUID equals predicate. - */ -public class IgnitePredicateEqualsUUID implements IgnitePredicate<UUID> { - /** */ - private static final long serialVersionUID = -5664060422647374863L; - - /** */ - private final UUID nodeId; - - /** - * @param nodeId Node ID for which returning predicate will evaluate to {@code true}. - */ - public IgnitePredicateEqualsUUID(UUID nodeId) { - this.nodeId = nodeId; - } - - /** {@inheritDoc} */ - @Override public boolean apply(UUID id) { - return id.equals(nodeId); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateEqualsUUID.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEvaluateEntryByKey.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEvaluateEntryByKey.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEvaluateEntryByKey.java deleted file mode 100644 index a8eca85..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEvaluateEntryByKey.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 IgnitePredicateEvaluateEntryByKey<K, V> implements IgnitePredicate<Map.Entry<K, V>> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final IgnitePredicate<? super K>[] predicates; - - /** - * @param predicates Optional set of predicates to use for filtration. If none provided - original map (or its copy) will be - * returned. - */ - public IgnitePredicateEvaluateEntryByKey(IgnitePredicate<? super K>... predicates) { - this.predicates = predicates; - } - - /** {@inheritDoc} */ - @Override public boolean apply(Map.Entry<K, V> e) { - return GridFunc.isAll(e.getKey(), predicates); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateEvaluateEntryByKey.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEvaluateEntryByValue.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEvaluateEntryByValue.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEvaluateEntryByValue.java deleted file mode 100644 index a082c4e..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateEvaluateEntryByValue.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 IgnitePredicateEvaluateEntryByValue<K, V> implements IgnitePredicate<Map.Entry<K, V>> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final IgnitePredicate<? super V>[] predicates; - - /** - * @param predicates Optional set of predicates to use for filtration. If none provided - original map (or its copy) will be - * returned. - */ - public IgnitePredicateEvaluateEntryByValue(IgnitePredicate<? super V>... predicates) { - this.predicates = predicates; - } - - /** {@inheritDoc} */ - @Override public boolean apply(Map.Entry<K, V> e) { - return GridFunc.isAll(e.getValue(), predicates); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateEvaluateEntryByValue.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateHasEqualId.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateHasEqualId.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateHasEqualId.java deleted file mode 100644 index 6d23ce3..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateHasEqualId.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 java.util.UUID; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * {@link ClusterNode} has equal id predicate. - */ -public class IgnitePredicateHasEqualId<T extends ClusterNode> implements IgnitePredicate<T> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final UUID locNodeId; - - /** - * @param locNodeId Id for check. - */ - public IgnitePredicateHasEqualId(UUID locNodeId) { - this.locNodeId = locNodeId; - } - - /** {@inheritDoc} */ - @Override public boolean apply(T n) { - return n.id().equals(locNodeId); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateHasEqualId.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateHasNotEqualId.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateHasNotEqualId.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateHasNotEqualId.java deleted file mode 100644 index 2381515..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateHasNotEqualId.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 java.util.UUID; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * {@link ClusterNode} node has NOT equal id predicate. - */ -public class IgnitePredicateHasNotEqualId<T extends ClusterNode> implements IgnitePredicate<T> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final UUID locNodeId; - - /** - * @param locNodeId Id for check. - */ - public IgnitePredicateHasNotEqualId(UUID locNodeId) { - this.locNodeId = locNodeId; - } - - /** {@inheritDoc} */ - @Override public boolean apply(T n) { - return !n.id().equals(locNodeId); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateHasNotEqualId.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIgniteFutureIsNotDone.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIgniteFutureIsNotDone.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIgniteFutureIsNotDone.java deleted file mode 100644 index e5f3d21..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIgniteFutureIsNotDone.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 IgnitePredicateIgniteFutureIsNotDone 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(IgnitePredicateIgniteFutureIsNotDone.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsAll.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsAll.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsAll.java deleted file mode 100644 index 8177d3e..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsAll.java +++ /dev/null @@ -1,52 +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.lang.GridFunc; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * Predicate that evaluates to {@code true} if each of its component predicates evaluates to {@code true}. - * - * @param <T> Type of the free variable, i.e. the element the predicate is called on. - */ -public class IgnitePredicateIsAll<T> implements IgnitePredicate<T> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final IgnitePredicate<? super T>[] predicates; - - /** - * @param predicates Passed in predicate. If none provided - always-{@code false} predicate is returned. - */ - public IgnitePredicateIsAll(IgnitePredicate<? super T>... predicates) { - this.predicates = predicates; - } - - /** {@inheritDoc} */ - @Override public boolean apply(T t) { - return GridFunc.isAll(t, predicates); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateIsAll.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsAssignableFrom.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsAssignableFrom.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsAssignableFrom.java deleted file mode 100644 index a024d46..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsAssignableFrom.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 IgnitePredicateIsAssignableFrom<T> implements P1<T> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final Class<?> cls; - - /** - * @param cls Class to compare to. - */ - public IgnitePredicateIsAssignableFrom(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(IgnitePredicateIsAssignableFrom.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsNotAll.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsNotAll.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsNotAll.java deleted file mode 100644 index 51e19cd..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsNotAll.java +++ /dev/null @@ -1,52 +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.lang.GridFunc; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * Negated predicate. - * - * @param <T> Type of the free variable, i.e. the element the predicate is called on. - */ -public class IgnitePredicateIsNotAll<T> implements IgnitePredicate<T> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final IgnitePredicate<? super T>[] predicates; - - /** - * @param predicates Predicate to negate. - */ - public IgnitePredicateIsNotAll(IgnitePredicate<? super T>... predicates) { - this.predicates = predicates; - } - - /** {@inheritDoc} */ - @Override public boolean apply(T t) { - return !GridFunc.isAll(t, predicates); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateIsNotAll.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsNull.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsNull.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsNull.java deleted file mode 100644 index 499b554..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateIsNull.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 IgnitePredicateIsNull<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(IgnitePredicateIsNull.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotContainWrapper.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotContainWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotContainWrapper.java deleted file mode 100644 index 0dc399d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotContainWrapper.java +++ /dev/null @@ -1,54 +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.Collection; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * Predicate that returns {@code true} if its free variable is not contained in given collection. - * - * @param <T> Type of the free variable for the predicate and type of the collection elements. - */ -public class IgnitePredicateNotContainWrapper<T> implements IgnitePredicate<T> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final Collection<? extends T> c; - - /** - * @param c Collection to check for containment. - */ - public IgnitePredicateNotContainWrapper(Collection<? extends T> c) { - this.c = c; - } - - /** {@inheritDoc} */ - @Override public boolean apply(T t) { - assert c != null; - - return !c.contains(t); - } - - /** {@inheritDoc} */ - public String toString() { - return S.toString(IgnitePredicateNotContainWrapper.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotEqual.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotEqual.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotEqual.java deleted file mode 100644 index 31a165d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotEqual.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 org.apache.ignite.internal.util.lang.GridFunc; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgnitePredicate; - -/** - * Predicate that evaluates to {@code true} if its free variable is equal to {@code target} or both are - * {@code null}. - * - * @param <T> Type of the free variable, i.e. the element the predicate is called on. - */ -public class IgnitePredicateNotEqual<T> implements IgnitePredicate<T> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final T target; - - /** - * @param target Object to compare free variable to. - */ - public IgnitePredicateNotEqual(T target) { - this.target = target; - } - - /** {@inheritDoc} */ - @Override public boolean apply(T t) { - return !GridFunc.eq(t, target); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateNotEqual.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotNull.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotNull.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotNull.java deleted file mode 100644 index 840ab82..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgnitePredicateNotNull.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 IgnitePredicateNotNull<E> implements IgnitePredicate<E> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param e Parameter for check. - * @return 'true' if parameter NOT equals to <code>null</code>, otherwise 'false'. - */ - @Override public boolean apply(E e) { - return e != null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgnitePredicateNotNull.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerAlwaysTrue.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerAlwaysTrue.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerAlwaysTrue.java deleted file mode 100644 index 389e700..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerAlwaysTrue.java +++ /dev/null @@ -1,56 +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.IgniteReducer; - -/** - * Reducer which always returns {@code true} from {@link org.apache.ignite.lang.IgniteReducer#collect(Object)} - * - * @param <T> Reducer element type. - */ -public class IgniteReducerAlwaysTrue<T> implements IgniteReducer<T, T> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final T elem; - - /** - * @param elem Element to return from {@link org.apache.ignite.lang.IgniteReducer#reduce()} method. - */ - public IgniteReducerAlwaysTrue(T elem) { - this.elem = elem; - } - - /** {@inheritDoc} */ - @Override public boolean collect(T e) { - return true; - } - - /** {@inheritDoc} */ - @Override public T reduce() { - return elem; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteReducerAlwaysTrue.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerIntSum.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerIntSum.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerIntSum.java deleted file mode 100644 index 0b811a8..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerIntSum.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 java.util.concurrent.atomic.AtomicInteger; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteReducer; - -/** - * Reducer that calculates sum of integer elements. - */ -public class IgniteReducerIntSum implements IgniteReducer<Integer, Integer> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private AtomicInteger sum = new AtomicInteger(0); - - /** {@inheritDoc} */ - @Override public boolean collect(Integer e) { - if (e != null) - sum.addAndGet(e); - - return true; - } - - /** {@inheritDoc} */ - @Override public Integer reduce() { - return sum.get(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteReducerIntSum.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerLongSum.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerLongSum.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerLongSum.java deleted file mode 100644 index a5b8f59..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerLongSum.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 java.util.concurrent.atomic.AtomicLong; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteReducer; - -/** - * Reducer that calculates sum of long integer elements. - */ -public class IgniteReducerLongSum implements IgniteReducer<Long, Long> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private AtomicLong sum = new AtomicLong(0); - - /** {@inheritDoc} */ - @Override public boolean collect(Long e) { - if (e != null) - sum.addAndGet(e); - - return true; - } - - /** {@inheritDoc} */ - @Override public Long reduce() { - return sum.get(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteReducerLongSum.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerStringConcat.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerStringConcat.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerStringConcat.java deleted file mode 100644 index 6f64747..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IgniteReducerStringConcat.java +++ /dev/null @@ -1,79 +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.lang.GridFunc; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.SB; -import org.apache.ignite.lang.IgniteReducer; - -/** - * Reducer that concatenates strings using provided delimiter. - */ -public class IgniteReducerStringConcat implements IgniteReducer<String, String> { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final String delim; - - /** */ - private SB sb; - - /** */ - private boolean first; - - /** */ - private final Object lock; - - /** - * @param delim Delimiter (optional). - */ - public IgniteReducerStringConcat(String delim) { - this.delim = delim; - sb = new SB(); - first = true; - lock = new Object(); - } - - /** {@inheritDoc} */ - @Override public boolean collect(String s) { - synchronized (lock) { - if (!first && !GridFunc.isEmpty(delim)) - sb.a(delim); - - sb.a(s); - - first = false; - } - - return true; - } - - /** {@inheritDoc} */ - @Override public String reduce() { - synchronized (lock) { - return sb.toString(); - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteReducerStringConcat.class, this); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/a3f845b0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IntSumReducer.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IntSumReducer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IntSumReducer.java new file mode 100644 index 0000000..cb87d79 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/IntSumReducer.java @@ -0,0 +1,51 @@ +/* + * 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.AtomicInteger; +import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.lang.IgniteReducer; + +/** + * Reducer that calculates sum of integer elements. + */ +public class IntSumReducer implements IgniteReducer<Integer, Integer> { + /** */ + private static final long serialVersionUID = 0L; + + /** */ + private AtomicInteger sum = new AtomicInteger(0); + + /** {@inheritDoc} */ + @Override public boolean collect(Integer e) { + if (e != null) + sum.addAndGet(e); + + return true; + } + + /** {@inheritDoc} */ + @Override public Integer reduce() { + return sum.get(); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(IntSumReducer.class, this); + } +}
