Mercurial > hg > Members > nobuyasu > Alice > DPPAlice
view src/alice/test/dpp/datasegment/Fork.java @ 19:dbc5c8e8e9c2
rename frome model to datasegment
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 09 Dec 2012 23:05:56 +0900 |
parents | src/alice/test/dpp/model/Fork.java@7e91e919a7de |
children | edd9ced13896 |
line wrap: on
line source
package alice.test.dpp.datasegment; import org.msgpack.annotation.Message; import org.msgpack.annotation.MessagePackOrdinalEnum; @Message public class Fork { private String forkName; private String owner; private State state; private final String TABLE = "TABLE"; @MessagePackOrdinalEnum public enum State { ON_THE_TABLE, IN_THE_HAND; } public Fork() {} public Fork(String n) { forkName = n; owner = TABLE; state = State.ON_THE_TABLE; } public State getState() { return state; } public String getForkName() { return forkName; } public boolean getFork(String pName) { if (state == State.ON_THE_TABLE) { state = State.IN_THE_HAND; owner = pName; return true; } else { return false; } } public boolean onTheTable(String pName) { if (owner.equals(pName)) { state = State.ON_THE_TABLE; owner = TABLE; return true; } else { return false; } } public String getOwner() { return owner; } }