org.gcube.data.trees.constraints
Class Either<T>

java.lang.Object
  extended by org.gcube.data.trees.constraints.BaseConstraint<T>
      extended by org.gcube.data.trees.constraints.Either<T>
All Implemented Interfaces:
Serializable, Constraint<T>

public class Either<T>
extends BaseConstraint<T>

Accepts values that satisfy at least one of two constraints.

Author:
Fabio Simeoni
See Also:
Serialized Form

Constructor Summary
Either(Constraint<T> c1, Constraint<T> c2)
          Creates an instance from two constraints.
 
Method Summary
 boolean accepts(T t)
          Returns true if a value satisfies the constraint.
 List<Constraint<T>> constraints()
          Returns the constraints combined in this instance.
 boolean equals(Object obj)
           
 int hashCode()
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Either

public Either(Constraint<T> c1,
              Constraint<T> c2)
Creates an instance from two constraints.

Parameters:
c1 - the first constraint
c2 - the second constraint
Method Detail

constraints

public List<Constraint<T>> constraints()
Returns the constraints combined in this instance.

Returns:
the constraints.

accepts

public boolean accepts(T t)
Description copied from interface: Constraint
Returns true if a value satisfies the constraint.

Parameters:
t - the value.
Returns:
true if the value satisfies the constraint, false if it does not.

toString

public String toString()

Overrides:
toString in class BaseConstraint<T>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2012. All Rights Reserved.