Mercurial > hg > Members > nobuyasu > Alice > DPPAlice
changeset 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 | f0a2e2d2094e |
children | 6018e62cb198 |
files | src/alice/test/dpp/datasegment/Fork.java src/alice/test/dpp/datasegment/Philosophy.java src/alice/test/dpp/model/Fork.java src/alice/test/dpp/model/Philosophy.java |
diffstat | 4 files changed, 127 insertions(+), 127 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/dpp/datasegment/Fork.java Sun Dec 09 23:05:56 2012 +0900 @@ -0,0 +1,63 @@ +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; + } + + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/dpp/datasegment/Philosophy.java Sun Dec 09 23:05:56 2012 +0900 @@ -0,0 +1,64 @@ +package alice.test.dpp.datasegment; + +import org.msgpack.annotation.Message; +import org.msgpack.annotation.MessagePackOrdinalEnum; + + + + + +@Message +public class Philosophy { + + @MessagePackOrdinalEnum + public static enum State { + THINK, + TAKERIGHTFORK, + TAKELEFTFORK, + TAKEFORK, + EAT, + PUTFORK, + PUTRIGHTFORK, + PUTLEFTFORK; + } + + private String name, leftFork, rightFork; + private State state; + + + public Philosophy() {} + + public Philosophy(String n,String lFork, String rFork) { + name = n; + leftFork = lFork; + rightFork = rFork; + state = State.THINK; + } + + public Philosophy(Philosophy p) { + name = p.getName(); + leftFork = p.getLeftFork(); + rightFork = p.getRightFork(); + } + + public State getState() { + return state; + } + + public void setState(State s) { + state = s; + } + + public String getName() { + return name; + } + + public String getLeftFork() { + return leftFork; + } + + public String getRightFork() { + return rightFork; + } + +}
--- a/src/alice/test/dpp/model/Fork.java Sun Dec 09 23:00:34 2012 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -package alice.test.dpp.model; - -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; - } - - -}
--- a/src/alice/test/dpp/model/Philosophy.java Sun Dec 09 23:00:34 2012 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -package alice.test.dpp.model; - -import org.msgpack.annotation.Message; -import org.msgpack.annotation.MessagePackOrdinalEnum; - - - - - -@Message -public class Philosophy { - - @MessagePackOrdinalEnum - public static enum State { - THINK, - TAKERIGHTFORK, - TAKELEFTFORK, - TAKEFORK, - EAT, - PUTFORK, - PUTRIGHTFORK, - PUTLEFTFORK; - } - - private String name, leftFork, rightFork; - private State state; - - - public Philosophy() {} - - public Philosophy(String n,String lFork, String rFork) { - name = n; - leftFork = lFork; - rightFork = rFork; - state = State.THINK; - } - - public Philosophy(Philosophy p) { - name = p.getName(); - leftFork = p.getLeftFork(); - rightFork = p.getRightFork(); - } - - public State getState() { - return state; - } - - public void setState(State s) { - state = s; - } - - public String getName() { - return name; - } - - public String getLeftFork() { - return leftFork; - } - - public String getRightFork() { - return rightFork; - } - -}