// Path: colormine/src/main/org/colormine/image/profile/Profile.java
// public interface Profile<K> {
// 	/*
// 	 * Tracks an item
// 	 */
// 	void put(K key);
// 
// 	/*
// 	 * Tracks an item
// 	 */
// 	void put(K key, int count);
// 
// 	/*
// 	 * Returns the number of times an item has been recorded
// 	 */
// 	int get(K key);
// 
// 	/*
// 	 * Returns the sum of all items that have been recorded
// 	 */
// 	int getTotal();
// 
// 	/*
// 	 * Returns the count of all distinct items that have been recorded
// 	 */
// 	int size();
// 
// 	Set<Entry<K, Integer>> entrySet();
// 
// 	Set<K> keySet();
// 
// }


import java.awt.Color;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.colormine.image.profile.Profile;
import org.json.JSONException;
import org.json.JSONObject;
package org.colormine.servlet;




public class ServletOutput {

	static void write(HttpServletResponse response, double data, String key) throws IOException {
		write(response, createJsonData(data, key));
	}

	static void write(HttpServletResponse response, String data, String key) throws IOException {
		write(response, createJsonData(data, key));
	}

	static void write(HttpServletResponse response, Map<Color, Integer> data) throws IOException {
		Map<String, String> stringData = convertToSerializable(data);
		JSONObject json = new JSONObject(stringData);
		write(response, json);
	}

// Path: colormine/src/main/org/colormine/image/profile/Profile.java
// public interface Profile<K> {
// 	/*
// 	 * Tracks an item
// 	 */
// 	void put(K key);
// 
// 	/*
// 	 * Tracks an item
// 	 */
// 	void put(K key, int count);
// 
// 	/*
// 	 * Returns the number of times an item has been recorded
// 	 */
// 	int get(K key);
// 
// 	/*
// 	 * Returns the sum of all items that have been recorded
// 	 */
// 	int getTotal();
// 
// 	/*
// 	 * Returns the count of all distinct items that have been recorded
// 	 */
// 	int size();
// 
// 	Set<Entry<K, Integer>> entrySet();
// 
// 	Set<K> keySet();
// 
// }


// Path: demo/src/org/colormine/servlet/ServletOutput.java
import java.awt.Color;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.colormine.image.profile.Profile;
import org.json.JSONException;
import org.json.JSONObject;

package org.colormine.servlet;




public class ServletOutput {

	static void write(HttpServletResponse response, double data, String key) throws IOException {
		write(response, createJsonData(data, key));
	}

	static void write(HttpServletResponse response, String data, String key) throws IOException {
		write(response, createJsonData(data, key));
	}

	static void write(HttpServletResponse response, Map<Color, Integer> data) throws IOException {
		Map<String, String> stringData = convertToSerializable(data);
		JSONObject json = new JSONObject(stringData);
		write(response, json);
	}

	static void write(HttpServletResponse response, Profile<Color> profile) throws IOException {