package builder;
import abstractFactory.Car;
public class ProductionLine {
public Car MakeCar(CarBuilder builder) {
builder.MakeCar();
// Wheels:
builder.MakeWheel(Car.LEFT, Car.BACK);
builder.MakeWheel(Car.RIGHT, Car.BACK);
builder.MakeWheel(Car.LEFT, Car.FRONT);
builder.MakeWheel(Car.RIGHT, Car.FRONT);
// Doors:
builder.MakeDoor(Car.LEFT, Car.BACK);
builder.MakeDoor(Car.RIGHT, Car.BACK);
builder.MakeDoor(Car.LEFT, Car.FRONT);
builder.MakeDoor(Car.RIGHT, Car.FRONT);
// Engine
builder.MakeEngine(Car.FRONT);
builder.Colour(Car.METALLIC);
return builder.GetCar();
}
public Car MakeSportCar(CarBuilder builder) {
builder.MakeCar();
// 4 wheels:
builder.MakeWheel(Car.LEFT, Car.BACK);
builder.MakeWheel(Car.RIGHT, Car.BACK);
builder.MakeWheel(Car.LEFT, Car.FRONT);
builder.MakeWheel(Car.RIGHT, Car.FRONT);
// Only 2 doors:
builder.MakeDoor(Car.LEFT, Car.FRONT);
builder.MakeDoor(Car.RIGHT, Car.FRONT);
// Engine at the back
builder.MakeEngine(Car.BACK);
builder.Colour(Car.RED);
return builder.GetCar();
}
}