com.agical.rmock.core.match.multiplicity.impl
Class MultiplicityImpl

java.lang.Object
  extended by com.agical.rmock.core.match.multiplicity.impl.MultiplicityImpl
All Implemented Interfaces:
Multiplicity, java.lang.Cloneable
Direct Known Subclasses:
MultiplicityFactory.LimitableMultiplicity

public class MultiplicityImpl
extends java.lang.Object
implements Multiplicity

(c) Agical AB 2005

Author:
joakim.ohlrogge Extend this class to count the number of matches made.

Constructor Summary
MultiplicityImpl(int min, int max)
           
 
Method Summary
 boolean canMatch()
          Called to check if this constraint can match given its current state
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
           
 int getMatchCount()
           
 int getMax()
           
 int getMin()
           
 int hashCode()
           
 boolean isSatisfied()
          Indicates if this constraint has been satisfied.
 void match()
          Called to notify the constraint that it has been matched.
protected  void setMax(int max)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiplicityImpl

public MultiplicityImpl(int min,
                        int max)
Method Detail

getMatchCount

public int getMatchCount()
Specified by:
getMatchCount in interface Multiplicity
Returns:
Returns the currentMatches.

getMin

public int getMin()
Specified by:
getMin in interface Multiplicity
Returns:
The minimum number of times this constraint has to be matched.
See Also:
Multiplicity.getMin()

getMax

public int getMax()
Specified by:
getMax in interface Multiplicity
Returns:
The maximum number of times this constraint has to be matched.
See Also:
Multiplicity.getMax()

canMatch

public boolean canMatch()
Description copied from interface: Multiplicity
Called to check if this constraint can match given its current state

Specified by:
canMatch in interface Multiplicity
Returns:
true if this constraint can match
See Also:
Multiplicity.canMatch()

isSatisfied

public boolean isSatisfied()
Description copied from interface: Multiplicity
Indicates if this constraint has been satisfied. If a constraint is satisfied at the end of a test no assertion failure will be thrown.

Specified by:
isSatisfied in interface Multiplicity
Returns:
true if this constraint is satisfied.
See Also:
Multiplicity.isSatisfied()

match

public void match()
Description copied from interface: Multiplicity
Called to notify the constraint that it has been matched. Even if a multiplicity constraint returns true from its @see Multiplicity#canMatch() method ? other constraints may prevent the match from actually being made.

Specified by:
match in interface Multiplicity
See Also:
Multiplicity.match()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

setMax

protected void setMax(int max)

clone

public java.lang.Object clone()
Specified by:
clone in interface Multiplicity
Overrides:
clone in class java.lang.Object


Copyright © 2005-2008 Agical AB. All Rights Reserved.