|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sadun.util.TelnetInputStreamConsumer.CompositeCriterium
An abstract criterium based on other criteria.
The class offers services to compose criteria and to retrieve which
criterium or criteria hold, after that holds(String)
has been
invoked.
All composing criteria are initially in an undefined state. After
holds(String)
is called, and depending on the implementation of
that method by the subclass, some will have been verified and found
holding or not, while others won't. (For example, ANDing many criteria
requires that every one is checked, while ORing them doesn't).
Subclasses must implement the method holdsMultiple(String)
to
define the precise semantics of the criteria (the member
operands
contains the
TelnetInputStreamConsumer.Criterium
to check).
If the verifyAllRequested
property is
set, invoking holds(String)
will trigger the verification of all
the composing criteria, regardless of the implementation of
{@link #holdsMultiple(String).
Field Summary | |
protected org.sadun.util.TelnetInputStreamConsumer.CompositeCriterium.OperandWrapper[] |
operands
The criteria to check. |
protected boolean |
verifyAllRequested
VerifyAll mode |
Constructor Summary | |
protected |
TelnetInputStreamConsumer.CompositeCriterium(TelnetInputStreamConsumer.Criterium[] criteria)
Create an instance using the given criteria as components, without requesting that all be verified when holds(String) is
invoked. |
protected |
TelnetInputStreamConsumer.CompositeCriterium(TelnetInputStreamConsumer.Criterium[] criteria,
boolean verifyAllRequested)
Create an instance using the given criteria as components, possibly requesting that all be verified when holds(String) is
invoked. |
Method Summary | |
TelnetInputStreamConsumer.Criterium[] |
getHoldingCriteria()
Return the component criteria the did hold, after TelnetInputStreamConsumer.Criterium.holds(java.lang.String)
has bee called. |
TelnetInputStreamConsumer.Criterium |
getHoldingCriterium()
Return the first criterium that holds, or null if no criteria holds. |
TelnetInputStreamConsumer.Criterium[] |
getNotHoldingCriteria()
Return the component criteria the did not hold, after TelnetInputStreamConsumer.Criterium.holds(java.lang.String)
has bee called. |
TelnetInputStreamConsumer.Criterium[] |
getUndefinedCriteria()
Return the component criteria which have not been verified after TelnetInputStreamConsumer.Criterium.holds(java.lang.String)
has bee called. |
boolean |
holds(java.lang.String input)
|
protected abstract boolean |
holdsMultiple(java.lang.String input)
This method is to be implemented by subclasses to do the actual verification of the multiple criterium. |
boolean |
isVerified(TelnetInputStreamConsumer.Criterium criteria)
Return true if the given criteria has not verified. |
boolean |
isVerifiedAndDoesNotHold(TelnetInputStreamConsumer.Criterium criteria)
Return true if the given criteria has been verified and did not hold. |
boolean |
isVerifiedAndHolds(TelnetInputStreamConsumer.Criterium criteria)
Return true if the given criteria has been verified and did hold. |
boolean |
isVerifyAllRequested()
Return true if all the composing criteria are to be checked when holds(String) is invoked. |
void |
setVerifyAllRequested(boolean verifyAllRequested)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.sadun.util.TelnetInputStreamConsumer.CompositeCriterium.OperandWrapper[] operands
protected boolean verifyAllRequested
Constructor Detail |
protected TelnetInputStreamConsumer.CompositeCriterium(TelnetInputStreamConsumer.Criterium[] criteria)
holds(String)
is
invoked.
criteria
- the composing criteriaprotected TelnetInputStreamConsumer.CompositeCriterium(TelnetInputStreamConsumer.Criterium[] criteria, boolean verifyAllRequested)
holds(String)
is
invoked.
criteria
- the composing criteriaMethod Detail |
public final boolean holds(java.lang.String input)
holds
in interface TelnetInputStreamConsumer.Criterium
protected abstract boolean holdsMultiple(java.lang.String input)
It has the same role as
TelnetInputStreamConsumer.Criterium.holds(java.lang.String)
in TelnetInputStreamConsumer.Criterium
input
- the input to verify
public TelnetInputStreamConsumer.Criterium[] getHoldingCriteria()
TelnetInputStreamConsumer.Criterium.holds(java.lang.String)
has bee called. Criteria that have not yet been verified (that is,
for which
TelnetInputStreamConsumer.Criterium.holds(java.lang.String)
has not been called) are excluded. Use
getUndefinedCriteria()
to know which they are).
public TelnetInputStreamConsumer.Criterium getHoldingCriterium()
public TelnetInputStreamConsumer.Criterium[] getNotHoldingCriteria()
TelnetInputStreamConsumer.Criterium.holds(java.lang.String)
has bee called. Criteria that have not yet been verified (that is,
for which
TelnetInputStreamConsumer.Criterium.holds(java.lang.String)
has not been called) are excluded. Use
getUndefinedCriteria()
to know which they are).
public TelnetInputStreamConsumer.Criterium[] getUndefinedCriteria()
TelnetInputStreamConsumer.Criterium.holds(java.lang.String)
has bee called.
public boolean isVerifiedAndHolds(TelnetInputStreamConsumer.Criterium criteria)
criteria
- the criteria to verify, which must be part of this
composite criterium
java.lang.IllegalArgumentException
- if the criteria is not part of this compositepublic boolean isVerifiedAndDoesNotHold(TelnetInputStreamConsumer.Criterium criteria)
criteria
- the criteria to verify, which must be part of this
composite criterium
java.lang.IllegalArgumentException
- if the criteria is not part of this compositepublic boolean isVerified(TelnetInputStreamConsumer.Criterium criteria)
criteria
- the criteria to verify, which must be part of this
composite criterium
java.lang.IllegalArgumentException
- if the criteria is not part of this compositepublic boolean isVerifyAllRequested()
holds(String)
is invoked.
public void setVerifyAllRequested(boolean verifyAllRequested)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |