1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

rename VehicleBuilder to Builder; adapt VehicleFleetManagerTest to

changes in VehicleFleetManager
This commit is contained in:
oblonski 2013-06-21 02:41:53 +02:00
parent c1849a9d5a
commit 7386ba7309
24 changed files with 137 additions and 91 deletions

View file

@ -62,7 +62,7 @@ final class CalculatesVehTypeDepServiceInsertion implements JobInsertionCalculat
Collection<Vehicle> relevantVehicles = new ArrayList<Vehicle>();
if(!(selectedVehicle instanceof NoVehicle)) {
relevantVehicles.add(selectedVehicle);
relevantVehicles.addAll(fleetManager.getAvailableVehicle(selectedVehicle.getType().getTypeId(),selectedVehicle.getLocationId()));
relevantVehicles.addAll(fleetManager.getAvailableVehicles(selectedVehicle.getType().getTypeId(),selectedVehicle.getLocationId()));
}
else{
relevantVehicles.addAll(fleetManager.getAvailableVehicles());

View file

@ -80,7 +80,7 @@ final class FindCheaperVehicleAlgo {
path.addAll(vehicleRoute.getTourActivities().getActivities());
path.add(vehicleRoute.getEnd());
for(Vehicle vehicle : fleetManager.getAvailableVehicle(vehicleRoute.getVehicle().getType().getTypeId(), vehicleRoute.getVehicle().getLocationId())){
for(Vehicle vehicle : fleetManager.getAvailableVehicles(vehicleRoute.getVehicle().getType().getTypeId(), vehicleRoute.getVehicle().getLocationId())){
// Vehicle vehicle = fleetManager.getEmptyVehicle(vehicleType);
if(vehicle.getType().getTypeId().equals(vehicleRoute.getVehicle().getType().getTypeId())){
continue;

View file

@ -92,13 +92,13 @@ class InfiniteVehicles implements VehicleFleetManager{
}
@Override
public Collection<? extends Vehicle> getAvailableVehicles() {
public Collection<Vehicle> getAvailableVehicles() {
// TODO Auto-generated method stub
return null;
}
@Override
public Collection<? extends Vehicle> getAvailableVehicle(
public Collection<Vehicle> getAvailableVehicles(
String withoutThisType, String locationId) {
// TODO Auto-generated method stub
return null;

View file

@ -81,8 +81,8 @@ interface VehicleFleetManager {
abstract void unlockAll();
abstract Collection<? extends Vehicle> getAvailableVehicles();
abstract Collection<Vehicle> getAvailableVehicles();
Collection<? extends Vehicle> getAvailableVehicle(String withoutThisType, String locationId);
Collection<Vehicle> getAvailableVehicles(String withoutThisType, String locationId);
}

View file

@ -169,7 +169,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
* this type and location. If so, it returns this penalty vehicle. If not, no vehicle with this type and location is returned.
*/
@Override
public Collection<? extends Vehicle> getAvailableVehicles() {
public Collection<Vehicle> getAvailableVehicles() {
List<Vehicle> vehicles = new ArrayList<Vehicle>();
for(TypeKey key : typeMapOfAvailableVehicles.keySet()){
if(!typeMapOfAvailableVehicles.get(key).isEmpty()){
@ -195,7 +195,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
* @return collection of available vehicles without the vehicles that have the typeId 'withoutThisType' AND the locationId 'withThisLocation'.
*/
@Override
public Collection<? extends Vehicle> getAvailableVehicle(String withoutThisType, String withThisLocationId) {
public Collection<Vehicle> getAvailableVehicles(String withoutThisType, String withThisLocationId) {
List<Vehicle> vehicles = new ArrayList<Vehicle>();
TypeKey thisKey = new TypeKey(withoutThisType,withThisLocationId);
for(TypeKey key : typeMapOfAvailableVehicles.keySet()){

View file

@ -51,7 +51,7 @@ import basics.route.Start;
import basics.route.TimeWindow;
import basics.route.Vehicle;
import basics.route.VehicleImpl;
import basics.route.VehicleImpl.VehicleBuilder;
import basics.route.VehicleImpl.Builder;
import basics.route.VehicleRoute;
import basics.route.VehicleType;
import basics.route.VehicleTypeImpl;
@ -284,7 +284,7 @@ public class VrpXMLReader{
for(HierarchicalConfiguration vehicleConfig : vehicleConfigs){
String vehicleId = vehicleConfig.getString("id");
if(vehicleId == null) throw new IllegalStateException("vehicleId is missing.");
VehicleBuilder builder = VehicleImpl.VehicleBuilder.newInstance(vehicleId);
Builder builder = VehicleImpl.Builder.newInstance(vehicleId);
String typeId = vehicleConfig.getString("typeId");
if(typeId == null) throw new IllegalStateException("typeId is missing.");
VehicleTypeImpl type = types.get(typeId);

View file

@ -31,7 +31,7 @@ public class VehicleImpl implements Vehicle {
public static class NoVehicle extends VehicleImpl {
public NoVehicle() {
super(VehicleBuilder.newInstance("noVehicle").setType(VehicleTypeImpl.newInstance(null, 0, null)));
super(Builder.newInstance("noVehicle").setType(VehicleTypeImpl.newInstance(null, 0, null)));
}
public int getCapacity(){
@ -40,8 +40,8 @@ public class VehicleImpl implements Vehicle {
}
public static class VehicleBuilder {
static Logger log = Logger.getLogger(VehicleBuilder.class);
public static class Builder {
static Logger log = Logger.getLogger(Builder.class);
private String id;
private String locationId;
@ -51,32 +51,32 @@ public class VehicleImpl implements Vehicle {
private VehicleType type = VehicleTypeImpl.Builder.newInstance("default", 0).build();
private VehicleBuilder(String id) {
private Builder(String id) {
super();
this.id = id;
}
public VehicleBuilder setType(VehicleType type){
public Builder setType(VehicleType type){
this.type = type;
return this;
}
public VehicleBuilder setLocationId(String id){
public Builder setLocationId(String id){
this.locationId = id;
return this;
}
public VehicleBuilder setLocationCoord(Coordinate coord){
public Builder setLocationCoord(Coordinate coord){
this.locationCoord = coord;
return this;
}
public VehicleBuilder setEarliestStart(double start){
public Builder setEarliestStart(double start){
this.earliestStart = start;
return this;
}
public VehicleBuilder setLatestArrival(double arr){
public Builder setLatestArrival(double arr){
this.latestArrival = arr;
return this;
}
@ -88,7 +88,7 @@ public class VehicleImpl implements Vehicle {
return new VehicleImpl(this);
}
public static VehicleBuilder newInstance(String vehicleId){ return new VehicleBuilder(vehicleId); }
public static Builder newInstance(String vehicleId){ return new Builder(vehicleId); }
}
@ -109,7 +109,7 @@ public class VehicleImpl implements Vehicle {
private final double latestArrival;
private VehicleImpl(VehicleBuilder builder){
private VehicleImpl(Builder builder){
id = builder.id;
type = builder.type;
coord = builder.locationCoord;

View file

@ -44,7 +44,7 @@ public class CalcWithTimeSchedulingTest {
public void timeScheduler(){
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
Vehicle vehicle = VehicleImpl.VehicleBuilder.newInstance("myVehicle").setEarliestStart(0.0).setLatestArrival(100.0).
Vehicle vehicle = VehicleImpl.Builder.newInstance("myVehicle").setEarliestStart(0.0).setLatestArrival(100.0).
setLocationCoord(Coordinate.newInstance(0, 0)).setLocationId("0,0")
.setType(VehicleTypeImpl.Builder.newInstance("myType", 20).setCostPerDistance(1.0).build()).build();
vrpBuilder.addVehicle(vehicle);

View file

@ -128,9 +128,9 @@ public class GendreauPostOptTest {
VehicleTypeImpl lightType = VehicleTypeImpl.Builder.newInstance("light", 10).setFixedCost(10).setCostPerDistance(1.0).build();
VehicleTypeImpl heavyType = VehicleTypeImpl.Builder.newInstance("heavy", 10).setFixedCost(30).setCostPerDistance(2.0).build();
lightVehicle1 = VehicleImpl.VehicleBuilder.newInstance("light").setLocationId("0,0").setType(lightType).build();
lightVehicle2 = VehicleImpl.VehicleBuilder.newInstance("light2").setLocationId("0,0").setType(lightType).build();
heavyVehicle = VehicleImpl.VehicleBuilder.newInstance("heavy").setLocationId("0,0").setType(heavyType).build();
lightVehicle1 = VehicleImpl.Builder.newInstance("light").setLocationId("0,0").setType(lightType).build();
lightVehicle2 = VehicleImpl.Builder.newInstance("light2").setLocationId("0,0").setType(lightType).build();
heavyVehicle = VehicleImpl.Builder.newInstance("heavy").setLocationId("0,0").setType(heavyType).build();
job1 = getService("10,0");

View file

@ -50,7 +50,7 @@ public class TestDepartureTimeOpt {
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
VehicleType type = mock(VehicleTypeImpl.class);
Vehicle vehicle = VehicleImpl.VehicleBuilder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
@ -78,7 +78,7 @@ public class TestDepartureTimeOpt {
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
VehicleType type = mock(VehicleTypeImpl.class);
Vehicle vehicle = VehicleImpl.VehicleBuilder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
@ -105,7 +105,7 @@ public class TestDepartureTimeOpt {
public void whenSettingOneCustWithTWAndDepTimeChoice_totalCostsShouldBe50(){
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
Vehicle vehicle = VehicleImpl.VehicleBuilder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
@ -133,7 +133,7 @@ public class TestDepartureTimeOpt {
public void whenSettingOneCustWithTWAndDepTimeChoice_depTimeShouldBe0(){
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
Vehicle vehicle = VehicleImpl.VehicleBuilder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
@ -165,7 +165,7 @@ public class TestDepartureTimeOpt {
Service service2 = Service.Builder.newInstance("s2", 0).setLocationId("servLoc2").setCoord(Coordinate.newInstance(0, 20)).
setTimeWindow(TimeWindow.newInstance(30, 40)).build();
Vehicle vehicle = VehicleImpl.VehicleBuilder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
@ -197,7 +197,7 @@ public class TestDepartureTimeOpt {
Service service2 = Service.Builder.newInstance("s2", 0).setLocationId("servLoc2").setCoord(Coordinate.newInstance(0, 20)).
setTimeWindow(TimeWindow.newInstance(30, 40)).build();
Vehicle vehicle = VehicleImpl.VehicleBuilder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();

View file

@ -104,7 +104,7 @@ public class TestTourStateUpdaterWithService {
states.initialiseStateOfJobs(services);
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("test", 0).build();
vehicle = VehicleImpl.VehicleBuilder.newInstance("testvehicle").setType(type).setLocationId("0,0")
vehicle = VehicleImpl.Builder.newInstance("testvehicle").setType(type).setLocationId("0,0")
.setEarliestStart(0.0).setLatestArrival(50.0).build();
tour = new TourActivities();

View file

@ -25,7 +25,7 @@ import java.util.Collection;
import java.util.List;
import junit.framework.TestCase;
import algorithms.VehicleFleetManager.TypeKey;
import basics.route.PenaltyVehicleType;
import basics.route.Vehicle;
import basics.route.VehicleImpl;
import basics.route.VehicleTypeImpl;
@ -41,38 +41,32 @@ public class TestVehicleFleetManager extends TestCase{
public void setUp(){
List<Vehicle> vehicles = new ArrayList<Vehicle>();
v1 = VehicleImpl.VehicleBuilder.newInstance("standard").setLocationId("loc").setType(VehicleTypeImpl.Builder.newInstance("standard", 0).build()).build();
v2 = VehicleImpl.VehicleBuilder.newInstance("foo").setLocationId("fooLoc").setType(VehicleTypeImpl.Builder.newInstance("foo", 0).build()).build();
v1 = VehicleImpl.Builder.newInstance("standard").setLocationId("loc").setType(VehicleTypeImpl.Builder.newInstance("standard", 0).build()).build();
v2 = VehicleImpl.Builder.newInstance("foo").setLocationId("fooLoc").setType(VehicleTypeImpl.Builder.newInstance("foo", 0).build()).build();
vehicles.add(v1);
vehicles.add(v2);
fleetManager = new VehicleFleetManagerImpl(vehicles);
}
public void testGetTypes(){
Collection<TypeKey> types = fleetManager.getAvailableVehicleTypes();
assertEquals(2, types.size());
}
public void testGetVehicle(){
TypeKey typeKey = new TypeKey(v1.getType().getTypeId(),v1.getLocationId());
Vehicle v = fleetManager.getEmptyVehicle(typeKey);
assertEquals(v.getId(), v1.getId());
public void testGetVehicles(){
Collection<Vehicle> vehicles = fleetManager.getAvailableVehicles();
assertEquals(2, vehicles.size());
}
public void testLock(){
fleetManager.lock(v1);
Collection<TypeKey> types = fleetManager.getAvailableVehicleTypes();
assertEquals(1, types.size());
Collection<Vehicle> vehicles = fleetManager.getAvailableVehicles();
assertEquals(1, vehicles.size());
}
public void testLockTwice(){
fleetManager.lock(v1);
Collection<TypeKey> types = fleetManager.getAvailableVehicleTypes();
assertEquals(1, types.size());
Collection<Vehicle> vehicles = fleetManager.getAvailableVehicles();
assertEquals(1, vehicles.size());
try{
fleetManager.lock(v1);
Collection<TypeKey> types_ = fleetManager.getAvailableVehicleTypes();
Collection<Vehicle> vehicles_ = fleetManager.getAvailableVehicles();
assertFalse(true);
}
catch(IllegalStateException e){
@ -80,21 +74,73 @@ public class TestVehicleFleetManager extends TestCase{
}
}
public void testGetTypesWithout(){
TypeKey typeKey = new TypeKey(v1.getType().getTypeId(),v1.getLocationId());
Collection<TypeKey> types = fleetManager.getAvailableVehicleTypes(typeKey);
public void testGetVehiclesWithout(){
Collection<Vehicle> vehicles = fleetManager.getAvailableVehicles(v1.getType().getTypeId(),v1.getLocationId());
assertEquals(new TypeKey(v2.getType().getTypeId(),v2.getLocationId()), types.iterator().next());
assertEquals(1, types.size());
assertEquals(v2, vehicles.iterator().next());
assertEquals(1, vehicles.size());
}
public void testUnlock(){
fleetManager.lock(v1);
Collection<TypeKey> types = fleetManager.getAvailableVehicleTypes();
assertEquals(1, types.size());
Collection<Vehicle> vehicles = fleetManager.getAvailableVehicles();
assertEquals(1, vehicles.size());
fleetManager.unlock(v1);
Collection<TypeKey> types_ = fleetManager.getAvailableVehicleTypes();
assertEquals(2, types_.size());
Collection<Vehicle> vehicles_ = fleetManager.getAvailableVehicles();
assertEquals(2, vehicles_.size());
}
public void testWithPenalty_whenHavingOneRegularVehicleAvailable_noPenaltyVehicleIsReturn(){
Vehicle penalty4standard = VehicleImpl.Builder.newInstance("standard_penalty").setLocationId("loc").
setType(VehicleTypeImpl.Builder.newInstance("standard", 0).build()).build();
List<Vehicle> vehicles = new ArrayList<Vehicle>();
vehicles.add(v1);
vehicles.add(v2);
vehicles.add(penalty4standard);
VehicleFleetManager fleetManager = new VehicleFleetManagerImpl(vehicles);
Collection<Vehicle> availableVehicles = fleetManager.getAvailableVehicles();
assertEquals(2, availableVehicles.size());
}
public void testWithPenalty_whenHavingTwoRegularVehicleAvailablePlusOnePenaltyVehicle_andOneIsLocked_returnTheOtherRegularVehicle(){
VehicleTypeImpl penaltyType = VehicleTypeImpl.Builder.newInstance("standard", 0).build();
PenaltyVehicleType penaltyVehicleType = new PenaltyVehicleType(penaltyType);
Vehicle penalty4standard = VehicleImpl.Builder.newInstance("standard_penalty").setLocationId("loc").
setType(penaltyVehicleType).build();
Vehicle v3 = VehicleImpl.Builder.newInstance("standard_v3").setLocationId("loc").
setType(penaltyType).build();
List<Vehicle> vehicles = new ArrayList<Vehicle>();
vehicles.add(v1);
vehicles.add(v2);
vehicles.add(penalty4standard);
vehicles.add(v3);
VehicleFleetManager fleetManager = new VehicleFleetManagerImpl(vehicles);
fleetManager.lock(v1);
fleetManager.lock(v2);
Collection<Vehicle> availableVehicles = fleetManager.getAvailableVehicles();
assertEquals(1, availableVehicles.size());
assertEquals(v3, availableVehicles.iterator().next());
}
public void testWithPenalty_whenHavingNoRegularVehicleAvailable_penaltyVehicleIsReturned(){
VehicleTypeImpl penaltyType = VehicleTypeImpl.Builder.newInstance("standard", 0).build();
Vehicle penalty4standard = VehicleImpl.Builder.newInstance("standard_penalty").setLocationId("loc").
setType(penaltyType).build();
List<Vehicle> vehicles = new ArrayList<Vehicle>();
vehicles.add(v1);
vehicles.add(v2);
vehicles.add(penalty4standard);
VehicleFleetManager fleetManager = new VehicleFleetManagerImpl(vehicles);
fleetManager.lock(v1);
fleetManager.lock(v2);
Collection<Vehicle> availableVehicles = fleetManager.getAvailableVehicles();
assertEquals(penalty4standard, availableVehicles.iterator().next());
}
}

View file

@ -51,10 +51,10 @@ public class VehicleRoutingProblemBuilderTest {
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("t1", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("t2", 200).build();
Vehicle v1 = VehicleImpl.VehicleBuilder.newInstance("v1").setLocationId("yo").setType(type1).build();
Vehicle v2 = VehicleImpl.VehicleBuilder.newInstance("v2").setLocationId("yo").setType(type1).build();
Vehicle v3 = VehicleImpl.VehicleBuilder.newInstance("v3").setLocationId("yo").setType(type2).build();
Vehicle v4 = VehicleImpl.VehicleBuilder.newInstance("v4").setLocationId("yo").setType(type2).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("yo").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("yo").setType(type1).build();
Vehicle v3 = VehicleImpl.Builder.newInstance("v3").setLocationId("yo").setType(type2).build();
Vehicle v4 = VehicleImpl.Builder.newInstance("v4").setLocationId("yo").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);

View file

@ -67,7 +67,7 @@ public class VrpWriterV2Test {
// builder.assignVehicleType(depot, VehicleType.Builder.newInstance("vehType", 20).build());
// builder.assignVehicleType(depot, VehicleType.Builder.newInstance("vehType2", 200).build());
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
Vehicle vehicle = VehicleImpl.VehicleBuilder.newInstance("myVehicle").setLocationId("loc").setType(type).build();
Vehicle vehicle = VehicleImpl.Builder.newInstance("myVehicle").setLocationId("loc").setType(type).build();
builder.addVehicle(vehicle);
VehicleRoutingProblem vrp = builder.build();
new VrpXMLWriter(vrp, null).write(infileName);
@ -83,8 +83,8 @@ public class VrpWriterV2Test {
// builder.addDepot(depot2);
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
Vehicle v1 = VehicleImpl.VehicleBuilder.newInstance("v1").setLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.VehicleBuilder.newInstance("v2").setLocationId("loc").setType(type2).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
builder.addVehicleType(type1);
builder.addVehicleType(type2);
builder.addVehicle(v1);
@ -103,8 +103,8 @@ public class VrpWriterV2Test {
// builder.addDepot(depot2);
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
Vehicle v1 = VehicleImpl.VehicleBuilder.newInstance("v1").setLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.VehicleBuilder.newInstance("v2").setLocationId("loc").setType(type2).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
builder.addVehicleType(type1);
builder.addVehicleType(type2);
builder.addVehicle(v1);
@ -122,8 +122,8 @@ public class VrpWriterV2Test {
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
Vehicle v1 = VehicleImpl.VehicleBuilder.newInstance("v1").setLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.VehicleBuilder.newInstance("v2").setLocationId("loc").setType(type2).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
builder.addVehicleType(type1);
builder.addVehicleType(type2);
@ -155,8 +155,8 @@ public class VrpWriterV2Test {
builder.setFleetSize(FleetSize.FINITE);
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
Vehicle v1 = VehicleImpl.VehicleBuilder.newInstance("v1").setLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.VehicleBuilder.newInstance("v2").setLocationId("loc").setType(type2).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
builder.addVehicleType(type1);
builder.addVehicleType(type2);
builder.addVehicle(v1);

View file

@ -62,8 +62,8 @@ public class VrpWriterV3Test {
builder.setFleetSize(FleetSize.FINITE);
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
Vehicle v1 = VehicleImpl.VehicleBuilder.newInstance("v1").setLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.VehicleBuilder.newInstance("v2").setLocationId("loc").setType(type2).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
builder.addVehicleType(type1);
builder.addVehicleType(type2);
builder.addVehicle(v1);

View file

@ -38,7 +38,7 @@ public class TestVehicleRoute {
@Before
public void doBefore(){
vehicle = VehicleImpl.VehicleBuilder.newInstance("v").setLocationId("loc").setType(VehicleTypeImpl.Builder.newInstance("yo", 0).build()).build();
vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(VehicleTypeImpl.Builder.newInstance("yo", 0).build()).build();
driver = DriverImpl.noDriver();
}
@ -88,7 +88,7 @@ public class TestVehicleRoute {
@Test
public void whenBuildingEmptyTour_tourIterIteratesOverAnEmptyList(){
TourActivities tour = new TourActivities();
Vehicle v = VehicleImpl.VehicleBuilder.newInstance("v").setLocationId("loc").setType(VehicleTypeImpl.Builder.newInstance("yo", 0).build()).build();
Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(VehicleTypeImpl.Builder.newInstance("yo", 0).build()).build();
VehicleRoute route = VehicleRoute.newInstance(tour,DriverImpl.noDriver(),v);
Iterator<TourActivity> iter = route.getTourActivities().iterator();
int count = 0;