view src/alice/test/topology/mergesort/ShowResult.java @ 151:98a1292ae8ef working

add merge sort
author sugi
date Thu, 29 Nov 2012 16:28:36 +0900
parents
children
line wrap: on
line source

package alice.test.topology.mergesort;

import java.util.List;

import org.msgpack.type.Value;

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

public class ShowResult extends CodeSegment{

	private Receiver info = ids.create(CommandType.PEEK);
	int keyNum;
	public ShowResult(int keyNum) {
		this.keyNum = keyNum;
		String key = Integer.toString(keyNum);
		info.setKey("local", key, 1);
		
	}

	@Override
	public void run() {
		System.out.println(System.currentTimeMillis() - StartSort.t +"ms");
		List<Value> list = info.asArray();
		for (int i =0; i+1< list.size();i++){
			if (list.get(i).asIntegerValue().getInt()>list.get(i+1).asIntegerValue().getInt()){
				System.out.println("MISS");
				System.exit(0);
			}
			//System.out.println(list.get(i).asIntegerValue().getInt()+",");
		}
		//System.out.println(list);
		System.exit(0);
	}

}