модели данных
This commit is contained in:
parent
1a6faa5540
commit
8824130025
62
src/main/java/org/dbms/models/Car.java
Normal file
62
src/main/java/org/dbms/models/Car.java
Normal file
@ -0,0 +1,62 @@
|
||||
package org.dbms.models;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Car {
|
||||
private Long id;
|
||||
private String model;
|
||||
private Date year;
|
||||
private double cost;
|
||||
private Parking parking;
|
||||
|
||||
public Car() {}
|
||||
public Car(Long id, String model, Date year, double cost, Parking parking) {
|
||||
this.id = id;
|
||||
this.model = model;
|
||||
this.year = year;
|
||||
this.cost = cost;
|
||||
this.parking = parking;
|
||||
}
|
||||
|
||||
public Car(String model, Date year, double cost, Parking parking) {
|
||||
this.id = id;
|
||||
this.model = model;
|
||||
this.year = year;
|
||||
this.cost = cost;
|
||||
this.parking = parking;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Date getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public double getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public Parking getParking() {
|
||||
return parking;
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Car car = (Car) o;
|
||||
return Double.compare(car.cost, cost) == 0 && Objects.equals(id, car.id) && Objects.equals(model, car.model) && Objects.equals(year, car.year) && Objects.equals(parking, car.parking);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, model, year, cost, parking);
|
||||
}
|
||||
}
|
45
src/main/java/org/dbms/models/Client.java
Normal file
45
src/main/java/org/dbms/models/Client.java
Normal file
@ -0,0 +1,45 @@
|
||||
package org.dbms.models;
|
||||
|
||||
public class Client {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String phone;
|
||||
private String login;
|
||||
private String password;
|
||||
|
||||
public Client() {}
|
||||
public Client(Long id, String name, String phone, String login, String password) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.phone = phone;
|
||||
this.login = login;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Client(String name, String phone, String login, String password) {
|
||||
this.name = name;
|
||||
this.phone = phone;
|
||||
this.login = login;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public String getLogin() {
|
||||
return login;
|
||||
}
|
||||
}
|
40
src/main/java/org/dbms/models/Driver.java
Normal file
40
src/main/java/org/dbms/models/Driver.java
Normal file
@ -0,0 +1,40 @@
|
||||
package org.dbms.models;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Driver {
|
||||
Long id;
|
||||
String name;
|
||||
Date licenseYear;
|
||||
Car car;
|
||||
|
||||
public Driver() {}
|
||||
public Driver(Long id, String name, Date licenseYear, Car car) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.licenseYear = licenseYear;
|
||||
this.car = car;
|
||||
}
|
||||
|
||||
public Driver(String name, Date licenseYear, Car car) {
|
||||
this.name = name;
|
||||
this.licenseYear = licenseYear;
|
||||
this.car = car;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Car getCar() {
|
||||
return car;
|
||||
}
|
||||
|
||||
public Date getLicenseYear() {
|
||||
return licenseYear;
|
||||
}
|
||||
}
|
58
src/main/java/org/dbms/models/Order.java
Normal file
58
src/main/java/org/dbms/models/Order.java
Normal file
@ -0,0 +1,58 @@
|
||||
package org.dbms.models;
|
||||
|
||||
public class Order {
|
||||
private Long id;
|
||||
private String from;
|
||||
private String to;
|
||||
private double price;
|
||||
private int deliveryWeight;
|
||||
private Driver driver;
|
||||
private Client client;
|
||||
|
||||
public Order(Long id, String from, String to, double price, int deliveryWeight, Driver driver, Client client) {
|
||||
this.id = id;
|
||||
this.from = from;
|
||||
this.price = price;
|
||||
this.to = to;
|
||||
this.deliveryWeight = deliveryWeight;
|
||||
this.driver = driver;
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public Order(String from, String to, double price, int deliveryWeight, Driver driver, Client client) {
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.deliveryWeight = deliveryWeight;
|
||||
this.price = price;
|
||||
this.driver = driver;
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Client getClient() {
|
||||
return client;
|
||||
}
|
||||
|
||||
public double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public Driver getDriver() {
|
||||
return driver;
|
||||
}
|
||||
|
||||
public int getDeliveryWeight() {
|
||||
return deliveryWeight;
|
||||
}
|
||||
|
||||
public String getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public String getTo() {
|
||||
return to;
|
||||
}
|
||||
}
|
32
src/main/java/org/dbms/models/Parking.java
Normal file
32
src/main/java/org/dbms/models/Parking.java
Normal file
@ -0,0 +1,32 @@
|
||||
package org.dbms.models;
|
||||
|
||||
public class Parking {
|
||||
private Long id;
|
||||
private String address;
|
||||
private int capacity;
|
||||
|
||||
public Parking() {}
|
||||
|
||||
public Parking(Long id, String address, int capacity) {
|
||||
this.id = id;
|
||||
this.address = address;
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public Parking(String address, int capacity) {
|
||||
this.address = address;
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user