Bug #1355: transform AS SOON AS POSSIBLE and AS LATE AS POSSIBLE constraints to

the correct constraint based on the scheduling mode.

FEA: ItEr76S04BugFixing
This commit is contained in:
Jacobo Aragunde Pérez 2012-02-24 17:06:21 +01:00
parent 33881786b0
commit 6702bb0e1b

View file

@ -30,11 +30,6 @@ import org.libreplan.business.orders.entities.Order.SchedulingMode;
public enum PositionConstraintType {
AS_SOON_AS_POSSIBLE(false, _("as soon as possible")) {
@Override
public PositionConstraintType newTypeAfterMoved(SchedulingMode mode) {
return START_NOT_EARLIER_THAN;
}
@Override
public boolean appliesToTheStart() {
return true;
@ -42,14 +37,6 @@ public enum PositionConstraintType {
},
START_NOT_EARLIER_THAN(true, _("start not earlier than")) {
@Override
public PositionConstraintType newTypeAfterMoved(SchedulingMode mode) {
if(mode == SchedulingMode.FORWARD)
return START_NOT_EARLIER_THAN;
else
return FINISH_NOT_LATER_THAN;
}
@Override
public boolean appliesToTheStart() {
return true;
@ -69,11 +56,6 @@ public enum PositionConstraintType {
},
AS_LATE_AS_POSSIBLE(false, _("as late as possible")) {
@Override
public PositionConstraintType newTypeAfterMoved(SchedulingMode mode) {
return FINISH_NOT_LATER_THAN;
}
@Override
public boolean appliesToTheStart() {
return false;
@ -81,14 +63,6 @@ public enum PositionConstraintType {
},
FINISH_NOT_LATER_THAN(true, _("finish not later than")) {
@Override
public PositionConstraintType newTypeAfterMoved(SchedulingMode mode) {
if(mode == SchedulingMode.FORWARD)
return START_NOT_EARLIER_THAN;
else
return FINISH_NOT_LATER_THAN;
}
@Override
public boolean appliesToTheStart() {
return false;
@ -110,7 +84,12 @@ public enum PositionConstraintType {
this.name = name;
}
public abstract PositionConstraintType newTypeAfterMoved(SchedulingMode mode);
public PositionConstraintType newTypeAfterMoved(SchedulingMode mode) {
if(mode == SchedulingMode.FORWARD)
return START_NOT_EARLIER_THAN;
else
return FINISH_NOT_LATER_THAN;
}
public boolean isAssociatedDateRequired() {
return dateRequired;