com.microsoft.tfs.core.pendingcheckin.filters
Class ScopeFilter

java.lang.Object
  extended by com.microsoft.tfs.core.pendingcheckin.filters.ScopeFilter
All Implemented Interfaces:
PendingChangeFilter

public class ScopeFilter
extends java.lang.Object
implements PendingChangeFilter

Filters pending changes by regular expressions matched against the change's server item.

If this class is initialized with an empty array of expressions, all calls to passes(PendingChange) return true (everything passes). A non-empty array during initialization causes only items that match any of the expressions to pass.

Since:
TEE-SDK-10.1
Thread-safety:
immutable

Field Summary
static int EXPRESSION_FLAGS
          Flags used when compiling regular expression strings into Pattern objects.
 
Constructor Summary
ScopeFilter(java.lang.String[] scopeExpressions)
          Create a filter using the given expressions.
 
Method Summary
 boolean passes(PendingChange change)
          Tests whether the given pending change passes the implementation's filter test.
 boolean passes(java.lang.String serverPath)
          Public for validation by UI code that wishes to pass sample paths and test our engine.
 int passesWhich(java.lang.String serverPath)
          Public for validation by UI code that wishes to pass sample paths and test our engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXPRESSION_FLAGS

public static final int EXPRESSION_FLAGS
Flags used when compiling regular expression strings into Pattern objects. These can't be changed by callers, but are exposed to enable compatible user-interfaces (which may show regular expression matching previews, for example).

Constant Field Value:
64
See Also:
Constant Field Values
Constructor Detail

ScopeFilter

public ScopeFilter(java.lang.String[] scopeExpressions)
Create a filter using the given expressions.

Parameters:
scopeExpressions - the expressions to use to filter. If non-empty, only changes whose server paths match any of the expressions pass (others do not pass). If empty, all changes pass.
Method Detail

passes

public boolean passes(PendingChange change)
Tests whether the given pending change passes the implementation's filter test.

Specified by:
passes in interface PendingChangeFilter
Parameters:
change - the change to test (must not be null)
Returns:
true if the change passes, false if it does not.

passes

public boolean passes(java.lang.String serverPath)
Public for validation by UI code that wishes to pass sample paths and test our engine.

Parameters:
serverPath - the server path to test (must not be null)
Returns:
true if the path passes, false if it does not. See PendingChangeFilter.passes(PendingChange) for details.

passesWhich

public int passesWhich(java.lang.String serverPath)
Public for validation by UI code that wishes to pass sample paths and test our engine. Exposes which pattern matched.

Parameters:
serverPath - the server path to test (must not be null)
Returns:
-1 if the path did not match any expressions (does not pass), or the the non-negative index of the expression the path matched. If there were no configured expressions, Integer.MIN_VALUE is returned (the path passes).


© 2015 Microsoft. All rights reserved.