Mercurial > hg > Members > nobuyasu > Alice > DPPAlice
view src/alice/test/dpp/codesegment/ScheduleCodeSegment.java @ 22:fd370b35fac1
modfied codeSegment
author | one |
---|---|
date | Mon, 10 Dec 2012 00:19:27 +0900 |
parents | 6018e62cb198 |
children |
line wrap: on
line source
package alice.test.dpp.codesegment; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.test.dpp.datasegment.Philosophy; public class ScheduleCodeSegment extends CodeSegment { /* * This CodeSegment is unuse CodeSegment. */ Receiver arg1 = ids.create(CommandType.TAKE); public ScheduleCodeSegment(String pName) { arg1.setKey(pName); } @Override public void run() { Philosophy phil = arg1.asClass(Philosophy.class); switch(phil.getState()) { case THINK: new ThinkCodeSegment(phil.getName()); break; case TAKERIGHTFORK: new TakeRightForkCodeSegment(phil.getName(), phil.getRightFork()); break; case TAKELEFTFORK: new TakeRightForkCodeSegment(phil.getName(), phil.getLeftFork()); break; /* case TAKEFORK: new TakeForkCodeSegment(phil.getName(), phil.getRightFork(), phil.getLeftFork() ); break; */ case EAT: new EatCodeSegment(phil.getName()); break; case PUTFORK: new PutForkCodeSegment(phil.getName(), phil.getRightFork(), phil.getLeftFork()); break; default: } ods.update("local", phil.getName(), phil); } }