view src/alice/test/topology/fishmodel/alpha/SendLocation.java @ 119:f84e1684c6be working

put NULL in CS
author sugi
date Thu, 26 Jul 2012 15:43:57 +0900
parents 9845b74063ec
children 117dad267a9b
line wrap: on
line source

package alice.test.topology.fishmodel.alpha;

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


public class SendLocation extends CodeSegment {
	
	public Receiver position = ids.create(CommandType.PEEK);
	float x;
	float y;
	float max = 3.3f;
	float min = -1.3f;
	
	public SendLocation(float x,float y){
		this.x = x;
		this.y = y;
	}
	
	@Override
	public void run() {
		FishPoint FP = this.position.asClass(FishPoint.class);
		
		FP.setXY(FP.getX()+this.x, FP.getY()+this.y);
		/*
		if (FP.getX()+this.x>max){
			FP.setXY(-1.0f, FP.getY()+this.y);
		} else if (FP.getX()+this.x< min){
			FP.setXY(max, FP.getY()+this.y);
		}
		else {
			FP.setXY(FP.getX()+this.x, FP.getY()+this.y);
		}
		*/
		
		ods.update("local", "fish", FP);
		
	}

}