package com.ontariotechu.sofe3980U.core;
import com.ontariotechu.sofe3980U.booking.Booking;
import com.ontariotechu.sofe3980U.core.restmodels.FlightSearchDTO;
import java.util.List;
public class PathFinder {
// Private constructor to prevent instantiation
private PathFinder() {}
public static List<Booking> buildBookings(FlightSearchDTO searchDTO) {
// Implementation goes here
System.out.println("PathFinder.buildBookings() called.");
throw new UnsupportedOperationException("Path finding not implemented yet.");
}
// Placeholder for the pathFind function
public static List<Flight> pathFind(MemoryStore store, Airport airA, Airport airB, DowDate departAfter, DowDate arriveBy) {
// Implementation goes here
throw new UnsupportedOperationException("Path finding not implemented yet.");
}
}
Please make sure to not edit the functions as they are kind of a known interface to the API controller, that it can send a search Request payload, and get back a list of Bookings to show the user!
The frontend will effectively display the List of Bookings, where the user can pick from one!
buildBookings needs to be set in stone like so, however pathFind is flexible to change as you'll be calling pathFind within the buildBookings method, or figure out a way to build 1 or more bookings per request (if exists any for that given path)
Just a reminder:
Booking.java in booking module, includes Flight Lists, and a null outBound list indicaitng 1 way trips
package com.ontariotechu.sofe3980U.booking;
import java.util.ArrayList;
import com.ontariotechu.sofe3980U.core.Flight;
public class Booking {
ArrayList<Flight> inBound = new ArrayList<Flight>();
ArrayList<Flight> outBound = new ArrayList<Flight>();
String NameOfPassenger;
String UUID;
// Constructor
public Booking(ArrayList<Flight> outBound, ArrayList<Flight> inBound, String UUID) {
this.outBound = outBound;
this.inBound = inBound;
this.UUID = UUID;
}
public String getUUID() {
return this.UUID;
}
}
Testing:
package com.ontariotechu.sofe3980U.core;
import java.time.LocalDateTime;
import java.util.List;
import java.util.ArrayList;
// JUnit Imports
import static org.junit.Assert.*;
import org.junit.Test;
public class PathFinderTest {
@Test
public void testBuildBookings() {
// Test the buildBookings function
// This function is a placeholder and should throw an UnsupportedOperationException
try {
PathFinder.buildBookings(null);
} catch (UnsupportedOperationException e) {
assertNotNull(e);
}
}
//.... more below
Right now it's just some tests making sure it's unimplemented, you'll be removing these
This file is in SOFE3980U_Final_Project/src/test/java/com/ontariotechu/sofe3980U/core
The idea is , we have multiple possible Trips to select from In the UI, after searching for a specific set of options
Examples:
Implementation Guidelines
Please implement this algorithm in the file:
SOFE3980U_Final_Project/src/main/java/com/ontariotechu/sofe3980U/core/PathFinder.java
Please make sure to not edit the functions as they are kind of a known interface to the API controller, that it can send a search Request payload, and get back a list of Bookings to show the user!
The frontend will effectively display the List of Bookings, where the user can pick from one!
buildBookings needs to be set in stone like so, however pathFind is flexible to change as you'll be calling pathFind within the buildBookings method, or figure out a way to build 1 or more bookings per request (if exists any for that given path)
Just a reminder:
Booking.java in booking module, includes Flight Lists, and a null outBound list indicaitng 1 way trips
Testing:
Right now it's just some tests making sure it's unimplemented, you'll be removing these
This file is in SOFE3980U_Final_Project/src/test/java/com/ontariotechu/sofe3980U/core