|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.util.NthPredicate
public class NthPredicate
NthPredicate is a predicate which defers to another predicate test and returns true only when that predicate has returned true n (or more) times.
Field Summary | |
---|---|
static java.lang.String |
RB_KEY
|
Constructor Summary | |
---|---|
NthPredicate(com.sas.util.PredicateInterface predicate,
int n)
Constructs a predicate which defers to another predicate test and returns true only when that predicate has returned true exactly n times. |
|
NthPredicate(com.sas.util.PredicateInterface predicate,
int n,
boolean exactly)
Constructs a predicate which defers to another predicate test and returns true only when that predicate has returned true n (or more) times. |
Method Summary | |
---|---|
int |
getCount()
Returns the number of times the input predicate has returned true . |
int |
getN()
Returns the value of n. |
com.sas.util.PredicateInterface |
getPredicate()
Returns the internal predicate. |
boolean |
predicate(java.lang.Object object)
Runs the initial predicate on the object. |
void |
reset()
Resets the count to 0. |
void |
setN(int n)
Sets the value of n. |
void |
setPredicate(com.sas.util.PredicateInterface predicate)
Sets the internal predicate. |
Field Detail |
---|
public static final java.lang.String RB_KEY
Constructor Detail |
---|
public NthPredicate(com.sas.util.PredicateInterface predicate, int n)
predicate
- the predicate to testn
- return true only after the predicate
has returned true
n times.public NthPredicate(com.sas.util.PredicateInterface predicate, int n, boolean exactly)
predicate
- the predicate to testn
- return true only after the predicate
has returned true
n (or more) times.exactly
- specifies whether true
should be returned
only when predicate has returned true
exactly n times or if any occurrence of true
equal to or greater than n times also returns
true
(count == n vs. count >= n).Method Detail |
---|
public boolean predicate(java.lang.Object object)
predicate
in interface com.sas.util.PredicateInterface
true
exactly n times,
otherwise falsepublic void reset()
public int getCount()
true
.
true
public int getN()
setN(int)
public void setN(int n)
n
- the new value for n
#getNpublic com.sas.util.PredicateInterface getPredicate()
setPredicate(com.sas.util.PredicateInterface)
public void setPredicate(com.sas.util.PredicateInterface predicate)
predicate
- the new value for the internal predicategetPredicate()
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |