From 6702bb0e1b0f27ec70639ea3c3dee2c8d650ef97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacobo=20Aragunde=20P=C3=A9rez?= Date: Fri, 24 Feb 2012 17:06:21 +0100 Subject: [PATCH] Bug #1355: transform AS SOON AS POSSIBLE and AS LATE AS POSSIBLE constraints to the correct constraint based on the scheduling mode. FEA: ItEr76S04BugFixing --- .../entities/PositionConstraintType.java | 33 ++++--------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/PositionConstraintType.java b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/PositionConstraintType.java index be3ba846c..4da8798e9 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/PositionConstraintType.java +++ b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/PositionConstraintType.java @@ -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;