com.greenpepper.expectation.Either Maven / Gradle / Ivy
The newest version!
package com.greenpepper.expectation;
/**
* Either class.
*
* @author oaouattara
* @version $Id: $Id
*/
public class Either implements Collator
{
private Expectation expectation;
/**
* Constructor for Either.
*
* @param expectation a {@link com.greenpepper.expectation.Expectation} object.
*/
public Either(Expectation expectation)
{
this.expectation = expectation;
}
/**
* or.
*
* @param other a {@link com.greenpepper.expectation.Expectation} object.
* @return a {@link com.greenpepper.expectation.Either} object.
*/
public Either or(Expectation other)
{
this.expectation = new OrExpectation( this.expectation, other );
return this;
}
/**
* negate.
*
* @return a {@link com.greenpepper.expectation.Either} object.
*/
public Either negate()
{
this.expectation = new NotExpectation( this.expectation );
return this;
}
/**
* toExpectation.
*
* @return a {@link com.greenpepper.expectation.Expectation} object.
*/
public Expectation toExpectation()
{
return expectation;
}
}