From aca07a98f27acfb63e219ae43b5e548073159ed5 Mon Sep 17 00:00:00 2001 From: oblonski <4sschroeder@gmail.com> Date: Mon, 13 Jan 2014 22:57:05 +0100 Subject: [PATCH] add javadoc to vehicleType --- .../core/problem/vehicle/VehicleType.java | 29 ++++++- .../core/problem/vehicle/VehicleTypeImpl.java | 83 ++++++++++++++++++- 2 files changed, 108 insertions(+), 4 deletions(-) diff --git a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleType.java b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleType.java index 1f6da049..ab45dfa7 100644 --- a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleType.java +++ b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleType.java @@ -18,15 +18,42 @@ package jsprit.core.problem.vehicle; import jsprit.core.problem.vehicle.VehicleTypeImpl.VehicleCostParams; - +/** + * Basic interface for vehicle-type-data. + * + * @author schroeder + * + */ public interface VehicleType { + /** + * Returns typeId. + * + * @return typeId + */ public String getTypeId(); + /** + * Returns capacity. + * + *

In future versions there will be a capacity-object with an arbitrary number of capacity dimensions. (stefan,11.01.14) + * + * @return cap + */ public int getCapacity(); + /** + * Returns maximum velocity of this vehicle-type. + * + * @return max velocity + */ public double getMaxVelocity(); + /** + * Return the cost-parameter of this vehicle-type. + * + * @return parameter + */ public VehicleCostParams getVehicleCostParams(); } diff --git a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleTypeImpl.java b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleTypeImpl.java index 828f3058..f0404396 100644 --- a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleTypeImpl.java +++ b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleTypeImpl.java @@ -16,9 +16,22 @@ ******************************************************************************/ package jsprit.core.problem.vehicle; - +/** + * Implementation of {@link VehicleType}. + * + *

Two vehicle-types are equal if they have the same typeId. + * + * @author schroeder + * + */ public class VehicleTypeImpl implements VehicleType { + /** + * CostParameter consisting of fixed cost parameter, time-based cost parameter and distance-based cost parameter. + * + * @author schroeder + * + */ public static class VehicleCostParams { public static VehicleTypeImpl.VehicleCostParams newInstance(double fix, double perTimeUnit,double perDistanceUnit){ @@ -42,9 +55,24 @@ public class VehicleTypeImpl implements VehicleType { } } - + /** + * Builder that builds the vehicle-type. + * + * @author schroeder + * + */ public static class Builder{ + /** + * Returns a new instance. + * + *

Input parameters are id and capacity. Note that two vehicle-types are equal + * if they have the same vehicleId. + * + * @param id + * @param capacity + * @return + */ public static VehicleTypeImpl.Builder newInstance(String id, int capacity){ return new Builder(id,capacity); } @@ -59,20 +87,61 @@ public class VehicleTypeImpl implements VehicleType { private double perDistance = 1.0; private double perTime = 0.0; - public Builder(String id, int capacity) { + /** + * Constructs the builder. + * + * @param id + * @param capacity + */ + private Builder(String id, int capacity) { super(); this.id = id; this.capacity = capacity; } + /** + * Sets the maximum velocity this vehicle-type can go [in meter per seconds]. + * + * @param inMeterPerSeconds + * @return this builder + */ public VehicleTypeImpl.Builder setMaxVelocity(double inMeterPerSeconds){ this.maxVelo = inMeterPerSeconds; return this; } + /** + * Sets the fixed costs of the vehicle-type. + * + *

by default it is 0. + * + * @param fixedCost + * @return this builder + */ public VehicleTypeImpl.Builder setFixedCost(double fixedCost) { this.fixedCost = fixedCost; return this; } + /** + * Sets the cost per distance unit, for instance € per meter. + * + *

by default it is 1.0 + * + * @param perDistance + * @return this builder + */ public VehicleTypeImpl.Builder setCostPerDistance(double perDistance){ this.perDistance = perDistance; return this; } + /** + * Sets cost per time unit, for instance € per second. + * + *

by default it is 0.0 + * + * @param perTime + * @return + */ public VehicleTypeImpl.Builder setCostPerTime(double perTime){ this.perTime = perTime; return this; } + /** + * Builds the vehicle-type. + * + * @return + */ public VehicleTypeImpl build(){ return new VehicleTypeImpl(this); } @@ -88,6 +157,9 @@ public class VehicleTypeImpl implements VehicleType { return result; } + /** + * Two vehicle-types are equal if they have the same vehicleId. + */ @Override public boolean equals(Object obj) { if (this == obj) @@ -121,6 +193,11 @@ public class VehicleTypeImpl implements VehicleType { return new VehicleTypeImpl(typeId, capacity, para); } + /** + * priv constructor constructing vehicle-type + * + * @param builder + */ private VehicleTypeImpl(VehicleTypeImpl.Builder builder){ typeId = builder.id; capacity = builder.capacity;