view src/alice/test/topology/aquarium/SendLocation.java @ 216:21bd8af1cf26 working

change asClass method
author one
date Wed, 27 Mar 2013 19:38:33 +0900
parents b5daccf36104
children b5c642ba998e
line wrap: on
line source

package alice.test.topology.aquarium;

import alice.codesegment.CodeSegment;
import alice.datasegment.CommandType;
import alice.datasegment.Receiver;


public class SendLocation extends CodeSegment {
	
	private Receiver position = ids.create(CommandType.PEEK);
	float x;
	float y;
	float z;
	
	public SendLocation(float x,float y,float z){
		this.x = x;
		this.y = y;
		this.z = z;
		position.setKey("local", "fish");
	}
	
	@Override
	public void run() {
		FishPoint fp = this.position.data.asClass(FishPoint.class);
		fp.setXYZ(fp.getX()+x, fp.getY()+y, fp.getZ()+z);
		ods.update("local", "fish", fp);
		
	}

}