Make the type of the constraint depend on the type of the scheduling done

FEA: ItEr64OTS03PlanificacionHaciaAtras
This commit is contained in:
Óscar González Fernández 2010-12-11 21:46:11 +01:00
parent 4c384cdbfb
commit f1f79c5e82
2 changed files with 9 additions and 6 deletions

View file

@ -1058,14 +1058,15 @@ public class GanttDiagramGraph<V, D extends IDependency<V>> implements
}
DatesBasedPositionRestrictions biggerThan(GanttDate start, GanttDate end) {
return new DatesBasedPositionRestrictions(
ComparisonType.BIGGER_OR_EQUAL_THAN, start, end);
ComparisonType type = scheduleBackwards ? ComparisonType.BIGGER_OR_EQUAL_THAN_LEFT_FLOATING
: ComparisonType.BIGGER_OR_EQUAL_THAN;
return new DatesBasedPositionRestrictions(type, start, end);
}
DatesBasedPositionRestrictions lessThan(GanttDate start, GanttDate end) {
return new DatesBasedPositionRestrictions(
ComparisonType.LESS_OR_EQUAL_THAN_RIGHT_FLOATING, start,
end);
ComparisonType type = scheduleBackwards ? ComparisonType.LESS_OR_EQUAL_THAN_RIGHT_FLOATING
: ComparisonType.LESS_OR_EQUAL_THAN;
return new DatesBasedPositionRestrictions(type, start, end);
}
class DatesBasedPositionRestrictions extends PositionRestrictions {

View file

@ -54,7 +54,7 @@ public class ConstraintOnComparableValues<T extends Comparable<T>> extends
}
public enum ComparisonType {
LESS_OR_EQUAL_THAN, LESS_OR_EQUAL_THAN_RIGHT_FLOATING, BIGGER_OR_EQUAL_THAN, EQUAL_TO;
LESS_OR_EQUAL_THAN, LESS_OR_EQUAL_THAN_RIGHT_FLOATING, BIGGER_OR_EQUAL_THAN, BIGGER_OR_EQUAL_THAN_LEFT_FLOATING, EQUAL_TO;
}
private final T comparisonValue;
@ -76,6 +76,7 @@ public class ConstraintOnComparableValues<T extends Comparable<T>> extends
case LESS_OR_EQUAL_THAN:
return min(comparisonValue, value);
case LESS_OR_EQUAL_THAN_RIGHT_FLOATING:
case BIGGER_OR_EQUAL_THAN_LEFT_FLOATING:
return comparisonValue;
case BIGGER_OR_EQUAL_THAN:
return max(comparisonValue, value);
@ -101,6 +102,7 @@ public class ConstraintOnComparableValues<T extends Comparable<T>> extends
case LESS_OR_EQUAL_THAN_RIGHT_FLOATING:
return value.compareTo(comparisonValue) <= 0;
case BIGGER_OR_EQUAL_THAN:
case BIGGER_OR_EQUAL_THAN_LEFT_FLOATING:
return value.compareTo(comparisonValue) >= 0;
case EQUAL_TO:
return value.compareTo(comparisonValue) == 0;