edu.columbia.cs.ref.model.constraint.role.impl
Class AndRoleConstraint

java.lang.Object
  extended by edu.columbia.cs.ref.model.constraint.role.impl.AndRoleConstraint
All Implemented Interfaces:
RoleConstraint, java.io.Serializable

public class AndRoleConstraint
extends java.lang.Object
implements RoleConstraint

The Class AndRoleConstraint is an implementation of RoleConstraint that is used to compose several other constraints. This constraint checks if all the constraints passed as input to the constructor check

Since:
2011-09-27
Version:
0.1
Author:
Pablo Barrio, Goncalo Simoes
See Also:
Serialized Form

Constructor Summary
AndRoleConstraint(RoleConstraint... constraints)
          Instantiates a new and role constraint.
 
Method Summary
 boolean checkConstraint(Entity role)
          Check check if the input entity fulfills the constraint
 java.util.Set<Entity> getCompatibleEntities(java.util.Set<Entity> entities)
          Returns the subset of all the input entities that fulfill the constraint
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AndRoleConstraint

public AndRoleConstraint(RoleConstraint... constraints)
Instantiates a new and role constraint. It receives an undefined number of contraints that must be checked.

Parameters:
constraints - the constraints
Method Detail

checkConstraint

public boolean checkConstraint(Entity role)
Description copied from interface: RoleConstraint
Check check if the input entity fulfills the constraint

Specified by:
checkConstraint in interface RoleConstraint
Parameters:
role - the entity
Returns:
true, if successful

getCompatibleEntities

public java.util.Set<Entity> getCompatibleEntities(java.util.Set<Entity> entities)
Description copied from interface: RoleConstraint
Returns the subset of all the input entities that fulfill the constraint

Specified by:
getCompatibleEntities in interface RoleConstraint
Parameters:
entities - the entities to be checked
Returns:
the compatible entities