Mercurial > hg > Members > nobuyasu > jungle-network
view src/jungle/app/bbs/codesegment/LogUpdateCodeSegment.java @ 75:87ec5dd0dc27
Rename from alice.jungle.datasegment.store.operation to alice.jungle.datasegment.store.container
author | one |
---|---|
date | Tue, 15 Oct 2013 14:43:29 +0900 |
parents | 29127ac788a6 |
children | fcce7ca4adb9 |
line wrap: on
line source
package jungle.app.bbs.codesegment; 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; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.jungle.datasegment.HashSetDataSegment; import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; public class LogUpdateCodeSegment extends CodeSegment { Receiver parentLog = ids.create(CommandType.PEEK); Receiver host = ids.create(CommandType.PEEK); Receiver hashLog = ids.create(CommandType.PEEK); public LogUpdateCodeSegment() { parentLog.setKey("parent", "log"); host.setKey("host"); hashLog.setKey("hashLog"); } public LogUpdateCodeSegment(int index) { parentLog.setKey("parent", "log", index); host.setKey("host"); hashLog.setKey("hashLog"); } public void run() { int index = parentLog.index; // String hostName = host.asString(); DefaultTreeOperationLogContainer container = parentLog.asClass(DefaultTreeOperationLogContainer.class); HashSetDataSegment ds = hashLog.asClass(HashSetDataSegment.class); if(ds.hash.contains(container.getHashLogString())) { ods.update("hashLog", ds); new LogUpdateCodeSegment(index); return; } Either<Error, JungleTreeEditor> either = JungleManager.update(container); if(either.isA()) { throw new IllegalStateException(); } ds.hash.add(container.getHashLogString()); ods.update("hashLog", ds); ods.put("log", container); new LogUpdateCodeSegment(index); } }