Mercurial > hg > Members > nobuyasu > jungle-network
comparison src/jungle/test/bbs/codesegment/ChildLogCheckCodeSegment.java @ 58:4851344e120e
fix bug LogUpdateCodeSegment and ChildLogCheckCodeSegment
author | one |
---|---|
date | Mon, 15 Jul 2013 10:13:34 +0900 |
parents | 1bfd13f831ea |
children | 8a532ca5df80 |
comparison
equal
deleted
inserted
replaced
57:1bfd13f831ea | 58:4851344e120e |
---|---|
30 public ChildLogCheckCodeSegment() { | 30 public ChildLogCheckCodeSegment() { |
31 host.setKey("host"); | 31 host.setKey("host"); |
32 childLog.setKey("local","childLog"); | 32 childLog.setKey("local","childLog"); |
33 hashLog.setKey("hashLog"); | 33 hashLog.setKey("hashLog"); |
34 } | 34 } |
35 | |
36 public ChildLogCheckCodeSegment(int index) { | |
37 host.setKey("host"); | |
38 childLog.setKey("local","childLog", index); | |
39 hashLog.setKey("hashLog"); | |
40 } | |
41 | |
35 | 42 |
36 public void run() { | 43 public void run() { |
37 System.out.println("--ChildLogCheckCodeSegment--"); | 44 System.out.println("--ChildLogCheckCodeSegment--"); |
45 int index = childLog.index; | |
46 HashSetDataSegment ds = hashLog.asClass(HashSetDataSegment.class); | |
38 String hostName = host.asString(); | 47 String hostName = host.asString(); |
39 DefaultTreeOperationLogContainer container = childLog.asClass(DefaultTreeOperationLogContainer.class); | 48 DefaultTreeOperationLogContainer container = childLog.asClass(DefaultTreeOperationLogContainer.class); |
40 DefaultTreeOperationLog log = null; | 49 DefaultTreeOperationLog log = null; |
41 try { | 50 try { |
42 log = container.convert(); | 51 log = container.convert(); |
51 } | 60 } |
52 JungleTree tree = JungleManager.getJungle().getTreeByName(treeName); | 61 JungleTree tree = JungleManager.getJungle().getTreeByName(treeName); |
53 JungleTreeEditor editor = tree.getTreeEditor(); | 62 JungleTreeEditor editor = tree.getTreeEditor(); |
54 Either<DefaultError, Integer> e = checkTimeStamp(tree.getRootNode(), container.getTimeStamp()); | 63 Either<DefaultError, Integer> e = checkTimeStamp(tree.getRootNode(), container.getTimeStamp()); |
55 Either<Error, JungleTreeEditor> either; | 64 Either<Error, JungleTreeEditor> either; |
56 if(e.isB()) { | 65 if(e.isA()) { |
57 either = JungleManager.edit(editor, log, container.getPosition()); | 66 either = JungleManager.edit(editor, log, container.getPosition()); |
58 } else { | 67 } else { |
59 either = JungleManager.edit(editor, log); | 68 either = JungleManager.edit(editor, log, e.b()); |
60 } | 69 } |
61 // Either<Error, JungleTreeEditor> either = JungleManager.edit(editor, log); | |
62 if(either.isA()) { | 70 if(either.isA()) { |
63 throw new IllegalStateException(); | 71 throw new IllegalStateException(); |
64 } | 72 } |
65 editor = either.b(); | 73 editor = either.b(); |
66 either = editor.success(); | 74 either = editor.success(); |
67 if(either.isA()) { | 75 if(either.isA()) { |
68 throw new IllegalStateException(); | 76 throw new IllegalStateException(); |
69 } | 77 } |
70 HashSetDataSegment ds = hashLog.asClass(HashSetDataSegment.class); | |
71 ds.hash.add(container.getHashLogString()); | 78 ds.hash.add(container.getHashLogString()); |
72 ods.update("hashLog", ds); | 79 ods.update("hashLog", ds); |
73 ods.put("log", container); | 80 ods.put("log", container); |
74 new ChildLogCheckCodeSegment(); | 81 new ChildLogCheckCodeSegment(index); |
75 if(!hostName.equals("node0")) { | 82 if(!hostName.equals("node0")) { |
76 ods.put("parent", "childLog", container); | 83 ods.put("parent", "childLog", container); |
77 } | 84 } |
78 } | 85 } |
79 | 86 |