You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
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<Stop> stops;
|
|
private ArrayList<Stop> serialisedStops;
|
|
|
|
public Route(String name, ObservableList<Stop> 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<Stop> 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;
|
|
}
|
|
}
|