view src/main/java/alice/test/topology/aquarium/fx/SendDataOthers.java @ 384:56d4f93a3921 multicast

add RegisterList
author sugi
date Wed, 11 Jun 2014 15:49:59 +0900
parents 878d397904da
children
line wrap: on
line source

package alice.test.topology.aquarium.fx;

import java.util.List;

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

public class SendDataOthers extends CodeSegment {
	// this CodeSegment is bad.
	
	private Receiver info = ids.create(CommandType.PEEK);
	private Receiver info1; // should use dataSegment
	private String key;     // should use dataSegment
	
	public SendDataOthers(Receiver r, String key){
		this.key = key;
		info1 = r;
		info.setKey("_CLIST");
	}
	
	@Override
	public void run() {
		@SuppressWarnings("unchecked")
		List<String> nodes = info.asClass(List.class);
		for (String node : nodes) {
			if (!info1.from.equals(node))
				ods.put(node, key, info1.getVal());
		}
	}

}