public class Node {
- void doReset(Context ctx, int phase, Dock dock, Port peer, Destination ackDestination, boolean peerUsed) {
- if (dock.getShip().getType().equals("Debug")) return;
+ int doReset(Context ctx, int phase, Dock dock, Port peer, Destination ackDestination, boolean peerUsed) {
+ int ret = 0;
+ if (dock.getShip().getType().equals("Debug")) return ret;
switch(phase) {
lf = lf.makeNext(0);
lf.abortLoopIfTorpedoPresent();
lf.collectWord();
- DataFlowGraph.reset_count++;
+ ret++;
}
break;
}
((OutPort)peer).recvWord(lf);
((OutPort)peer).sendToken(lf);
}
- DataFlowGraph.reset_count++;
+ ret++;
}
break;
}
for(int i=0; i<((InPort)peer).getTokensToAbsorb(); i++)
lf.recvToken();
lf.sendToken(ackDestination);
- DataFlowGraph.reset_count++;
+ ret++;
}
break;
}
}
LoopFactory lf = new LoopFactory(ctx, dock, 1);
lf.sendToken(ackDestination);
- DataFlowGraph.reset_count++;
+ ret++;
}
break;
}
-
-
}
+ return ret;
}
public final DataFlowGraph dfg;
public OutPort getOutPort(String name) { return (OutPort)ports.get(name); }
public void build(Context ctx) { for(Port p : ports.values()) p.build(ctx); }
- public void reset(Context ctx, int phase, Destination ackDestination) {
- for(Port p : ports.values()) p.reset(ctx, phase, ackDestination);
+ public int reset(Context ctx, int phase, Destination ackDestination) {
+ int ret = 0;
+ for(Port p : ports.values()) ret += p.reset(ctx, phase, ackDestination);
+ return ret;
}
public abstract class Port {
Node.this.ports.put(name,this);
}
public abstract void build(Context ctx);
- public abstract void reset(Context ctx, int phase, Destination ackDestination);
+ public abstract int reset(Context ctx, int phase, Destination ackDestination);
}
public abstract class InPort extends Port {
for(int i=0; i<pattern.length; i++) if (pattern[i]==null) return true;
return false;
}
- public void reset(Context ctx, int phase, Destination ackDestination) {
- doReset(ctx, phase, dock, peer, ackDestination, peerUsed());
+ public int reset(Context ctx, int phase, Destination ackDestination) {
+ return doReset(ctx, phase, dock, peer, ackDestination, peerUsed());
}
protected void build(Context ctx, LoopFactory lf) {
int inflight = (count != 0 && count < getInflight()) ? count : getInflight();
lf.collectWord();
peer.sendWord(lf);
}
- public void reset(Context ctx, int phase, Destination ackDestination) {
- doReset(ctx, phase, dock, peer, ackDestination, true);
+ public int reset(Context ctx, int phase, Destination ackDestination) {
+ return doReset(ctx, phase, dock, peer, ackDestination, true);
}
}