Mercurial > hg > Database > jungle-network
view src/main/java/jungle/app/bbs/codesegment/LogUpdateCodeSegment.java @ 106:f42f2e6b31de
Removed project reference and Added dependency in pom.xml
author | one |
---|---|
date | Tue, 26 Nov 2013 07:11:36 +0900 |
parents | f9e29a52efd3 |
children |
line wrap: on
line source
package jungle.app.bbs.codesegment; import java.util.List; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.jungle.operations.NetworkTreeOperationLog; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; import jungle.app.bbs.JungleManager; public class LogUpdateCodeSegment extends CodeSegment { Receiver log = ids.create(CommandType.PEEK); Receiver clist = ids.create(CommandType.PEEK); public LogUpdateCodeSegment() { log.setKey("log"); clist.setKey("_CLIST");; } public LogUpdateCodeSegment(int index) { log.setKey("log", index); clist.setKey("_CLIST");; } public void run() { int index = log.index; NetworkTreeOperationLog netLog = log.asClass(NetworkTreeOperationLog.class); @SuppressWarnings("unchecked") List<String> list = clist.asClass(List.class); if (!log.from.equals("local")) { Either<Error, JungleTreeEditor> either = JungleManager.update(netLog); if(either.isA()) { /* Should throw after new LogUpdateCodeSegment */ throw new IllegalStateException(); } } for (String node : list) { if (!node.equals(log.from)) { ods.put(node, log.key, log.getVal()); } } new LogUpdateCodeSegment(index); } }