public class VehicleCapacity extends java.lang.Object implements java.lang.Comparable<VehicleCapacity>
This class implements the Comparable interface, so that it can be used to compare vehicle by their capacity.
| Constructor and Description |
|---|
VehicleCapacity(VehicleCategory vehicleCategory,
VehicleSegment vehicleSegment)
VehicleCapacity constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(VehicleCapacity arg0)
Vehicle capacities are compared according to their
vehicle categories and the corresponding segments.
|
boolean |
equals(java.lang.Object obj) |
VehicleCategory |
getVehicleCategory()
Returns the vehicle category.
|
VehicleSegment |
getVehicleSegment()
Returns the vehicle segment.
|
int |
hashCode() |
java.lang.String |
toString() |
public VehicleCapacity(VehicleCategory vehicleCategory, VehicleSegment vehicleSegment)
vehicleCategory - vehicle categoryvehicleSegment - vehicle segmentpublic VehicleCategory getVehicleCategory()
public VehicleSegment getVehicleSegment()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(VehicleCapacity arg0)
compareTo in interface java.lang.Comparable<VehicleCapacity>arg0 - vehicle capacity to compare