ItEr33S14CUCreacionUnidadesPlanificacion: Adding methods to update safely the values of TaskStartConstraint.

This commit is contained in:
Óscar González Fernández 2009-11-08 23:08:03 +01:00
parent 40d74b8784
commit 9001fc2fca

View file

@ -59,4 +59,15 @@ public class TaskStartConstraint {
this.startConstraintType = StartConstraintType.START_NOT_EARLIER_THAN;
}
public boolean isValid(StartConstraintType type, Date value) {
return type != null
&& type.isAssociatedDateRequired() == (value != null);
}
public void update(StartConstraintType type, Date value) {
Validate.isTrue(isValid(type, value));
this.startConstraintType = type;
this.constraintDate = value;
}
}