Instructions
Requirements and Specifications
Source Code
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
public class AirportData {
private ListwedgePolygons;
private static class Wedge {
}
private static void overWriteAirportDataStruct(String airportName, String svnPortal, int day_start, AirportData airportDataStruct) {
String name = airportName;
if (Arrays.asList("JKG").contains(name)) {
name = "JFK";
}
try {
SimpleDateFormat format = new SimpleDateFormat("MMddyy");
Listlist = Files.list(Paths.get(svnPortal, "Data", "Maps", name)).collect(Collectors.toList());
Listresults = new ArrayList<>();
for (Path path : list) {
if (path.toFile().isDirectory()) {
try {
String filename = path.getFileName().toString();
Date date = format.parse(filename);
LocalDate localDate = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()).toLocalDate();
long dateNum = localDate.toEpochDay();
if (dateNum <= day_start) {
results.add(dateNum);
}
} catch (ParseException ignored) {
}
}
}
Collections.sort(results);
if (!results.isEmpty()) {
save(Paths.get(svnPortal, "Data", "Maps", name,
format.format(LocalDate.ofEpochDay(results.get(results.size() - 1))), name, "_AirportData"), airportDataStruct);
} else {
save(Paths.get(svnPortal, "Data", "Maps", name, name, "_AirportData"), airportDataStruct);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private static void computeWedgesAndWriteAirportData(String airportCode, int startDate, int numdays, String drive, String pathSuffix) {
AirportData airportData = loadAirportDataStruct(airportCode, System.getenv("AirportalPath"), startDate);
Listwedges = computeWedges(airportCode, startDate, airportData, numdays, drive, pathSuffix);
boolean zoomable = true;
drawAirport(airportData, zoomable);
drawPolygon(wedges);
airportData.wedgePolygons = wedges;
String result = "";
try (Scanner scanner = new Scanner(System.in)) {
while (!result.equals("Y") && !result.equals("N")) {
System.out.println("Do you want to save the airportData with wedges over the current airportData? Y/N");
result = scanner.nextLine();
}
}
if (result.equals("Y")) {
overWriteAirportDataStruct(airportCode, System.getenv("AiportalPath"), startDate, airportData);
}
}
private static ListcomputeWedges(String airportName, int dayStart, AirportData airportData, Integer numdays,
String drive, String pathSuffix) {
if (numdays == null) {
numdays = 14;
}
if (drive == null) {
drive = "M:\\";
}
if (pathSuffix == null || pathSuffix.isEmpty()) {
pathSuffix = "";
}
ListaltOpsPath = Arrays.asList(drive, airportName, pathSuffix, "\\");
int dayStop = dayStart + numdays - 1;
ListallArrivals = new ArrayList<>();
return null;
}
private static AirportData loadAirportDataStruct(String airportName, String svnPortal, int date_start) {
String name = airportName;
if (Arrays.asList("JKG").contains(name)) {
name = "JFK";
}
try {
SimpleDateFormat format = new SimpleDateFormat("MMddyy");
Listlist = Files.list(Paths.get(svnPortal, "Data", "Maps", name)).collect(Collectors.toList());
Listresults = new ArrayList<>();
for (Path path : list) {
if (path.toFile().isDirectory()) {
try {
String filename = path.getFileName().toString();
Date date = format.parse(filename);
LocalDate localDate = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()).toLocalDate();
long dateNum = localDate.toEpochDay();
if (dateNum <= date_start) {
results.add(dateNum);
}
} catch (ParseException ignored) {
}
}
}
Collections.sort(results);
if (!results.isEmpty()) {
return load(Paths.get(svnPortal, "Data", "Maps", name,
format.format(LocalDate.ofEpochDay(results.get(results.size() - 1))),
name,
"_AirportData"));
} else {
return load(Paths.get(svnPortal, "Data", "Maps", name, name, "_AirportData"));
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private static AirportData load(Path path) {
return null;
}
private static void save(Path path, AirportData airportData) {}
private static void drawAirport(AirportData airportData, boolean zoomable) {}
private static void drawPolygon(Listwedges) {}
public static void main(String[] args) {
}
}
Related Samples
Discover our Java Assignments sample section, featuring expertly crafted solutions designed to support students. From fundamental concepts to advanced algorithms, each example offers clear, annotated code for enhanced learning. Explore practical Java programs that deepen understanding and proficiency, empowering students to excel in their programming endeavors.
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java