From c7a1c30bd1d66241c1a3cdee24c40a948dcb8620 Mon Sep 17 00:00:00 2001 From: Shaokai Lin Date: Wed, 12 Feb 2025 22:06:28 -0800 Subject: [PATCH] Apply spotless --- .../main/java/org/lflang/AttributeUtils.java | 1 - core/src/main/java/org/lflang/TimeTag.java | 5 +- .../analyses/statespace/EventQueue.java | 4 +- .../statespace/StateSpaceDiagram.java | 2 +- .../statespace/StateSpaceExplorer.java | 53 ++++++++++------ .../lflang/analyses/uclid/UclidGenerator.java | 12 ++-- .../generator/c/CScheduleGenerator.java | 12 ++-- .../main/java/org/lflang/pretvm/Label.java | 12 ++-- .../org/lflang/pretvm/PartialSchedule.java | 62 ++++++++++--------- .../java/org/lflang/pretvm/Registers.java | 25 ++++---- .../main/java/org/lflang/pretvm/dag/Dag.java | 31 ++++------ .../java/org/lflang/pretvm/dag/DagEdge.java | 2 +- .../org/lflang/pretvm/dag/IntervalNode.java | 7 ++- .../pretvm/instruction/Instruction.java | 2 +- .../lflang/pretvm/register/ReturnAddr.java | 2 + .../pretvm/register/WorkerRegister.java | 4 +- 16 files changed, 119 insertions(+), 117 deletions(-) diff --git a/core/src/main/java/org/lflang/AttributeUtils.java b/core/src/main/java/org/lflang/AttributeUtils.java index 6a6e610751..db34d452d0 100644 --- a/core/src/main/java/org/lflang/AttributeUtils.java +++ b/core/src/main/java/org/lflang/AttributeUtils.java @@ -27,7 +27,6 @@ import static org.lflang.ast.ASTUtils.factory; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/core/src/main/java/org/lflang/TimeTag.java b/core/src/main/java/org/lflang/TimeTag.java index 426e22a714..086adf7905 100644 --- a/core/src/main/java/org/lflang/TimeTag.java +++ b/core/src/main/java/org/lflang/TimeTag.java @@ -25,9 +25,8 @@ public TimeTag(TimeTag that) { } /** - * Whether this time tag represents FOREVER, which is interpreted as the - * maximum TimeValue. - * + * Whether this time tag represents FOREVER, which is interpreted as the maximum TimeValue. + * * @return True if the tag is FOREVER, false otherwise. */ public boolean isForever() { diff --git a/core/src/main/java/org/lflang/analyses/statespace/EventQueue.java b/core/src/main/java/org/lflang/analyses/statespace/EventQueue.java index 1230be14f8..f4530e6134 100644 --- a/core/src/main/java/org/lflang/analyses/statespace/EventQueue.java +++ b/core/src/main/java/org/lflang/analyses/statespace/EventQueue.java @@ -2,9 +2,7 @@ import java.util.PriorityQueue; -/** - * An event queue for analyzing the logical behavior of an LF program - */ +/** An event queue for analyzing the logical behavior of an LF program */ public class EventQueue extends PriorityQueue { /** diff --git a/core/src/main/java/org/lflang/analyses/statespace/StateSpaceDiagram.java b/core/src/main/java/org/lflang/analyses/statespace/StateSpaceDiagram.java index ebfead535d..398bd1ed5c 100644 --- a/core/src/main/java/org/lflang/analyses/statespace/StateSpaceDiagram.java +++ b/core/src/main/java/org/lflang/analyses/statespace/StateSpaceDiagram.java @@ -253,4 +253,4 @@ public boolean isCyclic() { public boolean isEmpty() { return (head == null); } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/lflang/analyses/statespace/StateSpaceExplorer.java b/core/src/main/java/org/lflang/analyses/statespace/StateSpaceExplorer.java index c2e4b8b4ee..94a6171029 100644 --- a/core/src/main/java/org/lflang/analyses/statespace/StateSpaceExplorer.java +++ b/core/src/main/java/org/lflang/analyses/statespace/StateSpaceExplorer.java @@ -1,13 +1,11 @@ package org.lflang.analyses.statespace; -import java.lang.annotation.Target; import java.nio.file.Path; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; - import org.lflang.TimeTag; import org.lflang.TimeValue; import org.lflang.ast.ASTUtils; @@ -150,7 +148,8 @@ else if (previousTag != null && currentTag.compareTo(previousTag) > 0) { // Loop period is the time difference between the 1st time // the node is reached and the 2nd time the node is reached. diagram.hyperperiod = - diagram.loopNodeNext.getTag().time.toNanoSeconds() - diagram.loopNode.getTag().time.toNanoSeconds(); + diagram.loopNodeNext.getTag().time.toNanoSeconds() + - diagram.loopNode.getTag().time.toNanoSeconds(); diagram.addEdge(diagram.loopNode, diagram.tail); return diagram; // Exit the while loop early. } @@ -229,8 +228,7 @@ else if (!horizon.isForever() && currentTag.compareTo(horizon) > 0) { // && currentTag.compareTo(previousTag) > 0) is true and then // the simulation ends, leaving a new node dangling. if (currentNode != null - && (previousNode == null - || previousNode.getTag().compareTo(currentNode.getTag()) < 0)) { + && (previousNode == null || previousNode.getTag().compareTo(currentNode.getTag()) < 0)) { diagram.addNode(currentNode); diagram.tail = currentNode; // Update the current tail. if (previousNode != null) { @@ -270,7 +268,10 @@ public static List addInitialEvents( * offset wrt to a phase (e.g., the shutdown phase), not the absolute tag at runtime. */ public static void addInitialEventsRecursive( - ReactorInstance reactor, List events, ExecutionPhase phase, TargetConfig targetConfig) { + ReactorInstance reactor, + List events, + ExecutionPhase phase, + TargetConfig targetConfig) { switch (phase) { case INIT_AND_PERIODIC: { @@ -280,7 +281,10 @@ public static void addInitialEventsRecursive( // Add the initial timer firings, if exist. for (TimerInstance timer : reactor.timers) { - events.add(new Event(timer, new TimeTag(TimeValue.fromNanoSeconds(timer.getOffset().toNanoSeconds()), 0L))); + events.add( + new Event( + timer, + new TimeTag(TimeValue.fromNanoSeconds(timer.getOffset().toNanoSeconds()), 0L))); } break; } @@ -355,7 +359,8 @@ private static List popCurrentEvents(EventQueue eventQ, TimeTag currentTa * Sometimes multiple events can trigger the same reaction, and we do not want to record duplicate * reaction invocations. */ - private static Set getReactionsTriggeredByCurrentEvents(List currentEvents) { + private static Set getReactionsTriggeredByCurrentEvents( + List currentEvents) { Set reactions = new HashSet<>(); for (Event e : currentEvents) { Set dependentReactions = e.getTrigger().getDependentReactions(); @@ -387,7 +392,8 @@ private static List createNewEvents( new Event( timer, new TimeTag( - TimeValue.fromNanoSeconds(e.getTag().time.toNanoSeconds() + timer.getPeriod().toNanoSeconds()), + TimeValue.fromNanoSeconds( + e.getTag().time.toNanoSeconds() + timer.getPeriod().toNanoSeconds()), 0L // A time advancement resets microstep to 0. ))); } @@ -416,7 +422,11 @@ private static List createNewEvents( if (delay == null) delay = 0L; // Create and enqueue a new event. - Event e = new Event(downstreamPort, new TimeTag(TimeValue.fromNanoSeconds(currentTag.time.toNanoSeconds() + delay), 0L)); + Event e = + new Event( + downstreamPort, + new TimeTag( + TimeValue.fromNanoSeconds(currentTag.time.toNanoSeconds() + delay), 0L)); newEvents.add(e); } } @@ -430,7 +440,12 @@ else if (effect instanceof ActionInstance && !((ActionInstance) effect).isPhysic microstep = currentTag.microstep + 1; } // Create and enqueue a new event. - Event e = new Event(effect, new TimeTag(TimeValue.fromNanoSeconds(currentTag.time.toNanoSeconds() + min_delay), microstep)); + Event e = + new Event( + effect, + new TimeTag( + TimeValue.fromNanoSeconds(currentTag.time.toNanoSeconds() + min_delay), + microstep)); newEvents.add(e); } } @@ -445,7 +460,7 @@ else if (effect instanceof ActionInstance && !((ActionInstance) effect).isPhysic * program. */ public static List generateStateSpaceDiagrams( - ReactorInstance reactor, TargetConfig targetConfig, Path graphDir) { + ReactorInstance reactor, TargetConfig targetConfig, Path graphDir) { // Initialize variables List SSDs; @@ -455,12 +470,13 @@ public static List generateStateSpaceDiagrams( // Generate a state space diagram for the initialization and periodic phase // of an LF program. StateSpaceDiagram stateSpaceInitAndPeriodic = - explore(reactor, TimeTag.ZERO, ExecutionPhase.INIT_AND_PERIODIC, targetConfig); - stateSpaceInitAndPeriodic.generateDotFile(graphDir, "state_space_" + ExecutionPhase.INIT_AND_PERIODIC + ".dot"); + explore(reactor, TimeTag.ZERO, ExecutionPhase.INIT_AND_PERIODIC, targetConfig); + stateSpaceInitAndPeriodic.generateDotFile( + graphDir, "state_space_" + ExecutionPhase.INIT_AND_PERIODIC + ".dot"); // Split the graph into a list of diagrams. List splittedDiagrams = - splitInitAndPeriodicDiagrams(stateSpaceInitAndPeriodic); + splitInitAndPeriodicDiagrams(stateSpaceInitAndPeriodic); // Convert the diagrams into fragments (i.e., having a notion of upstream & // downstream and carrying object file) and add them to the fragments list. @@ -484,8 +500,9 @@ public static List generateStateSpaceDiagrams( // shutdown phase. if (targetConfig.get(TimeOutProperty.INSTANCE) != null) { StateSpaceDiagram stateSpaceShutdownTimeout = - explore(reactor, TimeTag.ZERO, ExecutionPhase.SHUTDOWN_TIMEOUT, targetConfig); - stateSpaceInitAndPeriodic.generateDotFile(graphDir, "state_space_" + ExecutionPhase.SHUTDOWN_TIMEOUT + ".dot"); + explore(reactor, TimeTag.ZERO, ExecutionPhase.SHUTDOWN_TIMEOUT, targetConfig); + stateSpaceInitAndPeriodic.generateDotFile( + graphDir, "state_space_" + ExecutionPhase.SHUTDOWN_TIMEOUT + ".dot"); SSDs.add(stateSpaceShutdownTimeout); } @@ -563,4 +580,4 @@ public static ArrayList splitInitAndPeriodicDiagrams( return diagrams; } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/lflang/analyses/uclid/UclidGenerator.java b/core/src/main/java/org/lflang/analyses/uclid/UclidGenerator.java index f65076b98d..1a36750bba 100644 --- a/core/src/main/java/org/lflang/analyses/uclid/UclidGenerator.java +++ b/core/src/main/java/org/lflang/analyses/uclid/UclidGenerator.java @@ -1612,12 +1612,12 @@ private void populateLists(ReactorInstance reactor) { */ private void computeCT() { - StateSpaceDiagram diagram = StateSpaceExplorer.explore( - this.main, - new TimeTag(TimeValue.fromNanoSeconds(this.horizon), 0L), - ExecutionPhase.INIT_AND_PERIODIC, - targetConfig - ); + StateSpaceDiagram diagram = + StateSpaceExplorer.explore( + this.main, + new TimeTag(TimeValue.fromNanoSeconds(this.horizon), 0L), + ExecutionPhase.INIT_AND_PERIODIC, + targetConfig); diagram.display(); // Generate a dot file. diff --git a/core/src/main/java/org/lflang/generator/c/CScheduleGenerator.java b/core/src/main/java/org/lflang/generator/c/CScheduleGenerator.java index 8669d6c507..01b62d03ea 100644 --- a/core/src/main/java/org/lflang/generator/c/CScheduleGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CScheduleGenerator.java @@ -22,14 +22,13 @@ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************/ - package org.lflang.generator.c; +package org.lflang.generator.c; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; - import org.lflang.MessageReporter; import org.lflang.analyses.statespace.StateSpaceDiagram; import org.lflang.analyses.statespace.StateSpaceExplorer; @@ -39,14 +38,13 @@ import org.lflang.pretvm.PartialSchedule; import org.lflang.pretvm.Registers; import org.lflang.target.TargetConfig; -import org.lflang.target.property.TimeOutProperty; import org.lflang.target.property.WorkersProperty; public class CScheduleGenerator { /** File config */ protected final CFileConfig fileConfig; - + /** Target configuration */ protected TargetConfig targetConfig; @@ -110,7 +108,8 @@ public CScheduleGenerator( public void doGenerate() { // Generate a list of state space fragments that captures // all the behavior of the LF program. - List SSDs = StateSpaceExplorer.generateStateSpaceDiagrams(main, targetConfig, this.graphDir); + List SSDs = + StateSpaceExplorer.generateStateSpaceDiagrams(main, targetConfig, this.graphDir); // Instantiate object files with SSDs and connect them. List schedules = new ArrayList<>(); @@ -127,5 +126,4 @@ public void doGenerate() { // Create a scheduler. // StaticScheduler scheduler = createStaticScheduler(); } - -} \ No newline at end of file +} diff --git a/core/src/main/java/org/lflang/pretvm/Label.java b/core/src/main/java/org/lflang/pretvm/Label.java index 7e7dde16fc..45a1a8822f 100644 --- a/core/src/main/java/org/lflang/pretvm/Label.java +++ b/core/src/main/java/org/lflang/pretvm/Label.java @@ -1,14 +1,10 @@ package org.lflang.pretvm; -import org.lflang.pretvm.instruction.Instruction; - /** - * A memory label of an instruction, similar to labels in C assembly. - * The instructions should have references to the labels, but the labels do not - * need to contain references to the instructions, because when generating - * JAL instructions, we know which phase to jump to. But at that point, concrete - * instructions that carry a label pointing to the phase have not been generated - * yet. + * A memory label of an instruction, similar to labels in C assembly. The instructions should have + * references to the labels, but the labels do not need to contain references to the instructions, + * because when generating JAL instructions, we know which phase to jump to. But at that point, + * concrete instructions that carry a label pointing to the phase have not been generated yet. * * @author Shaokai J. Lin */ diff --git a/core/src/main/java/org/lflang/pretvm/PartialSchedule.java b/core/src/main/java/org/lflang/pretvm/PartialSchedule.java index 7b17fb03d9..7d7e536581 100644 --- a/core/src/main/java/org/lflang/pretvm/PartialSchedule.java +++ b/core/src/main/java/org/lflang/pretvm/PartialSchedule.java @@ -5,9 +5,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import org.lflang.analyses.statespace.StateSpaceDiagram; -import org.lflang.analyses.statespace.StateSpaceExplorer; import org.lflang.pretvm.dag.Dag; import org.lflang.pretvm.instruction.BGE; import org.lflang.pretvm.instruction.Instruction; @@ -15,17 +13,16 @@ import org.lflang.pretvm.register.ReturnAddr; /** - * A partial schedule contains instructions for one phase of execution, the - * state space diagram of that phase, the DAG, and references to - * upstream/downstream partial schedules. + * A partial schedule contains instructions for one phase of execution, the state space diagram of + * that phase, the DAG, and references to upstream/downstream partial schedules. * * @author Shaokai J. Lin */ public class PartialSchedule { /** - * A list of list of instructions, where the inner list is a sequence of instructions - * for a worker, and the outer list is a list of instruction sequences, one for each worker. + * A list of list of instructions, where the inner list is a sequence of instructions for a + * worker, and the outer list is a list of instruction sequences, one for each worker. */ private List> instructions; @@ -41,11 +38,11 @@ public class PartialSchedule { List downstreams = new ArrayList<>(); /** - * A map from a downstream object file to a transition guard. A transition - * guard is a sequence of instructions encoding conditional branch. - * - * FIXME: All workers for now will evaluate the same guard. This is arguably - * redundant work that needs to be optimized away. + * A map from a downstream object file to a transition guard. A transition guard is a sequence of + * instructions encoding conditional branch. + * + *

FIXME: All workers for now will evaluate the same guard. This is arguably redundant work + * that needs to be optimized away. */ Map> guardMap = new HashMap<>(); @@ -120,34 +117,36 @@ public void display() { * here would require changing isDefaultTransition() also. */ public static void linkSchedulesWithDefaultTransition( - PartialSchedule upstream, PartialSchedule downstream) { + PartialSchedule upstream, PartialSchedule downstream) { List defaultTransition = - Arrays.asList( - new JAL( - ReturnAddr.ABSTRACT_REGISTER, - Label.getExecutionPhaseLabel(downstream.getPhase()))); // Default transition + Arrays.asList( + new JAL( + ReturnAddr.ABSTRACT_REGISTER, + Label.getExecutionPhaseLabel(downstream.getPhase()))); // Default transition upstream.addDownstream(downstream, defaultTransition); downstream.addUpstream(upstream); } /** Connect two fragments with a guarded transition. */ public static void linkSchedulesWithGuardedTransition( - PartialSchedule upstream, - PartialSchedule downstream, - List guardedTransition) { + PartialSchedule upstream, PartialSchedule downstream, List guardedTransition) { upstream.addDownstream(downstream, guardedTransition); downstream.addUpstream(upstream); } - /** - * Given a list of partial schedules with non-empty SSDs, link them using - * the phase information in SSDs. - */ + /** + * Given a list of partial schedules with non-empty SSDs, link them using the phase information in + * SSDs. + */ public static void link(List schedules, Registers registers) { var init = schedules.stream().filter(it -> it.getPhase() == ExecutionPhase.INIT).findFirst(); - var periodic = schedules.stream().filter(it -> it.getPhase() == ExecutionPhase.PERIODIC).findFirst(); - var timeout = schedules.stream().filter(it -> it.getPhase() == ExecutionPhase.SHUTDOWN_TIMEOUT).findFirst(); - + var periodic = + schedules.stream().filter(it -> it.getPhase() == ExecutionPhase.PERIODIC).findFirst(); + var timeout = + schedules.stream() + .filter(it -> it.getPhase() == ExecutionPhase.SHUTDOWN_TIMEOUT) + .findFirst(); + // If INIT and PERIODIC are present, connect them with a default transition. if (init.isPresent() && periodic.isPresent()) { linkSchedulesWithDefaultTransition(init.get(), periodic.get()); @@ -160,8 +159,11 @@ public static void link(List schedules, Registers registers) { // Only transition to this fragment when offset >= timeout. List guardedTransition = new ArrayList<>(); guardedTransition.add( - new BGE(registers.offset, registers.timeout, Label.getExecutionPhaseLabel(ExecutionPhase.SHUTDOWN_TIMEOUT))); - + new BGE( + registers.offset, + registers.timeout, + Label.getExecutionPhaseLabel(ExecutionPhase.SHUTDOWN_TIMEOUT))); + // If PERIODIC is present, link PERIODIC to shutdown. if (periodic.isPresent()) { linkSchedulesWithGuardedTransition(periodic.get(), timeout.get(), guardedTransition); @@ -177,4 +179,4 @@ else if (init.isPresent()) { } } } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/lflang/pretvm/Registers.java b/core/src/main/java/org/lflang/pretvm/Registers.java index 8a895dfcb4..083d88d55e 100644 --- a/core/src/main/java/org/lflang/pretvm/Registers.java +++ b/core/src/main/java/org/lflang/pretvm/Registers.java @@ -2,12 +2,9 @@ import java.util.ArrayList; import java.util.List; - import org.lflang.pretvm.register.*; -/** - * A set of registers used by the PretVM - */ +/** A set of registers used by the PretVM */ public final class Registers { public final Register startTime; public final Register offset; @@ -16,22 +13,22 @@ public final class Registers { public final Register timeout; public final Register zero; public final List binarySemas = new ArrayList<>(); - public final List counters = new ArrayList<>(); + public final List counters = new ArrayList<>(); public final List returnAddrs = new ArrayList<>(); - public final List runtime = new ArrayList<>(); - public final List temp0 = new ArrayList<>(); - public final List temp1 = new ArrayList<>(); + public final List runtime = new ArrayList<>(); + public final List temp0 = new ArrayList<>(); + public final List temp1 = new ArrayList<>(); /** Constructor */ public Registers(int workers) { - + // Instantiate global registers. startTime = new StartTime(); - offset = new Offset(); + offset = new Offset(); offsetInc = new OffsetInc(); - one = new One(); - timeout = new Timeout(); - zero = new Zero(); + one = new One(); + timeout = new Timeout(); + zero = new Zero(); // Instantiate worker registers. for (int w = 0; w < workers; w++) { @@ -42,4 +39,4 @@ public Registers(int workers) { temp1.add(new Temp1(w)); } } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/lflang/pretvm/dag/Dag.java b/core/src/main/java/org/lflang/pretvm/dag/Dag.java index 34e0fd6b12..f2a1ea12ca 100644 --- a/core/src/main/java/org/lflang/pretvm/dag/Dag.java +++ b/core/src/main/java/org/lflang/pretvm/dag/Dag.java @@ -1,7 +1,5 @@ package org.lflang.pretvm.dag; -import java.io.BufferedReader; -import java.io.FileReader; import java.io.IOException; import java.nio.file.Path; import java.util.ArrayList; @@ -14,21 +12,11 @@ import java.util.Map; import java.util.Queue; import java.util.Set; -import java.util.StringTokenizer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Collectors; -import org.lflang.TimeValue; -import org.lflang.pretvm.instruction.Instruction; import org.lflang.generator.CodeBuilder; -import org.lflang.generator.ReactionInstance; - -/** - * Class representing a Directed Acyclic Graph (Dag), useful for the static scheduling. - * - * - * - */ +import org.lflang.pretvm.instruction.Instruction; + +/** Class representing a Directed Acyclic Graph (Dag), useful for the static scheduling. */ public class Dag { /** @@ -140,7 +128,8 @@ public void addNode(DagNode node) { // If the node is a job node for a reaction, // add the number of invocations the reaction has fired so far to the node. if (node instanceof JobNode job) { - job.setReactionRepeatCount(dagNodes.stream().filter(it -> it.isSynonyous(node)).toList().size()); + job.setReactionRepeatCount( + dagNodes.stream().filter(it -> it.isSynonyous(node)).toList().size()); } this.dagNodes.add(node); } @@ -376,9 +365,11 @@ public CodeBuilder generateDot(List> instructions) { label += "\\n" + inst.getOpcode(); } // Add repetition count, if any. - label += jobNode.getReactionRepeatCount() >= 0 ? "\\n" + "repeat=" + jobNode.getReactionRepeatCount() : ""; - } - else if (node instanceof TimeNode timeNode) { + label += + jobNode.getReactionRepeatCount() >= 0 + ? "\\n" + "repeat=" + jobNode.getReactionRepeatCount() + : ""; + } else if (node instanceof TimeNode timeNode) { int workers = instructions.size(); for (int worker = 0; worker < workers; worker++) { List workerInstructions = instructions.get(worker); @@ -583,4 +574,4 @@ public void removeRedundantEdges() { this.removeEdge(edge.sourceNode, edge.sinkNode); } } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/lflang/pretvm/dag/DagEdge.java b/core/src/main/java/org/lflang/pretvm/dag/DagEdge.java index e6ee3f7699..581b2218cf 100644 --- a/core/src/main/java/org/lflang/pretvm/dag/DagEdge.java +++ b/core/src/main/java/org/lflang/pretvm/dag/DagEdge.java @@ -25,4 +25,4 @@ public DagEdge(DagNode source, DagNode sink) { this.sourceNode = source; this.sinkNode = sink; } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/lflang/pretvm/dag/IntervalNode.java b/core/src/main/java/org/lflang/pretvm/dag/IntervalNode.java index ae86da2ba6..5f49c0eb99 100644 --- a/core/src/main/java/org/lflang/pretvm/dag/IntervalNode.java +++ b/core/src/main/java/org/lflang/pretvm/dag/IntervalNode.java @@ -44,12 +44,15 @@ public void setInterval(TimeValue interval) { /** A IntervalNode is synonymous with another if they have the same time. */ @Override public boolean isSynonyous(DagNode that) { - if (that instanceof IntervalNode node && this.interval.compareTo(node.interval) == 0) return true; + if (that instanceof IntervalNode node && this.interval.compareTo(node.interval) == 0) + return true; return false; } @Override public String toString() { - return this.getClass().getSimpleName() + " node" + (this.interval == null ? "" : " with interval " + this.interval); + return this.getClass().getSimpleName() + + " node" + + (this.interval == null ? "" : " with interval " + this.interval); } } diff --git a/core/src/main/java/org/lflang/pretvm/instruction/Instruction.java b/core/src/main/java/org/lflang/pretvm/instruction/Instruction.java index 6a0a1ec91b..34ffcb67af 100644 --- a/core/src/main/java/org/lflang/pretvm/instruction/Instruction.java +++ b/core/src/main/java/org/lflang/pretvm/instruction/Instruction.java @@ -121,7 +121,7 @@ public List getNodes() { /** * Return the opcode of the instruction, which is the class name. - * + * * @return the opcode of the instruction */ public String getOpcode() { diff --git a/core/src/main/java/org/lflang/pretvm/register/ReturnAddr.java b/core/src/main/java/org/lflang/pretvm/register/ReturnAddr.java index 7f651060c7..0ba0fe8d12 100644 --- a/core/src/main/java/org/lflang/pretvm/register/ReturnAddr.java +++ b/core/src/main/java/org/lflang/pretvm/register/ReturnAddr.java @@ -4,10 +4,12 @@ public class ReturnAddr extends WorkerRegister { /** Abstract worker registers whose owner needs to be defined later. */ public static final ReturnAddr ABSTRACT_REGISTER = new ReturnAddr(); + /** Constructor for an abstract register (no owner assigned) */ public ReturnAddr() { super(); } + /** Constructor for an concrete register */ public ReturnAddr(int worker) { super(worker); diff --git a/core/src/main/java/org/lflang/pretvm/register/WorkerRegister.java b/core/src/main/java/org/lflang/pretvm/register/WorkerRegister.java index 05be95365c..09774f9f3e 100644 --- a/core/src/main/java/org/lflang/pretvm/register/WorkerRegister.java +++ b/core/src/main/java/org/lflang/pretvm/register/WorkerRegister.java @@ -20,8 +20,8 @@ public Integer getOwner() { } /** - * A worker register is considered abstract if it does not have an owner. - * This could happen when generating guarded transitions. + * A worker register is considered abstract if it does not have an owner. This could happen when + * generating guarded transitions. */ public boolean isAbstract() { return owner == null;