Mercurial > hg > Database > Alice
view src/main/java/alice/test/topology/aquarium/fx/CheckAllFishInfoExist.java @ 529:cb7c31848d16 dispose
add CompressedDSMs
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 01 May 2015 18:19:16 +0900 |
parents | 6e304a7a60e7 |
children | 0832af83583f |
line wrap: on
line source
package alice.test.topology.aquarium.fx; import java.io.IOException; import javafx.scene.Group; import javafx.scene.Node; import org.msgpack.MessagePack; import org.msgpack.type.ArrayValue; import org.msgpack.type.Value; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; public class CheckAllFishInfoExist extends CodeSegment { // this CS check all fish object exist in scene private Receiver info = ids.create(CommandType.TAKE); // fishInfoList private Receiver info1 = ids.create(CommandType.PEEK); public CheckAllFishInfoExist(){ info.setKey("receiveRegisteredList"); info1.setKey("root"); } @Override public void run() { try { new SendDataOthers(info, info.key); ods.put("registeredList", info.getVal()); ArrayValue fishInfoList = info.asClass(Value.class).asArrayValue(); MessagePack packer = new MessagePack(); Group root = info1.asClass(Group.class); for (Value v : fishInfoList){ boolean exist = false; FishInfo info = packer.convert(v, FishInfo.class); if (info.name != null) { for (Node n : root.getChildren()) { if (info.name.equals(n.getId())) { exist = true; break; } } if (!exist) { info.fromCheckExist = true; ods.put("fishData", info); } } } } catch (IOException e) { e.printStackTrace(); } this.recycle(); } }