Mercurial > hg > Members > nobuyasu > Alice > DPPAlice
view src/alice/test/dpp/codesegment/ThinkCodeSegment.java @ 14:33727db069c2
add ScheduleCodeSegment. modified CodeSegment
author | one |
---|---|
date | Wed, 28 Nov 2012 17:41:42 +0900 |
parents | 888388e47fe5 |
children | 7e91e919a7de |
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.model.Philosophy; public class ThinkCodeSegment extends CodeSegment { Receiver arg1 = ids.create(CommandType.TAKE); public ThinkCodeSegment(String pName) { arg1.setKey(pName); } @Override public void run() { Philosophy phil = arg1.asClass(Philosophy.class); System.out.println(phil.getName() + " is thinking"); phil.setState(Philosophy.State.TAKEFORK); new ScheduleCodeSegment(phil.getName()); ods.update("local", phil.getName(), phil); } }