Package models
Class Route
java.lang.Object
models.Route
- All Implemented Interfaces:
Comparable<Route>
Model of Route. Main model of the program. Contains getters/setters of each class fields.
Some fields have restrictions. It's signed under every method of field.
- Since:
- 1.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
boolean
Restrictions: Field cannot be null.Restrictions: Field cannot be null and the value of this field should be automatically generated.int
Restrictions: The value of this field should be greater than 1.getFrom()
Restrictions: Field can be null.getId()
Restrictions: Field cannot be null.getName()
Restrictions: Field cannot be null.getTo()
Restrictions: Field can be null.int
hashCode()
void
setCoordinates
(Coordinates coordinates) Restrictions: Field cannot be null.void
setCreationDate
(Date creationDate) Restrictions: Field cannot be null and the value of this field should be automatically generated.void
setDistance
(int distance) Restrictions: The value of this field should be greater than 1.void
Restrictions: Field can be null.void
Restrictions: Field cannot be null.void
Restrictions: Field cannot be null.void
Restrictions: Field can be null.toString()
-
Constructor Details
-
Route
public Route()
-
-
Method Details
-
getId
Restrictions: Field cannot be null. The value of this field should be unique, greater than 0 and automatically generated.- Returns:
- Value of field id
-
getName
Restrictions: Field cannot be null. String must not be empty.- Returns:
- Value of field name
-
getCoordinates
Restrictions: Field cannot be null.- Returns:
- Value of field coordinates
-
getCreationDate
Restrictions: Field cannot be null and the value of this field should be automatically generated.- Returns:
- Value of field creationDate
-
getFrom
Restrictions: Field can be null.- Returns:
- Value of field from
-
getTo
Restrictions: Field can be null.- Returns:
- Value of field to
-
getDistance
public int getDistance()Restrictions: The value of this field should be greater than 1.- Returns:
- Value of field distance
-
setCoordinates
Restrictions: Field cannot be null.- Parameters:
coordinates
- Value of field coordinates
-
setCreationDate
Restrictions: Field cannot be null and the value of this field should be automatically generated.- Parameters:
creationDate
- Value of field creationDate
-
setDistance
public void setDistance(int distance) Restrictions: The value of this field should be greater than 1.- Parameters:
distance
- Value of field distance
-
setFrom
Restrictions: Field can be null.- Parameters:
from
- Value of field from
-
setId
Restrictions: Field cannot be null. The value of this field should be unique, greater than 0 and automatically generated.- Parameters:
id
- Value of field id
-
setName
Restrictions: Field cannot be null. String must not be empty.- Parameters:
name
- Value of field name
-
setTo
Restrictions: Field can be null.- Parameters:
to
- Value of field to
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Route>
-