org.gcube.contentmanagement.contentmanager.stubs.model.constraints
Class Either<T>

java.lang.Object
  extended by org.gcube.contentmanagement.contentmanager.stubs.model.constraints.BaseConstraint<T>
      extended by org.gcube.contentmanagement.contentmanager.stubs.model.constraints.Either<T>
All Implemented Interfaces:
java.io.Serializable, Constraint<T>

public class Either<T>
extends BaseConstraint<T>

Constrains values to satisfy at least one of one or more constraints.

Author:
Fabio Simeoni (University of Strathclyde)
See Also:
Serialized Form

Constructor Summary
Either(Constraint<T>... cs)
          Creates an instance from one more constraints.
 
Method Summary
 boolean accepts(T t)
          Indicates whether a value satisfies the constraint.
 Constraint<T>[] constraints()
           
 boolean equals(java.lang.Object obj)
          
 int hashCode()
          
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Either

public Either(Constraint<T>... cs)
Creates an instance from one more constraints.

Method Detail

constraints

public Constraint<T>[] constraints()

accepts

public boolean accepts(T t)
Description copied from interface: Constraint
Indicates whether a value satisfies the constraint.

Parameters:
t - the value.
Returns:
true if it does, false otherwise.

toString

public java.lang.String toString()

Overrides:
toString in class BaseConstraint<T>

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