Project cleanup pre merge.

This commit is contained in:
2023-07-15 09:23:48 -04:00
parent 134b651df8
commit 9bbdef224d
747 changed files with 99704 additions and 101200 deletions
+59 -59
View File
@@ -12,73 +12,73 @@ package engine.job;
public class JobContainer implements Comparable<JobContainer> {
final AbstractJob job;
final long timeOfExecution;
final boolean noTimer;
final AbstractJob job;
final long timeOfExecution;
final boolean noTimer;
JobContainer(AbstractJob job, long timeOfExecution) {
if (job == null) {
throw new IllegalArgumentException("No 'null' jobs allowed.");
}
this.job = job;
this.timeOfExecution = timeOfExecution;
this.noTimer = false;
}
JobContainer(AbstractJob job, long timeOfExecution) {
if (job == null) {
throw new IllegalArgumentException("No 'null' jobs allowed.");
}
this.job = job;
this.timeOfExecution = timeOfExecution;
this.noTimer = false;
}
public JobContainer(AbstractJob job) {
if (job == null) {
throw new IllegalArgumentException("No 'null' jobs allowed.");
}
this.job = job;
this.timeOfExecution = Long.MAX_VALUE;
this.noTimer = true;
}
public JobContainer(AbstractJob job) {
if (job == null) {
throw new IllegalArgumentException("No 'null' jobs allowed.");
}
this.job = job;
this.timeOfExecution = Long.MAX_VALUE;
this.noTimer = true;
}
public AbstractJob getJob() {
return job;
}
public AbstractJob getJob() {
return job;
}
public boolean noTimer() {
return noTimer;
}
public boolean noTimer() {
return noTimer;
}
public long timeOfExection() {
return this.timeOfExecution;
}
public long timeOfExection() {
return this.timeOfExecution;
}
public int timeToExecutionLeft() {
if (JobScheduler.getInstance().isAlive()) {
int timeLeft = (int) (timeOfExecution - System.currentTimeMillis());
if (timeLeft < 0)
timeLeft = 0;
return timeLeft;
} else
return (int) (timeOfExecution - JobScheduler.getInstance().getTimeOfKill());
}
public int timeToExecutionLeft() {
if (JobScheduler.getInstance().isAlive()) {
int timeLeft = (int) (timeOfExecution - System.currentTimeMillis());
if (timeLeft < 0)
timeLeft = 0;
return timeLeft;
} else
return (int) (timeOfExecution - JobScheduler.getInstance().getTimeOfKill());
}
@Override
public int compareTo(JobContainer compared) {
if (timeOfExecution < compared.timeOfExecution) {
return -1;
}
if (timeOfExecution > compared.timeOfExecution) {
return 1;
}
return 0;
}
@Override
public int compareTo(JobContainer compared) {
if (timeOfExecution < compared.timeOfExecution) {
return -1;
}
if (timeOfExecution > compared.timeOfExecution) {
return 1;
}
return 0;
}
@Override
public boolean equals(Object obj) {
return job.equals(((JobContainer) obj).job);
}
@Override
public boolean equals(Object obj) {
return job.equals(((JobContainer) obj).job);
}
@Override
public int hashCode() {
return job.hashCode();
}
@Override
public int hashCode() {
return job.hashCode();
}
public void cancelJob() {
if (job != null && job instanceof AbstractScheduleJob)
((AbstractScheduleJob)job).cancelJob();
}
public void cancelJob() {
if (job != null && job instanceof AbstractScheduleJob)
((AbstractScheduleJob) job).cancelJob();
}
}