X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ships%2FChoice.ship;h=eb56a40c57260664fe166ba3cf3ea7dfa4aedaab;hb=b9dbc8cf26a34328893e2e462456f15e1baf1a07;hp=28531ddb1d43af9a354d3d443bac8ff5598fa279;hpb=51af1d2ab96f3301016063251138b73d48c74527;p=fleet.git diff --git a/ships/Choice.ship b/ships/Choice.ship index 28531dd..eb56a40 100644 --- a/ships/Choice.ship +++ b/ships/Choice.ship @@ -3,21 +3,18 @@ ship: Choice == Ports =========================================================== data in: in1 data in: in2 - data in: in.swapIfZero data in: in.swapIfNonZero data in: in.swapIfNegative data in: in.swapIfPositive data in: in.swapIfNonNegative data in: in.swapIfNonPositive - data in: in.muxIfZero data in: in.muxIfNonZero data in: in.muxIfNegative data in: in.muxIfPositive data in: in.muxIfNonNegative data in: in.muxIfNonPositive - data in: in.deMuxIfZero data in: in.deMuxIfNonZero data in: in.deMuxIfNegative @@ -32,38 +29,43 @@ data out: out2 == TeX ============================================================== -With judicious programming of its BenkoBoxes, this ship can be used to -implement nearly all forms of selection and branching. - -When data is available at the in port, it is examined. Which -destination the datum has arrived on determines the *condition* the -datum should be tested for and the *action* which should be taken if -the condition holds true. - -The latter portion of the name of the destination (IfZero, -If(Non)Positive, If(Non)Negative) determines the condition which the -datum on the in port is tested for. The former portion (mux, demux, -swap) determines the *action* to be taken if the condition tests true. - - action condition effect - ------ --------- ------------------------------- - swap false in1->out1 in2->out2 - swap true in2->out1 in1->out2 - mux false in1->out1 - mux true in2->out1 - demux false in1->out1 - demux true in1->out2 - -In each case, the ship will wait for a datum to be available on all -input ports (and only those ports) mentioned in the appropriate row of -the "effect" column above, and will output them on the corresponding -output ports. +This ship needs to be updated to use opcode ports \cite{am25}. For a +general idea of what this ship is supposed to do, see \cite{am17}. + +%With judicious programming of its pumps, this ship can be used to +%implement nearly all forms of selection and branching. +% +%When data is available at the in port, it is examined. Which +%destination the datum has arrived on determines the *condition* the +%datum should be tested for and the *action* which should be taken if +%the condition holds true. +% +%The latter portion of the name of the destination (IfZero, +%If(Non)Positive, If(Non)Negative) determines the condition which the +%datum on the in port is tested for. The former portion (mux, demux, +%swap) determines the *action* to be taken if the condition tests true. +% +%\begin{verbatim} +% action condition effect +% ------ --------- ------------------------------- +% swap false in1->out1 in2->out2 +% swap true in2->out1 in1->out2 +% mux false in1->out1 +% mux true in2->out1 +% demux false in1->out1 +% demux true in1->out2 +%\end{verbatim} +% +%In each case, the ship will wait for a datum to be available on all +%input ports (and only those ports) mentioned in the appropriate row of +%the "effect" column above, and will output them on the corresponding +%output ports. == Fleeterpreter ==================================================== private Packet selector; public void service() { - if (!box_out1.readyForItemFromShip() || !box_out2.readyForItemFromShip()) return; + if (!box_out1.readyForDataFromShip() || !box_out2.readyForDataFromShip()) return; if (selector == null && !box_in.dataReadyForShip()) return; if (selector == null) selector = box_in.removePacketForShip(); String port = selector.destination.getDestinationName(); @@ -206,5 +208,10 @@ public void service() { +== Test ============================================================================== +#skip +#ship debug : Debug +#expect 0 + == Contributors ========================================================= Adam Megacz