@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof RoadModelBuilders.PlaneRMB) { RoadModelBuilders.PlaneRMB that = (RoadModelBuilders.PlaneRMB) o; return (this.distanceUnit.equals(that.getDistanceUnit())) && (this.speedUnit.equals(that.getSpeedUnit())) && (this.min.equals(that.getMin())) && (this.max.equals(that.getMax())) && (Double.doubleToLongBits(this.maxSpeed) == Double.doubleToLongBits(that.getMaxSpeed())); } return false; }
/** * Tests that min and max points are correctly set (important because they are * both points). */ @Test public void testPlaneRMB() { final PlaneRMB b = RoadModelBuilders.plane() .withMinPoint(new Point(1, 1)) .withMaxPoint(new Point(2, 2)); assertThat(b.getMin()).isEqualTo(new Point(1, 1)); assertThat(b.getMax()).isEqualTo(new Point(2, 2)); final PlaneRoadModel prm = b.build(mock(DependencyProvider.class)); assertThat(prm.min).isEqualTo(b.getMin()); assertThat(prm.max).isEqualTo(b.getMax()); }
@Override public PlaneRMB withSpeedUnit(Unit<Velocity> unit) { return create(getDistanceUnit(), unit, getMin(), getMax(), getMaxSpeed()); }
@Override public PlaneRMB withMaxSpeed(double maxSpeed) { checkMaxSpeed(maxSpeed); return create(getDistanceUnit(), getSpeedUnit(), getMin(), getMax(), maxSpeed); }
@Override public PlaneRMB withMinPoint(Point minPoint) { return create(getDistanceUnit(), getSpeedUnit(), minPoint, getMax(), getMaxSpeed()); }
@Override public PlaneRMB withDistanceUnit(Unit<Length> unit) { return create(unit, getSpeedUnit(), getMin(), getMax(), getMaxSpeed()); }