// Path: src/main/java/com/github/mob41/kmbeta/exception/DatabaseNotLoadedException.java
// public class DatabaseNotLoadedException extends RuntimeException {
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 1L;
// 
// 	public DatabaseNotLoadedException(){
// 		super("The static database wasn't loaded at the moment.");
// 	}
// 	
// 	public DatabaseNotLoadedException(String message){
// 		super(message);
// 	}
// 	
// 	public DatabaseNotLoadedException(String message, Throwable cause){
// 		super(message, cause);
// 	}
// 	
// 	public DatabaseNotLoadedException(Throwable cause){
// 		super(cause);
// 	}
// }
// 
// Path: src/main/java/com/github/mob41/kmbeta/exception/NoSuchRouteException.java
// public class NoSuchRouteException extends RuntimeException {
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 1L;
// 
// 	public NoSuchRouteException(){
// 		super();
// 	}
// 	
// 	public NoSuchRouteException(String message){
// 		super(message);
// 	}
// 	
// 	public NoSuchRouteException(String message, Throwable cause){
// 		super(message, cause);
// 	}
// 	
// 	public NoSuchRouteException(Throwable cause){
// 		super(cause);
// 	}
// }


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import com.github.mob41.kmbeta.exception.DatabaseNotLoadedException;
import com.github.mob41.kmbeta.exception.NoSuchRouteException;

		if (!staticDatabase || routes == null){
			throw new DatabaseNotLoadedException();
		}
		
		Route route = routes.get(routeindex);
		
		for (RouteBound bound : route.getList()){
			for (BusStop stop : bound.getList()){
				if (stop.getStopCode().equals(stopcode)){
					return stop.getStopNameInEnglish();
				}
			}
		}
		
		return null;
	}
	
	/**
	 * Gets the stop name in Chinese from a stop code<br>
	 * <br>
	 * Returns <code>null</code> if the specified stop code wasn't found.<br>
	 * <br>
	 * Warning: This function requires a static database (Web DB/Offline DB)<br>
	 * otherwise, a <code>DatabaseNotLoadedException</code> will be thrown.<br>
	 * @param routeName The route name
	 * @param stopcode The stop code of the bus stop
	 * @return a stop name in Chinese according to the stop code specified
	 * @throws NoSuchRouteException It is thrown when the specified route can not be found.
	 * @throws DatabaseNotLoadedException will only be thrown if a static database isn't loaded.
	 */

// Path: src/main/java/com/github/mob41/kmbeta/exception/DatabaseNotLoadedException.java
// public class DatabaseNotLoadedException extends RuntimeException {
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 1L;
// 
// 	public DatabaseNotLoadedException(){
// 		super("The static database wasn't loaded at the moment.");
// 	}
// 	
// 	public DatabaseNotLoadedException(String message){
// 		super(message);
// 	}
// 	
// 	public DatabaseNotLoadedException(String message, Throwable cause){
// 		super(message, cause);
// 	}
// 	
// 	public DatabaseNotLoadedException(Throwable cause){
// 		super(cause);
// 	}
// }
// 
// Path: src/main/java/com/github/mob41/kmbeta/exception/NoSuchRouteException.java
// public class NoSuchRouteException extends RuntimeException {
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 1L;
// 
// 	public NoSuchRouteException(){
// 		super();
// 	}
// 	
// 	public NoSuchRouteException(String message){
// 		super(message);
// 	}
// 	
// 	public NoSuchRouteException(String message, Throwable cause){
// 		super(message, cause);
// 	}
// 	
// 	public NoSuchRouteException(Throwable cause){
// 		super(cause);
// 	}
// }


// Path: src/main/java/com/github/mob41/kmbeta/api/BusDatabase.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import com.github.mob41.kmbeta.exception.DatabaseNotLoadedException;
import com.github.mob41.kmbeta.exception.NoSuchRouteException;

		if (!staticDatabase || routes == null){
			throw new DatabaseNotLoadedException();
		}
		
		Route route = routes.get(routeindex);
		
		for (RouteBound bound : route.getList()){
			for (BusStop stop : bound.getList()){
				if (stop.getStopCode().equals(stopcode)){
					return stop.getStopNameInEnglish();
				}
			}
		}
		
		return null;
	}
	
	/**
	 * Gets the stop name in Chinese from a stop code<br>
	 * <br>
	 * Returns <code>null</code> if the specified stop code wasn't found.<br>
	 * <br>
	 * Warning: This function requires a static database (Web DB/Offline DB)<br>
	 * otherwise, a <code>DatabaseNotLoadedException</code> will be thrown.<br>
	 * @param routeName The route name
	 * @param stopcode The stop code of the bus stop
	 * @return a stop name in Chinese according to the stop code specified
	 * @throws NoSuchRouteException It is thrown when the specified route can not be found.
	 * @throws DatabaseNotLoadedException will only be thrown if a static database isn't loaded.
	 */

	public String getStopNameInChineseFromStopCode(String routeName, String stopcode) throws NoSuchRouteException{
