view src/test/alice/jungle/codesegment/HashSetConvertTest.java @ 51:9e782b4eb06e

add HashSetConvertDataSegment
author one
date Sat, 13 Jul 2013 15:59:47 +0900
parents
children
line wrap: on
line source

package test.alice.jungle.codesegment;

import java.util.HashSet;

import org.msgpack.annotation.Message;

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

public class HashSetConvertTest extends CodeSegment {
	
	Receiver hash = ids.create(CommandType.TAKE);

	public HashSetConvertTest() {
		hash.setKey("hash");
	}
	
	public static void main(String[] args) {
		HashSetDataSegment h = new HashSetDataSegment();
		h.hash.add("test1");
		h.hash.add("test2");
		
		HashSetConvertTest cs = new HashSetConvertTest();
		cs.ods.put("hash", h);
	}
	
	public void run() {
		HashSetDataSegment h = hash.asClass(HashSetDataSegment.class);
		for(String s : h.hash ) {
			System.out.println("s : "+s);
		}
		System.exit(0);
	}
	
	@Message
	private static class HashSetDataSegment {
		public HashSet<String> hash = new HashSet<String>();		
		public HashSetDataSegment() {}
	}
}