Mercurial > hg > FederatedLinda
view src/fdl/MetaReply.java @ 26:d7d70edc9c7c
META_STOP worked.
author | kono |
---|---|
date | Wed, 20 Aug 2008 17:05:33 +0900 |
parents | 0243987383b7 |
children | 846c6c14cf04 |
line wrap: on
line source
package fdl; import java.nio.ByteBuffer; public class MetaReply extends PSXReply { public int id; public TupleSpace ts; public MetaReply(int mode, int id,TupleSpace ts) { this.mode = mode; this.id = id; this.ts = ts; this.command = ByteBuffer.allocate(PSX.LINDA_HEADER_SIZE); } public MetaReply(int mode, int id, TupleSpace ts,PSXCallback callback) { this(mode,id,ts); this.callback = callback; } public MetaReply(int mode, int id, TupleSpace ts,ByteBuffer data, PSXCallback callback) { this(mode,id,ts); this.data = data; this.callback = callback; } void checkTuple() { ByteBuffer data = ts.IN(id, mode, command); if (data!=null) { this.data = data; mode = PSX.PSX_ANSWER; if (callback!=null) callback.callback(data); } } public boolean ready() { switch(mode) { case PSX.PSX_IN: case PSX.PSX_RD: checkTuple(); break; case PSX.PSX_CHECK: data = ts.check1(null, command); if (data!=null) { mode = PSX.PSX_ANSWER; } break; case PSX.PSX_OUT: ts.Out(null, command, data); return true; case PSX.PSX_UPDATE: // not implemented break; } return mode==PSX.PSX_ANSWER; } }