reformated everything.

it is not my fav formater, but at least its uniform, and its getting
late.
Good night!
This commit is contained in:
violette 2024-03-26 22:20:11 -04:00
parent 14c72c3f7a
commit abe0c16aa3
6 changed files with 52 additions and 49 deletions

View file

@ -8,7 +8,7 @@ public class App {
static private int numStops = numBusses * numStopPerBus;
static private int numPassengersPerBus = 5;
static private int numPassengersPerStop = 5;
//static private int numPassengers = numPassengersPerStop * numStops;
// static private int numPassengers = numPassengersPerStop * numStops;
static private int numThreadsBus = 5;
static private int numThreadsStop = 2;
static private int timeBetweenStops = 5;

View file

@ -219,7 +219,8 @@ public class Bus extends Thread {
return name;
}
// still there since i first didnt understand what a trip should have been. See git logs.
// still there since i first didnt understand what a trip should have been. See
// git logs.
public List<Stop> getStops() {
return line.getStops();
}

View file

@ -1,7 +1,8 @@
package usherbrooke.ift630;
public class ExitException extends Exception {
ExitException() {}
ExitException() {
}
public ExitException(String message) {
super(message);

View file

@ -9,7 +9,7 @@ public class Logger {
private static final String BLUE = "\u001B[34m";
private static final String PURPLE = "\u001B[35m";
private static final String CYAN = "\u001B[36m";
private static final String RESET = "\u001B[0m" ;
private static final String RESET = "\u001B[0m";
private static final String WHITE = "\u001B[0m";
private String[] cols = {
@ -22,7 +22,8 @@ public class Logger {
CYAN,
};
private Logger() {}
private Logger() {
}
public void printTime() {
System.out.println(System.currentTimeMillis());
@ -33,16 +34,15 @@ public class Logger {
}
public void printTime(int c, String s) {
System.out.println(cols[c % cols.length] +System.currentTimeMillis() + s + RESET);
System.out.println(cols[c % cols.length] + System.currentTimeMillis() + s + RESET);
}
public void print(int c, String s) {
System.out.println(cols[c % cols.length] + s + RESET);
}
public static Logger getInstance() {
if(logger == null) {
if (logger == null) {
logger = new Logger();
}

View file

@ -20,7 +20,6 @@ public class Stop extends Thread {
private Socket socket;
private PrintWriter socketTx;
private void connectSocket() throws IOException {
socket = new Socket("localhost", socketPort);
socketTx = new PrintWriter(socket.getOutputStream(), true);
@ -51,7 +50,8 @@ public class Stop extends Thread {
Logger.getInstance().print(id,
"\t".repeat(indent) + "[STOP] " + info.getBus(this).getNameBus() + " arrives in " + time + "s");
// else, catch
} catch (NullPointerException e) {}
} catch (NullPointerException e) {
}
} catch (UnauthorizedException e) {
// if unauth, requeue message.
@ -147,7 +147,7 @@ public class Stop extends Thread {
}
public void removePassenger(Passenger p) throws IOException {
if(passengers.remove(p)) {
if (passengers.remove(p)) {
synchronized (p) {
p.notify();
}

View file

@ -1,7 +1,8 @@
package usherbrooke.ift630;
public class UnauthorizedException extends Exception {
public UnauthorizedException() {}
public UnauthorizedException() {
}
public UnauthorizedException(String message) {
super(message);