groovyx.gpars.dataflow.impl
Class GuardedSelectRequest<T>

java.lang.Object
  extended by groovyx.gpars.dataflow.impl.GuardedSelectRequest<T>
All Implemented Interfaces:
SelectRequest<T>

public abstract class GuardedSelectRequest<T>
extends java.lang.Object
implements SelectRequest<T>

The base implementation of the SelectRequest interface, providing a useful default masking (guarding) functionality. Whenever invoking a select, guards can be specified, reducing the set of all input channels of the Select to consider in the given request.

Author:
Vaclav Pech Date: 30th Sep 2010

Field Summary
private  java.util.List<java.lang.Boolean> mask
           
 
Constructor Summary
GuardedSelectRequest(java.util.List<java.lang.Boolean> mask)
           
 
Method Summary
 boolean matchesMask(int index)
          Detects, whether the channel at the given index is guarded or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface groovyx.gpars.dataflow.impl.SelectRequest
valueFound
 

Field Detail

mask

private final java.util.List<java.lang.Boolean> mask
Constructor Detail

GuardedSelectRequest

public GuardedSelectRequest(java.util.List<java.lang.Boolean> mask)
Parameters:
mask - The list of boolean flags indicating which position should be matched against. All indexes match against a null mask
Method Detail

matchesMask

public boolean matchesMask(int index)
Detects, whether the channel at the given index is guarded or not.

Specified by:
matchesMask in interface SelectRequest<T>
Parameters:
index - The index of the input channel to check for guard
Returns:
True, if the channel's guard is true or no guards were set and so the channel should be included in the current select operation

Copyright © 2008–2012 Václav Pech. All Rights Reserved.