Mercurial > hg > Database > Alice
changeset 405:c817721af5ec dispose
change timing create addObject code segment
author | sugi |
---|---|
date | Tue, 24 Jun 2014 13:38:34 +0900 |
parents | fee3efd9257d |
children | d28b1216d615 |
files | src/main/java/alice/test/topology/aquarium/fx/AddObject.java src/main/java/alice/test/topology/aquarium/fx/CheckMyName.java src/main/java/alice/test/topology/aquarium/fx/CreateObject.java |
diffstat | 3 files changed, 19 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/alice/test/topology/aquarium/fx/AddObject.java Mon Jun 23 18:12:57 2014 +0900 +++ b/src/main/java/alice/test/topology/aquarium/fx/AddObject.java Tue Jun 24 13:38:34 2014 +0900 @@ -9,13 +9,15 @@ public class AddObject extends CodeSegment { // add Object on javaFx Scene - private Receiver info = ids.create(CommandType.PEEK); // objectList + private Receiver info = ids.create(CommandType.TAKE); // objectList private Receiver info1 = ids.create(CommandType.TAKE); // fish Object made from CreateObject CS + private Receiver info2 = ids.create(CommandType.PEEK); // node name private boolean executed = false; public AddObject(){ info.setKey("root"); info1.setKey("addOffer"); + info2.setKey("host"); } @Override @@ -28,6 +30,7 @@ boolean duplication = false; Group root = info.asClass(Group.class); Group obj = info1.asClass(Group.class); + String myName = info2.asString(); for (Node n : root.getChildren()){ if (n.getId().equals(obj.getId())) @@ -35,10 +38,16 @@ } if (!duplication) { root.getChildren().add(obj); + ods.put(obj.getId()+"Fish", obj); + + // controlled own fish + if (myName.equals(obj.getId())){ + new CalculatePosition(obj.getId()+"FishdiffP"); + } } - ods.put(obj.getId()+"Fish", obj); - new AddObject(); - } + ods.flip(info); + + } }
--- a/src/main/java/alice/test/topology/aquarium/fx/CheckMyName.java Mon Jun 23 18:12:57 2014 +0900 +++ b/src/main/java/alice/test/topology/aquarium/fx/CheckMyName.java Tue Jun 24 13:38:34 2014 +0900 @@ -47,8 +47,7 @@ ods.put("fishData", fishInfo); new CreateObject(); - new AddObject(); - + String[] args = {name}; Aquarium.main(args); }
--- a/src/main/java/alice/test/topology/aquarium/fx/CreateObject.java Mon Jun 23 18:12:57 2014 +0900 +++ b/src/main/java/alice/test/topology/aquarium/fx/CreateObject.java Tue Jun 24 13:38:34 2014 +0900 @@ -18,18 +18,17 @@ public class CreateObject extends CodeSegment{ private Receiver info = ids.create(CommandType.TAKE); // fishInfo - private Receiver info1 = ids.create(CommandType.PEEK); // node name + public CreateObject(){ info.setKey("fishData"); - info1.setKey("host"); + } @Override public void run() { FishInfo fishInfo = info.asClass(FishInfo.class); - String myName = info1.asString(); - + Group obj = new Group(); addColladaObject(obj); @@ -38,16 +37,13 @@ obj.setScaleZ(fishInfo.size); obj.setId(fishInfo.name); - // controlled own fish - if (myName.equals(fishInfo.name)){ - new CalculatePosition(fishInfo.name+"FishdiffP"); - } - new SetTranslate(fishInfo.name+"Fish"); ods.put("addOffer", obj); ods.put("register", fishInfo); new SendDataOthers(info, "fishData"); + new CreateObject(); + new AddObject(); } // for read *.obj file