+++ /dev/null
-package edu.berkeley.fleet.interpreter.ships;
-import edu.berkeley.fleet.interpreter.*;
-import edu.berkeley.fleet.*;
-
-import java.util.*;
-import java.io.*;
-
-public class Mux extends InterpreterShip {
-
- DataInbox ap = new DataInbox(this, "a");
- DataInbox bp = new DataInbox(this, "b");
- DataInbox choicep = new DataInbox(this, "select");
- DataOutbox out = new DataOutbox(this, "out");
-
- public Mux(Interpreter fleet, String name) { super(fleet, name); }
-
- public String getBalsaName() { return "mux"; }
-
- public void service() {
- if (ap.dataReadyForShip() && bp.dataReadyForShip() && choicep.dataReadyForShip()) {
- int a = ap.removeDataForShip();
- int b = bp.removeDataForShip();
- int choice = choicep.removeDataForShip();
- out.addDataFromShip(choice==0 ? a : b);
- }
- }
-
-}