diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-10-06 13:13:10 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-10-06 14:46:56 +0200 |
| commit | 47357afd16f928260db34d4dd3e686fb9ee7c5ff (patch) | |
| tree | 950ba678869ec868c26ab3b95b57e4cabadb23c7 /opendc-simulator/opendc-simulator-core/src/main/java | |
| parent | 402a8f55342c4565431c2a2e7287a70592f3fe33 (diff) | |
build: Switch to Spotless for formatting
This change updates the build configuration to use Spotless for code
formating of both Kotlin and Java.
Diffstat (limited to 'opendc-simulator/opendc-simulator-core/src/main/java')
2 files changed, 9 insertions, 6 deletions
diff --git a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java index a70c1cda..305bdf5e 100644 --- a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java +++ b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java @@ -67,7 +67,7 @@ public final class SimulationScheduler implements Executor { * @param initialTimeMs The initial virtual time of the scheduler in milliseconds since epoch. */ public SimulationScheduler(long initialTimeMs) { - this.currentTime = initialTimeMs; + this.currentTime = initialTimeMs; } /** @@ -104,7 +104,8 @@ public final class SimulationScheduler implements Executor { */ public int schedule(long delayMs, Runnable task) { if (delayMs < 0) { - throw new IllegalArgumentException("Attempted scheduling an event earlier in time (delay " + delayMs + " ms)"); + throw new IllegalArgumentException( + "Attempted scheduling an event earlier in time (delay " + delayMs + " ms)"); } long target = currentTime + delayMs; diff --git a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java index 7d867b5d..f677e74e 100644 --- a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java +++ b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java @@ -193,7 +193,8 @@ final class TaskQueue { /** * Sift up an entry in the heap. */ - private static void siftUp(long[] deadlines, int[] ids, Runnable[] tasks, int k, long deadline, int id, Runnable task) { + private static void siftUp( + long[] deadlines, int[] ids, Runnable[] tasks, int k, long deadline, int id, Runnable task) { while (k > 0) { int parent = (k - 1) >>> 1; long parentDeadline = deadlines[parent]; @@ -218,11 +219,12 @@ final class TaskQueue { /** * Sift down an entry in the heap. */ - private static void siftDown(long[] deadlines, int[] ids, Runnable[] tasks, int k, int n, long deadline, int id, Runnable task) { - int half = n >>> 1; // loop while a non-leaf + private static void siftDown( + long[] deadlines, int[] ids, Runnable[] tasks, int k, int n, long deadline, int id, Runnable task) { + int half = n >>> 1; // loop while a non-leaf while (k < half) { - int child = (k << 1) + 1; // assume left child is least + int child = (k << 1) + 1; // assume left child is least long childDeadline = deadlines[child]; int childId = ids[child]; |
