From: megacz Date: Sun, 15 Mar 2009 00:31:19 +0000 (-0700) Subject: rename Process to DataFlowGraph, de-static-ify some methods X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=f7fc665ea8602dc63cc2a6d5688b152d4697db89;p=fleet.git rename Process to DataFlowGraph, de-static-ify some methods --- diff --git a/src/edu/berkeley/fleet/dataflow/Process.java b/src/edu/berkeley/fleet/dataflow/DataFlowGraph.java similarity index 89% rename from src/edu/berkeley/fleet/dataflow/Process.java rename to src/edu/berkeley/fleet/dataflow/DataFlowGraph.java index 3a83ccf..f7e873f 100644 --- a/src/edu/berkeley/fleet/dataflow/Process.java +++ b/src/edu/berkeley/fleet/dataflow/DataFlowGraph.java @@ -14,40 +14,43 @@ import static edu.berkeley.fleet.util.BitManipulations.*; // does peer.recvWord() have to honor the currently-set predicate? -// public class ReplaceModule extends Module { } -// public class CountMergeModule extends Module { } -// public class SortMergeModule extends Module { } -// public class FanOutModule extends Module { } -// public class MemoryModule extends Module { } -// public class DoneModule extends Module { } +// public class ReplaceNode extends Node { } +// public class CountMergeNode extends Node { } +// public class SortMergeNode extends Node { } +// public class FanOutNode extends Node { } +// public class MemoryNode extends Node { } +// public class DoneNode extends Node { } -public class Process { - - public static int reset_count = 0; - public static HashSet torpedoes = new HashSet(); +public class DataFlowGraph { public final Fleet fleet; public final ShipPool pool; - public Process(Fleet fleet) { + public DataFlowGraph(Fleet fleet) { + this(fleet, new ShipPool(fleet)); + } + public DataFlowGraph(Fleet fleet, ShipPool pool) { this.fleet = fleet; - this.pool = new ShipPool(fleet); + this.pool = pool; } - private HashSet modules = new HashSet(); + public static int reset_count = 0; + public static HashSet torpedoes = new HashSet(); + + private HashSet nodes = new HashSet(); public void build(Context ctx) { - for(Module mod : modules) + for(Node mod : nodes) mod.build(ctx); } public void reset(Context ctx, int phase, Destination ackDestination) { reset_count = 0; torpedoes.clear(); - for(Module mod : modules) + for(Node mod : nodes) mod.reset(ctx, phase, ackDestination); } - public class Module { + public class Node { void doReset(Context ctx, int phase, Dock dock, Port peer, Destination ackDestination, boolean peerUsed) { if (dock.getShip().getType().equals("Debug")) return; @@ -127,8 +130,8 @@ public class Process { } } - public Module() { - Process.this.modules.add(this); + public Node() { + DataFlowGraph.this.nodes.add(this); } private HashMap ports = new HashMap(); @@ -145,8 +148,8 @@ public class Process { public final String name; public Port(String name) { this.name = name; - if (Module.this.ports.get(name)!=null) throw new RuntimeException(); - Module.this.ports.put(name,this); + if (Node.this.ports.get(name)!=null) throw new RuntimeException(); + Node.this.ports.put(name,this); } public abstract void build(Context ctx); public abstract void reset(Context ctx, int phase, Destination ackDestination); @@ -274,8 +277,8 @@ public class Process { } } - private static BitVector bv(long l) { return new BitVector(/*FIXME fleet.getWordWidth()*/37).set(l); } - private static BitVector[] bv(long[] l) { + private BitVector bv(long l) { return new BitVector(/*FIXME fleet.getWordWidth()*/37).set(l); } + private BitVector[] bv(long[] l) { BitVector[] ret = new BitVector[l.length]; for(int i=0; i