Class GridNodePredicate
- java.lang.Object
-
- org.apache.ignite.internal.util.lang.GridNodePredicate
-
- All Implemented Interfaces:
Serializable,Iterable<UUID>,IgnitePredicate<ClusterNode>
public class GridNodePredicate extends Object implements IgnitePredicate<ClusterNode>, Iterable<UUID>
Convenient node predicate as a separate class. It allows to avoid "dragging" enclosing class's state when predicates are created as anonymous classes in stateful enclosing context. This class is also optimized for evaluation of large number of nodes.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GridNodePredicate(@Nullable Collection<UUID> ids)Creates node predicate that evaluates totruefor all provided node IDs.GridNodePredicate(@Nullable UUID... ids)Creates node predicate that evaluates totruefor all provided node IDs.GridNodePredicate(@Nullable ClusterNode... nodes)Creates node predicate that evaluates totruefor all provided nodes.GridNodePredicate(Set<UUID> ids)Creates node predicate that evaluates totruefor all provided node IDs.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanapply(ClusterNode n)Predicate body.booleanequals(Object o)inthashCode()Iterator<UUID>iterator()Set<UUID>nodeIds()Gets set of node IDs this predicate is based on.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
GridNodePredicate
public GridNodePredicate(Set<UUID> ids)
Creates node predicate that evaluates totruefor all provided node IDs. Implementation will not make a defensive copy.- Parameters:
ids- Optional node IDs. If none provided - predicate will always returnfalse.
-
GridNodePredicate
public GridNodePredicate(@Nullable @Nullable Collection<UUID> ids)Creates node predicate that evaluates totruefor all provided node IDs. Implementation will make a defensive copy.- Parameters:
ids- Optional node IDs. If none provided - predicate will always returnfalse.
-
GridNodePredicate
public GridNodePredicate(@Nullable @Nullable UUID... ids)Creates node predicate that evaluates totruefor all provided node IDs. Implementation will make a defensive copy.- Parameters:
ids- Optional node IDs. If none provided - predicate will always returnfalse.
-
GridNodePredicate
public GridNodePredicate(@Nullable @Nullable ClusterNode... nodes)Creates node predicate that evaluates totruefor all provided nodes. Implementation will make a defensive copy.- Parameters:
nodes- Optional grid nodes. If none provided - predicate will always returnfalse.
-
-
Method Detail
-
nodeIds
public Set<UUID> nodeIds()
Gets set of node IDs this predicate is based on. Note that for performance reasons this methods return the internal set that should not be modified by the caller.- Returns:
- Set of node IDs this predicate is based on.
-
apply
public boolean apply(ClusterNode n)
Predicate body.- Specified by:
applyin interfaceIgnitePredicate<ClusterNode>- Parameters:
n- Predicate parameter.- Returns:
- Return value.
-
-