From a78d2644880e915eb04f4005898d6aa59f2d541e Mon Sep 17 00:00:00 2001 From: oblonski <4sschroeder@gmail.com> Date: Tue, 3 Dec 2013 07:52:24 +0100 Subject: [PATCH] deprecate unnecessary methods --- .../core/problem/VehicleRoutingProblem.java | 157 ++++++++++-------- 1 file changed, 86 insertions(+), 71 deletions(-) diff --git a/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java b/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java index 67919155..539a192d 100644 --- a/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java +++ b/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java @@ -186,17 +186,6 @@ public class VehicleRoutingProblem { }; } - /** - * - * @deprecated use .addConstraint(new ServiceDeliveriesFirstConstraint()) - * @param constraint - */ - @Deprecated - public void addProblemConstraint(Constraint constraint){ - if(!problemConstraints.contains(constraint)) problemConstraints.add(constraint); - } - - /** * Sets routing costs. * @@ -223,39 +212,6 @@ public class VehicleRoutingProblem { return this; } - /** - * Sets the fleetComposition. - * - *
FleetComposition is either FleetComposition.HETEROGENEOUS or FleetComposition.HOMOGENEOUS - * - * @deprecated has no effect - * @param fleetComposition - * @return - */ - @Deprecated - public Builder setFleetComposition(FleetComposition fleetComposition){ - this.fleetComposition = fleetComposition; - return this; - } - - /** - * Adds a service to jobList. - * - *
If jobList already contains service, a warning message is printed, and the existing job will be overwritten.
- *
- * @deprecated use addJob(...) instead
- * @param service
- * @return
- */
- @Deprecated
- public Builder addService(Service service){
- coordinates.put(service.getLocationId(), service.getCoord());
- if(jobs.containsKey(service.getId())){ logger.warn("service " + service + " already in job list. overrides existing job."); }
- jobs.put(service.getId(),service);
- services.add(service);
- return this;
- }
-
/**
* Adds a job which is either a service or a shipment.
*
@@ -302,32 +258,6 @@ public class VehicleRoutingProblem {
return this;
}
- /**
- * Adds a vehicleType.
- *
- * @deprecated use add vehicle instead
- * @param type
- * @return builder
- */
- @Deprecated
- public Builder addVehicleType(VehicleType type){
- vehicleTypes.add(type);
- return this;
- }
-
- /**
- * Sets the neighborhood.
- *
- * @deprecated use HardRoute- or ActivityLevelConstraint instead
- * @param neighborhood
- * @return
- */
- @Deprecated
- public Builder setNeighborhood(Neighborhood neighborhood){
- this.neighborhood = neighborhood;
- return this;
- }
-
/**
* Sets the activityCostFunction that considers also activities on a vehicle-route.
*
@@ -398,8 +328,15 @@ public class VehicleRoutingProblem {
return Collections.unmodifiableCollection(vehicles);
}
- public void addConstraint(jsprit.core.problem.constraint.Constraint constraint){
+ /**
+ * Adds constraint to problem.
+ *
+ * @param constraint
+ * @return
+ */
+ public Builder addConstraint(jsprit.core.problem.constraint.Constraint constraint){
constraints.add(constraint);
+ return this;
}
/**
@@ -414,6 +351,75 @@ public class VehicleRoutingProblem {
public Collection FleetComposition is either FleetComposition.HETEROGENEOUS or FleetComposition.HOMOGENEOUS
+ *
+ * @deprecated has no effect
+ * @param fleetComposition
+ * @return
+ */
+ @Deprecated
+ public Builder setFleetComposition(FleetComposition fleetComposition){
+ this.fleetComposition = fleetComposition;
+ return this;
+ }
+
+ /**
+ * Adds a service to jobList.
+ *
+ * If jobList already contains service, a warning message is printed, and the existing job will be overwritten.
+ *
+ * @deprecated use addJob(...) instead
+ * @param service
+ * @return
+ */
+ @Deprecated
+ public Builder addService(Service service){
+ coordinates.put(service.getLocationId(), service.getCoord());
+ if(jobs.containsKey(service.getId())){ logger.warn("service " + service + " already in job list. overrides existing job."); }
+ jobs.put(service.getId(),service);
+ services.add(service);
+ return this;
+ }
+
+ /**
+ * Adds a vehicleType.
+ *
+ * @deprecated use add vehicle instead
+ * @param type
+ * @return builder
+ */
+ @Deprecated
+ public Builder addVehicleType(VehicleType type){
+ vehicleTypes.add(type);
+ return this;
+ }
+
+ /**
+ * Sets the neighborhood.
+ *
+ * @deprecated use HardRoute- or ActivityLevelConstraint instead
+ * @param neighborhood
+ * @return
+ */
+ @Deprecated
+ public Builder setNeighborhood(Neighborhood neighborhood){
+ this.neighborhood = neighborhood;
+ return this;
+ }
+
+ /**
+ *
+ * @deprecated use .addConstraint(new ServiceDeliveriesFirstConstraint())
+ * @param constraint
+ */
+ @Deprecated
+ public void addProblemConstraint(Constraint constraint){
+ if(!problemConstraints.contains(constraint)) problemConstraints.add(constraint);
+ }
}
/**
@@ -493,8 +499,10 @@ public class VehicleRoutingProblem {
}
/**
+ * @deprecated see builder.setNeighborhood(...). addConstraint(...) instead.
* @return the neighborhood
*/
+ @Deprecated
public Neighborhood getNeighborhood() {
return neighborhood;
}
@@ -531,8 +539,10 @@ public class VehicleRoutingProblem {
/**
* Returns unmodifiable collection of problem-constraints.
*
+ * @deprecated use .getConstraints() and builder.add
* @return
*/
+ @Deprecated
public Collection