view src/alice/test/topology/share/CheckNeedParentUpdate.java @ 107:a8f77957a477 working

create new model to share fish point
author sugi
date Tue, 10 Jul 2012 02:30:25 +0900
parents 37f3483a869b
children 53aff28cde6b
line wrap: on
line source

package alice.test.topology.share;

import alice.codesegment.CodeSegment;
import alice.datasegment.CommandType;
import alice.datasegment.Receiver;
import alice.test.topology.fishmodel.alpha.FishPoint;

public class CheckNeedParentUpdate extends CodeSegment {

	private Receiver parent = ids.create(CommandType.PEEK);
	private Receiver local;
	String key;
	
	public CheckNeedParentUpdate(String key ,Receiver local){
		this.key = key;
		this.local = local;
		this.parent.setKey("parent", this.key);
	}

	@Override
	public void run() {
		if (this.local.index > this.parent.index){
			System.out.println("parent is updated");
			ods.update("parent", this.key, this.local.asClass(FishPoint.class));
		}
		new CheckLocalIndex(this.key,this.local.index);
		
	}

}