Trouble with Air Traffic Control Program using LinkedList Java - java

I've been working on this program for a few weeks now, it's our final project in my Java programming class and it has been giving me (and a lot of other students) some pretty good headaches.
We need to create a program that allows a user to enter, display and remove new planes along with the plane's speed, altitude and type of plane.
I've been having the most problems with getting the main class to communicate with the other classes. Because of this, I don't know if my LinkedList is going to work properly, or if at all. I'm worried that the list is not going to properly store all the fields together and that the node is not properly coded.
I could really use any help or advice you can provide. Code is below. I'm open to any and all suggestions. The code does not have to stay in exactly the same classes it is currently in. If something would work better somewhere else, I'd be happy to try it.
Main Class. This is where the user will be interacting with the program. I have been having a hard time getting the methods from other classes to work in this class. I'm sure it is something simple that I am missing.
package airTraffic;
import java.util.*;
public class Main {
static Scanner in = new Scanner(System.in);
public static void main(String[] args) {
do {
try {
System.out.println("Please enter command to proceed: ");
System.out.println("Enter new aircraft = e");
System.out.println("Display all aircraft = d");
System.out.println("Show specific flight = s");
System.out.println("Remove specific flight = r");
String command = in.next();
in.next(command);
if ( (in.next(command)).equals("e") ) {
ATControl.addToList(); // need to somehow "start" this class
} else if ( (in.next(command)).equals("d") ) {
ATControl.displayAll();
} else if ( (in.next(command)).equals("s") ){
ATControl.showFlight();
} else if ( (in.next(command)).equals("r") ) {
ATControl.removeFlight();
} else if ( (in.next(command)).equals(null) ) {
}
} catch (InputMismatchException exc) {
System.out.println("Wrong entry, please try again:");
}
} while (true);
}
}
Linked List and Node - I called it Aircraft. I think this is where the list is stored and created. Manipulation to the list occurs in the next class (ATControl), or at least I think it will.
package airTraffic;
import java.util.LinkedList;
public class Aircraft {
// stores data
private static final int INITIAL_ALLOCATION = 20;
private int size = INITIAL_ALLOCATION;
//declare LinkedList and node names
static LinkedList <String> list = new LinkedList <String> ();
private Aircraft head = new Aircraft ();
private Aircraft tail = new Aircraft ();
// tells list to add nodes
public void addNodes (int n, LinkedList<String> s) {
s = list;
head.next = tail;
tail.next = tail;
size = n;
Aircraft temp = head;
for (int i= 0; i < size; ++i) {
temp.next = new Aircraft ();
temp = temp.next;
}
temp.next = tail;
}
private String value;
Aircraft craft;
public Aircraft (String v) {
value = v;
}
public Aircraft () {
}
public String get () {
return value;
}
public void set (String v) {
value = v;
}
public Aircraft next = null;
//auto generated method from ATControl
public static void add(String flight) {
// a for or while loop might be needed here. Seems to easy to just have an empty add class
}
//auto generated method from ATControl
public static void remove() {
}
}
ATControl class. This is where (I think) the list is manipulated, allowing the user to add, remove and show the flights.
package airTraffic;
import java.util.*;
public class ATControl{
// implement Aircraft class (node) - empty argument list??
Aircraft aircraft = new Aircraft ();
static Scanner in = new Scanner (System.in);
// list of planes
static String [] planeList = {"Wide-body Airliner = w", "Regional Airliner = r", "Private Plane = p",
"Military = m", "Cargo only: c", "Unknown = u"};
//add plane and details
public static void addToList () {
System.out.printf("Enter flight number: ");
String flight = in.nextLine();
Aircraft.add(flight);
//type of plane
System.out.printf("Enter type of plane, ", "Choose from: " + planeList);
String type = in.nextLine();
try {
if (type == "w") {
System.out.println("Wide-body Airliner");
}else if (type == "r") {
System.out.println("Regional Airliner");
}else if (type == "p") {
System.out.println("Private Plane");
}else if (type == "m") {
System.out.println("Military");
}else if (type == "c") {
System.out.println("Cargo only");
}else if (type == "u") {
System.out.println("Unknown");
} else type = null;
}
catch (InputMismatchException i) {
System.out.println("You must enter valid command: " + planeList);
}
Aircraft.add(type);
//plane speed
System.out.printf("Enter current speed: ");
String speed = in.nextLine();
Aircraft.add(speed);
//add Altitude
System.out.printf("Enter current altitude: ");
String alt = in.nextLine();
Aircraft.add(alt);
}
//show flight
public static void showFlight () {
System.out.printf("Enter flight number for details: ");
in.nextLine();
Aircraft.get(Aircraft, index);
}
// display all flights
public static void displayAll () {
System.out.printf("All flights: " );
}
//remove flight
public static void removeFlight () {
System.out.printf("Enter flight number to be removed: ");
in.nextLine();
Aircraft.remove();
}
}
Any ideas? Thank you!

To "start" ATControl, you need to create a new instance of it:
ATControl control = new ATControl();
control.addToList();
Same with your Aircraft. You will want to create new instances with new, and then call Add(), etc. on them.
You will also probably want to pass your Scanner from main into the new ATControl and use it to read the input, instead of using a brand new Scanner

When using object oriented design, think of your objects as representations of actual objects. Your aircraft class should represent an actual aircraft. The aircraft should keep track of things that are associated with it. So things like flight number, speed, altitude, etc.. should be properties of that class.
public class Aircraft{
private int speed;
private int altitude;
private int flightNum;
//
//Regional Airliner, Military, Private Plane, etc.
private String type;
public void setSpeed(int speed){
this.speed = speed;
}
public int getSpeed(){
return speed;
}
//
//TODO: Getters and Setters for the rest of the aircraft properties
}
Now pretty much everything else should be handled by your ATControl class. An array list of type Aircraft seems much more logical to use in this case.
public class ATControl{
private ArrayList<Aircraft> currentFlights;
//
//Constructor gets called on initialization
public ATControl(){
currentFlights = new ArrayList<Aircraft>();
}
//
//User input should be handled in main class and passed into this
public void addFlight(int flightNum, int speed, int altitude){
Aircraft newCraft = new Aircraft();
//
//assign the properties we just got from the user to our new aircraft
newCraft.setFlightNumber(flightNum);
newCraft.setSpeed(speed);
//
//Now add our new flight to the list of current flights
currentFlights.add(newCraft);
}
}
Your main class can remain pretty much as you have it. I would handle all user input there, though.
public class Main {
static Scanner in = new Scanner(System.in);
public static void main(String[] args) {
ATControl denverTrafficControl = new ATControl();
//
//Handle user input here: get the speed, altitude, flightNum, etc..
denverTrafficControl.addFlight(flightNum, speed, altitude);
}
}
This is how it should be done. Hopefully this has helped you grasp the objected oriented design a bit better. Let the main class handle I/O and your other actual "object" classes handle the data. Good luck.

Your general design seems to ignore object oriented principles. As I see it, aircraft should hold its type, speed and altitude together in one object.
Why reinvent the wheel? There are plenty of premade (and well tested) collection classes already built into the JRE (e.g. ArrayList, LinkedList). Make use of them to hold your aircraft instances.
These two changes should drastically reduce the amount of code you need to write/maintain and the overall complexity of the program should be reduced considerably.

Related

Creating multiple objects of the same type with user input?

I'm trying to make a program with three class files, two Objects files and one Main that accesses both and runs operations. The first object file creates objects with one parameter, and then assigns attributes to itself based on said parameter, for example.
public class People {
private int height, weight;
private String specificPerson;
public People(String person){
this.specificPerson = person;
this.height = person.length * 12;
this.weight = person.length * 40;
}
public int getHeight(){return height;}
public int getWeight() {return weight;}
}
These objects are then stored within the array of another object which has a capacity and an array:
public class peopleIndexer {
private int pcapacity, size;
private String[] peopleArray;
public peopleIndexer(int capacity){
this.pcapacity = capacity;
this.peopleArray = new String [capacity];
}
public int getCapacity(){
return pcapacity;
}
public int[] getInfo(String person){
int[] getInfo = new int[2];
int found = Arrays.binarySearch(peopleArray,person);
getInfo[0] = ?.getHeight();
getInfo[1] = ?.getWeight();//I dont know the object name yet so I put "?" for I am not sure
System.out.println("Person" + person + "is " + getInfo[0] + "tall and " + getInfo[1] + " pounds.");
}
}
What I need to know is how to allow the user to make multiple people in the list with input that I can then allow them to retrieve later, for example:
String user_input;
People user_input = new People("user_input");
So that if the users input were to be jack, ryan, and nick, I would have three objects placed in the peopleIndexer as such:
People jack = new People(jack);
People ryan = new People(ryan);
People nick = new People(nick);
Your People constructor takes only one argument and creates a People object..You do not have setters for some of your private variables in the peopleIndexer class, so best to have your main method as part of the peopleIndexer class.
Your "length" attribute in the People constructor is not initialized or declared anywhere, so let's assume it's not there. You must change your "private String[] peopleArray;" to be "private People[] peopleArray;" in order to have people in the array.
public static void main(String args[]){
Scanner input = new Scanner(System.in);
int capacity;
int peopleCount = 0; //used to keep track of people we have in our array
String person = "";
// get the capacity from the user
System.out.println("Enter the number of people you want to capture: ");
capacity = Integer.parseInt(input.nextLine());
//create peopleIndexer object using the given capacity
peopleIndexer pIndexer = new peopleIndexer(capacity);
while(peopleCount < capacity){
//prompt the user for the "People" name, this is the only attibute we need according to your constructor.
System.out.println("Enter person "+(peopleCount + 1)+" name: ");
person = input.nextLine();
//add a new person into the array
peopleArray[peopleCount] = new People(person);
//increase the number of people captured
peopleCount += 1;
}
}

reverse a stack and concatenate a popped stack

I'm trying to push any array list to a stack in reverse then concatenate a popped stacked. I getting the information from a file then storing it into an array List. Then i pushed the array List into a stack. now when i print the stack out its just printing the array List how can i pop the stack and concatenate it? here is my code so far
public static LinkedListStack myStack = new LinkedListStack();
public static void main(String[] args)
{
readFileLoadStack();
popStackPrintMsg();
}
public static void readFileLoadStack()
{
File afile; // For file input
Scanner keyboard = new Scanner(System.in); // For file input
String fileName; // To hold a file name
String line;
ArrayList song = new ArrayList<>();
boolean fileNotFound = true;
do
{
// Get a file name from the user.
System.out.println("Enter the name of the file");
fileName = keyboard.nextLine();
// Attempt to open the file.
try
{
afile = new File(fileName);
Scanner inFile = new Scanner(afile);
System.out.println("The file was found");
fileNotFound = false;
while (inFile.hasNextLine())
{
song.add(line = inFile.next());
}
for(int i = 0; i < song.size(); i++)
{
myStack.push1(song);
}
}
catch (FileNotFoundException e)
{
fileNotFound = true;
}
} while (fileNotFound);
}
public static void popStackPrintMsg()
{
if(!myStack.empty())
{
System.out.println(myStack.pop1());
} else
{
System.out.println("Sorry stack is empty");
}
}
output looks like this now :[Mary, had, a, little, lamb, Whose, fleece, was, white, as, snow, Everywhere, that, Mary, went, The, lamb, was, sure, to, go]
I'm trying to get it to look like this:
lamb little a had Mary
snow as white was fleece Whose
went Mary that Everywhere
go to sure was lamb The
i have made a custom class for the push and pop
{
private Node first;
/**
Constructs an empty stack.
*/
public LinkedListStack()
{
first = null;
}
/**
Adds an element to the top of the stack.
#param element the element to add
*/
public void push1(Object element)
{
Node newNode = new Node();
newNode.data = element;
newNode.next = first;
first = newNode;
}
/**
Removes the element from the top of the stack.
#return the removed element
*/
public Object pop1()
{
if (first == null) { throw new NoSuchElementException(); }
Object element = first.data;
first = first.next;
return element;
}
/**
Checks whether this stack is empty.
#return true if the stack is empty
*/
public boolean empty()
{
return first == null;
}
class Node
{
public Object data;
public Node next;
}
}
I fixed the problems in your code. Here is the working version along with some comments. This assumes the sentences in the file are separated by new lines and the words are separated by white spaces.
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class GeneralTest {
//You want the same ordering for sentences. This collection
//therefore should be a list (or a queue)
//I have not changed the name so you can see how it makes a
//difference
public static List<LinkedListStack> myStack = new ArrayList<>();
public static void main(String[] args)
{
readFileLoadStack();
popStackPrintMsg();
}
public static void readFileLoadStack()
{
File afile; // For file input
Scanner keyboard = new Scanner(System.in); // For file input
String fileName; // To hold a file name
String line;
ArrayList song = new ArrayList<>();
boolean fileNotFound = true;
do
{
// Get a file name from the user.
System.out.println("Enter the name of the file");
fileName = keyboard.nextLine();
// Attempt to open the file.
try
{
afile = new File(fileName);
Scanner inFile = new Scanner(afile);
System.out.println("The file was found");
fileNotFound = false;
while (inFile.hasNextLine())
{
//Here you need to use nextLine() instead of next()
song.add(inFile.nextLine());
}
//This loop is the main location your original code goes wrong
//You need to create a stack for each sentence and add it to the
//list. myStack will hold a list of stacks after this loop is done
for(int i = 0; i < song.size(); i++)
{
String songString = (String) song.get(i);
String[] sga = songString.split(" ");
LinkedListStack rowStack = new LinkedListStack();
for(int j=0; j < sga.length; j++) rowStack.push1(sga[j]);
myStack.add(rowStack);
}
}
catch (FileNotFoundException e)
{
fileNotFound = true;
}
} while (fileNotFound);
}
public static void popStackPrintMsg()
{
//To get all values in a collection you need to
//loop over it. A single if will not work
for(LinkedListStack rs : myStack)
{
//Each entry in the list is a LinkedListStack
//So you can pop them and print the results with
//appropriate separators
while(!rs.empty())
System.out.print(rs.pop1() + " ");
System.out.println();
}
}
}
Now, your code has many other problems. For example, you really should use generics when you create a collection class.
The main problem with your code is that to produce the output you have described, you will need a queue of stacks. I have implemented the concept using ArrayList to show the source of the problem. But if you want to learn data structures (or if this is a homework problem), then you should try implementing and using a queue as well.

Android Java Objects

I'm trying to figure out, how to get to my Objects in object list.
I have made "MainHolder.class" where I made my Object list with simple variables(Later I want to add there boolean, real, integer and string values, so simple int array list wont work for me).
My Idea is about simple getting to my object. For example:
Displaying values like: CarMain.PlayerLevel.name();
Adding values like: CarMain.PlayerLevel.count +=1;
But now I got problem trying to Adding values.
Got error : Cannot resolve symbol PlayerLevel
In Line CarMain.PlayerLevel.count +=1;
This is my MainHolder.class
package com.crelix.crelix;
public class MainHolder {
int id;
String name;
int count;
public void id(int id) {
}
public MainHolder(String name) {
}
public void count(int count){
this.count += count;
}
public static void main(String args[]) {
MainHolder Money = new MainHolder("Money: ");
MainHolder MoneyClicks = new MainHolder("Money Clicks: ");
MainHolder Boxes = new MainHolder("Boxes: ");
MainHolder BoxClicks = new MainHolder("Boxes Clicks: ");
MainHolder BoxLevel = new MainHolder("Box Level: ");
MainHolder PlayerLevel = new MainHolder("Player Level: ");
MainHolder GarageLevel = new MainHolder("Garage Level: ");
MainHolder GarageSlots = new MainHolder("Garage Slots: ");
Money.id(1);
Money.count(0);
MoneyClicks.id(2);
MoneyClicks.count(0);
Boxes.id(3);
Boxes.count(0);
BoxClicks.id(4);
BoxClicks.count(0);
BoxLevel.id(5);
BoxLevel.count(1);
PlayerLevel.id(6);
PlayerLevel.count(1);
GarageLevel.id(7);
GarageLevel.count(1);
GarageSlots.id(8);
GarageSlots.count(25);
}
}
And In MainActivity I want to add Player Level Like here:
public void upgradeLevel(View view){
for (int i =9; i >=0; i--){
if (CarMain.PlayerLevel.count() == i){
if (CarMain.Money.count() >= 100*i){
CarMain.Money.count() = CarMain.Money.count() - (100*i);
CarMain.PlayerLevel.count() += 1;
}
else{
//Else
}
}
}
if (CarMain.PlayerLevel.count() == 10){
//Max Level
}
}
Heres My Error in Image : Image
You are defining PlayerLevel inside the main method of MainHolder. So it isn't visible to calling classes (in this case MainActivity). To access them you need to define them as global variables at the top which is a very bad thing to do. Also, you shouldn't declare PlayerLevel inside MainHolder in the first place since all you want that class to do is hold the id and count. Instead declare PlayerLevel inside MainActivity.
If you absolutely want a super class holding all your MainHolders you should use nested classes.

Getting size and comparing attribute value from ArrayList in other class

I am trying to create a method which creates a result for a athlete in a competition. I have an ArrayList with the athletes in another class and now I want this method to be able to find the size of the ArrayList and also compare one int attribute of every Athlete with the input number. This is what I have so far, Im really stuck. So my quetions to you are: How do I get my for loop to see the size of the ArrayList athletes? and what is a proper way to check whether or not the input has a matching athlete in the ArrayList(I want it to print out if there is no match)? Thank you
public class ResultList {
Scanner scanner = new Scanner(System.in);
ArrayList<Result> resultList = new ArrayList<Result>();
public ResultList() {
ArrayList<Athlete> temp = new AthleteList().getArrayList();
}
void addResult() {
int competetionNumber;
System.out.print("What is the athletes competetionnumber?");
competetionNumber = scanner.nextInt();
scanner.nextInt();
for (int i = 0; i < athletes.size(); i++) {
}
}
}
Other class with the Athlete ArrayList:
public class AthleteList {
ArrayList<Athlete> athletes = new ArrayList<Athlete>();
public AthleteList () {
}
public ArrayList<Athlete> getArrayList() {
return athletes;
}
You should create a variable that points to the AthleteList class. Then you can see that in the addResult method you just get the ArrayList from the AthleteList and call size() on it and iterate over the Athletes and check the completionNumber(You didn't post the Athlete class so I'm assuming there is a completionNumber property). I create a matched variable to hold on to the matched Athlete. After the loop I check to see if one matched and print out the result.
Hope this helps.
public class ResultList
{
Scanner scanner = new Scanner(System.in);
ArrayList<Result> resultList = new ArrayList<Result>();
AthleteList athleteList;
public ResultList()
{
athleteList = new AthleteList();
}
void addResult()
{
int competetionNumber;
System.out.print("What is the athletes competetionnumber?");
competetionNumber = scanner.nextInt();
scanner.nextInt();
Athlete matched = null;
List<Athlete> athletes = athleteList.getArrayList();
for(int i = 0; i < athletes.size(); i++)
{
if(athlete.completionNumber == completionNumber)
{
//you found a match!!
matched = athlete;
}
}
if(matched == null)
{
System.out.println("No Match Found for " + completionNumber);
}
else
{
System.out.println("Found match: " + matched.toString());
}
}
}
NOTE:
Not sure you need the AthleteList class. It's just holding an ArrayList. If that's all that class will ever do then I suggest you just using an ArrayList. It will make your code cleaner.

Entering multiple things in to one array in java

I am quite new to java but have a project i need to complete and am stuck on a certain part.
I want to allow the user to enter a route including, start destination, an end destination, and a number of stops. I have been able to do this, but then i want the user to have the ability of being able to add the same things again, to the same array. without deleting the existing route
here is the code i have so far
import java.util.Scanner;
import java.util.Arrays;
public class main {
public static void main(String[] args){
menu();
}
public static void menu(){
Scanner scanner = new Scanner(System.in);
System.out.println("enter 1 to input a new route");
int option = scanner.nextInt();
if(option==1){
inputRoute();
}
}
public static void inputRoute(){
Scanner scanner = new Scanner(System.in);
System.out.println("Please Enter Starting Destination");
String startDest = scanner.next();
System.out.println("Please Enter End Destination");
String endDest = scanner.next();
System.out.println("Please Enter Number of stops");
int numberOfStops = scanner.nextInt();
String[] stops = new String[numberOfStops];
for(int i = 1; i<=numberOfStops; i++){
System.out.println("Enter Stop" + i);
stops[i-1] = scanner.next();
}
System.out.println(Arrays.toString(stops));
menu();
}
}
however when this runs, if i go back and enter in another route, it will just delete the existing route.
Is there any way of appending the next route to the end of that array or any way of doing this?
thank you
Like crush said. Rather than use a normal array of strings, use an ArrayList<String> object. Or even an ArrayList<String[]> and stash each individual route in there.
First of all you will need to declare the stops array as an instance variable, otherwise you will always be creating a new array whenever you call the method inputRoute().
and then to preserve old entries i can think of two ways-->
--> modify the loop as below...
for(int i = 1; i<=numberOfStops; i++){
System.out.println("Enter Stop" + i);
if(stops!=null) //without the if condition it will also append null in the start
stops[i-1]=stops[i-1]+", "+ scanner.next(); // you can you any separator
else
stops[i-1]=scanner.next();
}
--> or you can ArrayList or any other Collection that provides auto increment
Try declaring stops as a global variable. (right below the class line)
Also I would recommend using an ArrayList, List something on those lines
You can't use an array for this (without constantly re-allocating them) as Arrays are fixed in size once created.
Use an ArrayList though and you can add as many items as you like whenever you like.
The easy (and slightly wrong) solution would be to make your array a static array that is defined outside any method. That will get you going (although you will have to make the array big enought.
Other recommendations:
Capatilize your Main class--avoids confusiong (even moreso if you
don't call it main!)
Make your public static void main method do
this: new Main()
Then get rid of all the other statics.
Use a collection instead of an array.
instead of adding each entry into the array separately (which will make EVERYTHING harder for you), create a second class with 3 fields (start, end, stop) and each time you input another record, "new" an instance of the second class, place the three things into the new instance and place that instance on your collection.
It may seem arbitrary and unnecessary right at this minute, but if you have ANY follow-on work to do on this class these things will make your life easier. If any seems confusing or you want to understand why, feel free to ask in the comments.
I think this will help you.
Main file.
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
menu();
}
public static void menu(){
List<Route> routeList = new ArrayList<Route>();
Scanner scanner = new Scanner(System.in);
System.out.println("enter 1 to input a new route");
int option = scanner.nextInt();
if(option==1){
routeList.add(inputRoute());
}
System.out.println("Complete list of routes is "+routeList);
}
public static Route inputRoute(){
Route route = new Route();
Scanner scanner = new Scanner(System.in);
System.out.println("Please enter the name of the route");
String name = scanner.next();
route.setName(name);
System.out.println("Please Enter Starting Destination");
String startDest = scanner.next();
route.setStartLocation(startDest);
System.out.println("Please Enter End Destination");
String endDest = scanner.next();
route.setEndLocation(endDest);
System.out.println("Please Enter Number of stops");
int numberOfStops = scanner.nextInt();
if(numberOfStops > 0){
route.setStopList(new ArrayList<String>());
for(int i = 1; i<=numberOfStops; i++){
System.out.println("Enter Stop" + i);
route.getStopList().add(scanner.next());
}
System.out.println("current entered route is "+route);
menu();
}
return route;
}
}
Route file:
import java.util.List;
public class Route {
String name ;
String startLocation;
String endLocation;
List<String> stopList;
public Route() {
}
public Route(String name, String startLocation, String endLocation, List<String> stopList) {
this.name = name;
this.startLocation = startLocation;
this.endLocation = endLocation;
this.stopList = stopList;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStartLocation() {
return startLocation;
}
public void setStartLocation(String startLocation) {
this.startLocation = startLocation;
}
public String getEndLocation() {
return endLocation;
}
public void setEndLocation(String endLocation) {
this.endLocation = endLocation;
}
public List<String> getStopList() {
return stopList;
}
public void setStopList(List<String> stopList) {
this.stopList = stopList;
}
#Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Route route = (Route) o;
if (endLocation != null ? !endLocation.equals(route.endLocation) : route.endLocation != null) return false;
if (name != null ? !name.equals(route.name) : route.name != null) return false;
if (startLocation != null ? !startLocation.equals(route.startLocation) : route.startLocation != null)
return false;
if (stopList != null ? !stopList.equals(route.stopList) : route.stopList != null) return false;
return true;
}
#Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (startLocation != null ? startLocation.hashCode() : 0);
result = 31 * result + (endLocation != null ? endLocation.hashCode() : 0);
result = 31 * result + (stopList != null ? stopList.hashCode() : 0);
return result;
}
#Override
public String toString() {
return "Route{" +
"name='" + name + '\'' +
", startLocation='" + startLocation + '\'' +
", endLocation='" + endLocation + '\'' +
", stopList=" + stopList +
'}';
}
}

Categories