Mercurial > hg > Database > Alice
changeset 105:993a9f194615 working
success share TEST
author | sugi |
---|---|
date | Tue, 03 Jul 2012 15:58:08 +0900 |
parents | e9005fc9b913 |
children | c84a2b4a877a |
files | src/alice/test/topology/movement/CheckFishLocation.java src/alice/test/topology/movement/CheckMyName.java src/alice/test/topology/movement/KeyInputCodeSegment.java src/alice/test/topology/movement/MakeObject.java src/alice/test/topology/movement/SendLocation.java |
diffstat | 5 files changed, 34 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/test/topology/movement/CheckFishLocation.java Tue Jul 03 15:55:27 2012 +0900 +++ b/src/alice/test/topology/movement/CheckFishLocation.java Tue Jul 03 15:58:08 2012 +0900 @@ -13,13 +13,14 @@ private Receiver position = ids.create(CommandType.PEEK); private Receiver host = ids.create(CommandType.PEEK); MakeObject obj; + String key; Pattern pattern = Pattern.compile("^(cli)([0-9]+)$"); - public CheckFishLocation(MakeObject MO ,String str){ + public CheckFishLocation(MakeObject MO ,String key,int index){ this.obj = MO; - this.position.key = str; + this.key = key; this.host.setKey("local","host"); - this.position.setKey("parent",this.position.key,this.position.index); + this.position.setKey("local",key,index); } @Override @@ -32,15 +33,15 @@ float startX = 2*num - 3.0f; float endX = 2*num -0.9f; FishPoint FP = this.position.asClass(FishPoint.class); - System.out.println(this.position.key+" :" + FP.getX()); - + obj.setLocation(FP.getX(), FP.getY()); + /* if (startX <= FP.getX() && FP.getX() < endX){ obj.setLocation(FP.getX() - 2*(num-1), FP.getY()); - //if(this.position.key!="fish3X") - //ods.update("parent", this.position.key, this.position.asInteger()+1); + if(this.position.key!="fish3X") + ods.update("parent", this.position.key, this.position.asInteger()+1); } - - new CheckFishLocation(this.obj,this.position.key); + */ + new CheckFishLocation(this.obj,this.key,this.position.index);
--- a/src/alice/test/topology/movement/CheckMyName.java Tue Jul 03 15:55:27 2012 +0900 +++ b/src/alice/test/topology/movement/CheckMyName.java Tue Jul 03 15:58:08 2012 +0900 @@ -6,11 +6,13 @@ import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; +import alice.test.topology.share.CheckLocalIndex; +import alice.test.topology.share.CheckParentIndex; public class CheckMyName extends CodeSegment { Receiver host = ids.create(CommandType.PEEK); Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$"); - + String key = "fish"; @Override public void run(){ @@ -24,12 +26,14 @@ if (type.equals("cli")){ System.out.println("cli"+cliNum); - + ods.update("local", key, new FishPoint(0.0f,0.0f)); MakeFrame frame = new MakeFrame(); MakeObject obj3 = new MakeObject(frame); frame.register(obj3); - new CheckFishLocation(obj3,"fish3X"); + new CheckFishLocation(obj3,key,0); + new CheckLocalIndex(key,0); + new CheckParentIndex(key,0); /* MakeObject obj = new MakeObject(frame); frame.register(obj); @@ -38,9 +42,17 @@ }else if(type.equals("node")){ System.out.println("node0"); - ods.update("local", "fish3X", new FishPoint(0.0f,0.0f)); + ods.update("local", key, new FishPoint(0.0f,0.0f)); //ods.update("local", "fish1X", new FishPoint(-1.0f,0.0f)); - + if(cliNum == 0){ + new LookData(key,0); + } else { + new CheckLocalIndex(key,0); + new CheckParentIndex(key,0); + + } + + } }
--- a/src/alice/test/topology/movement/KeyInputCodeSegment.java Tue Jul 03 15:55:27 2012 +0900 +++ b/src/alice/test/topology/movement/KeyInputCodeSegment.java Tue Jul 03 15:58:08 2012 +0900 @@ -15,24 +15,24 @@ @Override public void keyPressed(KeyEvent event) { KeyCode = event.getKeyCode(); - System.out.println("getKey" +KeyCode); + //System.out.println("getKey" +KeyCode); switch(KeyCode) { case 37: cs = new SendLocation(-0.1f,0.0f); - cs.position.setKey("parent", "fish3X"); + cs.position.setKey("local", "fish"); break; case 39: cs = new SendLocation(0.1f,0.0f); - cs.position.setKey("parent", "fish3X"); + cs.position.setKey("local", "fish"); break; case 40: cs = new SendLocation(0.0f,-0.1f); - cs.position.setKey("parent", "fish3X"); + cs.position.setKey("local", "fish"); break; case 38: cs = new SendLocation(0.0f,0.1f); - cs.position.setKey("parent", "fish3X"); + cs.position.setKey("local", "fish"); break; } }
--- a/src/alice/test/topology/movement/MakeObject.java Tue Jul 03 15:55:27 2012 +0900 +++ b/src/alice/test/topology/movement/MakeObject.java Tue Jul 03 15:58:08 2012 +0900 @@ -57,7 +57,7 @@ } private Appearance createAppearance(){ - System.out.println(new File(".").getAbsolutePath()); + //System.out.println(new File(".").getAbsolutePath()); Appearance app = new Appearance(); Image image = null; Toolkit toolkit = Toolkit.getDefaultToolkit();
--- a/src/alice/test/topology/movement/SendLocation.java Tue Jul 03 15:55:27 2012 +0900 +++ b/src/alice/test/topology/movement/SendLocation.java Tue Jul 03 15:58:08 2012 +0900 @@ -18,10 +18,9 @@ @Override public void run() { - System.out.println("update"); FishPoint FP = this.position.asClass(FishPoint.class); FP.setXY(FP.getX()+this.x, FP.getY()+this.y); - ods.update("parent", "fish3X", FP); + ods.update("local", "fish", FP); }