/* * Copyright 2012 Phil Pratt-Szeliga and other contributors * http://chirrup.org/ * * See the file LICENSE for copying permission. */ package org.trifort.rootbeer.testcases.rootbeertest.serialization; import java.util.Map; import java.util.TreeMap; import org.trifort.rootbeer.runtime.Kernel; public class TreeMapRunOnGpu implements Kernel { private Map<Integer, String> m_map; public void gpuMethod() { m_map = new TreeMap<Integer, String>(); m_map.put(0, "a"); m_map.put(1, "b"); m_map.put(2, "c"); m_map.put(3, "d"); m_map.put(4, "e"); m_map.put(5, "f"); } public boolean compare(TreeMapRunOnGpu rhs) { if(m_map.size() != rhs.m_map.size()){ System.out.println("size"); return false; } for(Integer key : m_map.keySet()){ String lhs_value = m_map.get(key); if(rhs.m_map.containsKey(key) == false){ System.out.println("key not found"); return false; } String rhs_value = rhs.m_map.get(key); if(lhs_value.equals(rhs_value) == false){ System.out.println("value mismatch"); return false; } } return true; } }