@@ -13,17 +13,30 @@ import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class PlantListModel {
|
||||
private final PlantDatabase plantDatabase;
|
||||
private PlantDatabase plantDatabase;
|
||||
private HardinessZone currentZone;
|
||||
|
||||
/**
|
||||
* Comparators to create sorted Plant List
|
||||
*/
|
||||
public final Comparator<Plant> sortByName = (Plant o1, Plant o2) -> o1.name().compareTo(o2.name());
|
||||
public final Comparator<Plant> getSortById = (Plant o1, Plant o2) -> Long.compare(o1.id(), o2.id());
|
||||
static final Comparator<Plant> sortByName = (Plant o1, Plant o2) -> o1.name().compareTo(o2.name());
|
||||
static final Comparator<Plant> SortById = (Plant o1, Plant o2) -> Long.compare(o1.id(), o2.id());
|
||||
|
||||
/**
|
||||
* Constructor to create Database Object.
|
||||
*/
|
||||
public PlantListModel() {
|
||||
plantDatabase = new JsonPlantDatabase();
|
||||
setDefaultZone();
|
||||
}
|
||||
|
||||
public PlantListModel(PlantDatabase plantDatabase){
|
||||
this.plantDatabase = plantDatabase;
|
||||
setDefaultZone();
|
||||
}
|
||||
|
||||
private void setDefaultZone(){
|
||||
currentZone = HardinessZone.ZONE_8A; // TODO: get Default Zone from Config
|
||||
}
|
||||
|
||||
public void setCurrentZone(HardinessZone currentZone) {
|
||||
|
||||
Reference in New Issue
Block a user