package model; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import java.util.ArrayList; /** * Created by Gondr on 5/04/2017. */ public class Route { private String name; private transient ObservableList stops; private ArrayList serialisedStops; public Route(String name, ObservableList stops){ this.name = name; this.stops = FXCollections.observableArrayList(stops); } public void serialise(){ serialisedStops = new ArrayList<>(stops); } public void deserialise(){ stops = FXCollections.observableArrayList(serialisedStops); } public String getName() { return name; } public ObservableList getStops() { return stops; } public boolean equals(Route route){ if (this.name != route.getName()){ if (this.getStops().equals(route.getStops())){ //if the yhave a equivalent route somewhere. return true; } return false; } return true; } public String toString(){ return this.name; } }