added database and coupon and route daos

This commit is contained in:
Sem van der Hoeven
2020-12-14 12:00:01 +01:00
parent c4fd44ad76
commit 08215e18c5
6 changed files with 195 additions and 8 deletions

View File

@@ -1,15 +1,31 @@
package com.a1.nextlocation.data;
import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@Entity
public class Route {
@PrimaryKey
@NonNull
private String name;
private List<Location> locations;
@ColumnInfo(name = "total_distance")
private float totalDistance;
@ColumnInfo(name = "total_time")
private int totalTime;
public Route(String name) {
public Route(@NotNull String name) {
this.name = name;
this.locations = new ArrayList<>();
@@ -20,11 +36,12 @@ public class Route {
this.locations.add(location);
}
@NotNull
public String getName() {
return name;
}
public void setName(String name) {
public void setName(@NotNull String name) {
this.name = name;
}
@@ -47,4 +64,12 @@ public class Route {
return totalTime;
}
public void setTotalDistance(float totalDistance) {
this.totalDistance = totalDistance;
}
public void setTotalTime(int totalTime) {
this.totalTime = totalTime;
}
}