Commit 4160ff26 authored by Christopher Reis's avatar Christopher Reis

Changed SatelliteDB to static

parent 2d236a4c
...@@ -35,10 +35,10 @@ import predict4java.*; ...@@ -35,10 +35,10 @@ import predict4java.*;
public class SatelliteDB { public class SatelliteDB {
ArrayList<SatelliteTrack> database = new ArrayList<SatelliteTrack>(); static ArrayList<SatelliteTrack> database = new ArrayList<SatelliteTrack>();
boolean databaseSet = false; static boolean databaseSet = false;
String name = "SatelliteDB"; static String name = "SatelliteDB";
GroundStationPosition groundstation; static GroundStationPosition groundstation;
final static GroundStationPosition ALBUQUERQUE = new GroundStationPosition(35.0873191, -106.6376107, 5500, "Albuquerque"); final static GroundStationPosition ALBUQUERQUE = new GroundStationPosition(35.0873191, -106.6376107, 5500, "Albuquerque");
final static GroundStationPosition STORMLAKE = new GroundStationPosition(42.6436, 95.2019, 1440,"Storm Lake"); final static GroundStationPosition STORMLAKE = new GroundStationPosition(42.6436, 95.2019, 1440,"Storm Lake");
...@@ -46,7 +46,7 @@ public class SatelliteDB { ...@@ -46,7 +46,7 @@ public class SatelliteDB {
this.name = name; this.name = name;
} }
public boolean downloadTLE(String in_url, String file){ public static boolean downloadTLE(String in_url, String file){
URL url; URL url;
...@@ -98,7 +98,7 @@ public class SatelliteDB { ...@@ -98,7 +98,7 @@ public class SatelliteDB {
} }
} }
public void TLEReader(String file){ public static void TLEReader(String file){
//TODO //TODO
FileReader in = null; FileReader in = null;
...@@ -133,41 +133,41 @@ public class SatelliteDB { ...@@ -133,41 +133,41 @@ public class SatelliteDB {
} }
public void setGroundstation(GroundStationPosition gPos){ public static void setGroundstation(GroundStationPosition gPos){
groundstation = gPos; groundstation = gPos;
} }
public void getSatellites_GPS(){ public static void getSatellites_GPS(){
downloadTLE("https://celestrak.com/NORAD/elements/gps-ops.txt","gps"); downloadTLE("https://celestrak.com/NORAD/elements/gps-ops.txt","GPS");
//TLEReader("gps.txt"); //TLEReader("gps.txt");
databaseSet = true; databaseSet = true;
} }
public void getSatellites_Stations(){ public static void getSatellites_Stations(){
downloadTLE("https://celestrak.com/NORAD/elements/stations.txt","stations"); downloadTLE("https://celestrak.com/NORAD/elements/stations.txt","Stations");
//TLEReader("stations.txt"); //TLEReader("stations.txt");
databaseSet = true; databaseSet = true;
} }
public void getSatellites_NOAA(){ public static void getSatellites_NOAA(){
downloadTLE("https://celestrak.com/NORAD/elements/noaa.txt","noaa"); downloadTLE("https://celestrak.com/NORAD/elements/noaa.txt","NOAA");
//TLEReader("noaa.txt"); //TLEReader("noaa.txt");
databaseSet = true; databaseSet = true;
} }
public void getSatellites_Iridium(){ public static void getSatellites_Iridium(){
downloadTLE("https://celestrak.com/NORAD/elements/iridium.txt","Iridium"); downloadTLE("https://celestrak.com/NORAD/elements/iridium.txt","Iridium");
//TLEReader("noaa.txt"); //TLEReader("noaa.txt");
databaseSet = true; databaseSet = true;
} }
public void getSatellites_GEO(){ public static void getSatellites_GEO(){
downloadTLE("https://celestrak.com/NORAD/elements/geo.txt","Geostationary"); downloadTLE("https://celestrak.com/NORAD/elements/geo.txt","Geostationary");
//TLEReader("noaa.txt"); //TLEReader("noaa.txt");
databaseSet = true; databaseSet = true;
} }
public int getSatIndex(String sat){ public static int getSatIndex(String sat){
for(int i=0;i<database.size();i++){ for(int i=0;i<database.size();i++){
sat = sat.trim(); sat = sat.trim();
...@@ -180,16 +180,16 @@ public class SatelliteDB { ...@@ -180,16 +180,16 @@ public class SatelliteDB {
} }
public int getSize(){ public static int getSize(){
return database.size(); return database.size();
} }
public SatelliteTrack sat(int i){ public static SatelliteTrack sat(int i){
SatelliteTrack satTrack = database.get(i); SatelliteTrack satTrack = database.get(i);
return satTrack; return satTrack;
} }
public boolean satExist(String string){ public static boolean satExist(String string){
int selectedSatellite = getSatIndex(string); int selectedSatellite = getSatIndex(string);
if(selectedSatellite>=0){ if(selectedSatellite>=0){
//System.out.println(this.getSat(selectedSatellite).getTLE().getName() + " Exists!"); //System.out.println(this.getSat(selectedSatellite).getTLE().getName() + " Exists!");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment