Mercurial > hg > Members > nobuyasu > jungle-network
view src/jungle/test/alice/CopyAttrJungle2.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 |
line wrap: on
line source
package jungle.test.alice; import java.io.IOException; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.Jungle; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultTreeOperationLog; 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 jungle.test.core.practice.PrintChildrenAttribute; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; public class CopyAttrJungle2 extends CodeSegment { Receiver logReceiver = ids.create(CommandType.TAKE); Receiver countReceiver = ids.create(CommandType.TAKE); public CopyAttrJungle2() { logReceiver.setKey("log"); countReceiver.setKey("count2"); } public void run() { System.out.println("CopyAttrJungle2"); int count = countReceiver.asInteger(); DefaultTreeOperationLogContainer container = logReceiver.asClass(DefaultTreeOperationLogContainer.class); DefaultTreeOperationLog log = null; try { log = container.convert(); } catch (IOException e) { e.printStackTrace(); System.exit(0); } String treeName = container.getTreeName(); DoubleJungleManager djm = new DoubleJungleManager(); Jungle jungle2 = djm.getJungle2(); JungleTree tree = jungle2.getTreeByName(treeName); JungleTreeEditor editor = tree.getTreeEditor(); Either<Error, JungleTreeEditor> either = djm.edit(editor, log); if (either.isA()) { throw new IllegalStateException(); } editor = either.b(); editor.success(); new CheckDoubleTreeAttr(); ods.update("count", count); } }