package org.usfirst.frc.team2503.r2016;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.usfirst.frc.team2503.r2016.debug.Logger;
import org.usfirst.frc.team2503.r2016.debug.Logger.LoggerPrintStream;

/**
 * You can use this class for testing non-WPIlib code on your machine.
 */
public class Main {
	
	public static void main(String[] args) {
		

		File csvDataFile = new File("data.csv");
		
		Logger.addPrintStream("ayy", new LoggerPrintStream(System.out));
		Logger.addPrintStream("ayy", new LoggerPrintStream(System.err));
		Logger.addPrintStream("lmao", new LoggerPrintStream(System.err));
		Logger.addPrintStream("data", new LoggerPrintStream(System.out));

		try {
			Logger.addPrintStream("data-raw", new LoggerPrintStream(csvDataFile));
		} catch(FileNotFoundException e) {
			try {
				csvDataFile.createNewFile();
			} catch(IOException ioe) {
				ioe.printStackTrace();
			}
		}
		
		Logger.println("ayy", "foo");
		Logger.println("lmao", "test");
		
		{
			Logger.println("data", 1.0 + 2.0);
			Logger.println("data-raw", 1.0 + 2.0, false);
		}
		
	}
	
}

@@ -365,753 +365,675 @@
 tic 
-void main(String%5B%5D args) %7B%0A%09%09%0A%0A%09%09File csvDataFile = new File(%22data.csv%22);%0A%09%09%0A%09%09Logger.addPrintStream(%22ayy%22, new LoggerPrintStream(System.out));%0A%09%09Logger.addPrintStream(%22ayy%22, new LoggerPrintStream(System.err));%0A%09%09Logger.addPrintStream(%22lmao%22, new LoggerPrintStream(System.err));%0A%09%09Logger.addPrintStream(%22data%22, new LoggerPrintStream(System.out));%0A%0A%09%09try %7B%0A%09%09%09Logger.addPrintStream(%22data-raw%22, new LoggerPrintStream(csvDataFile)
+double%5B%5D VALUE_RANGE = %7B0.0, 1.0%7D;%0A%09public static double%5B%5D DEGREE_RANGE = %7B-91.0, 87.0%7D;%0A%0A%09public static double MAPPING_SLOPE = (DEGREE_RANGE%5B1%5D - DEGREE_RANGE%5B0%5D) / (VALUE_RANGE%5B1%5D - VALUE_RANGE%5B0%5D);%0A%09%0A%09public static double valueToDegrees(double value) %7B%0A%09%09return DEGREE_RANGE%5B0%5D + MAPPING_SLOPE * (value - VALUE_RANGE%5B0%5D
 );%0A
-%09
 %09%7D
- catch(FileNotFoundException e) %7B%0A%09%09%09try %7B%0A%09%09%09%09csvDataFile.createNewFile();%0A%09%09%09%7D catch(IOException ioe) %7B%0A%09%09%09%09ioe.printStackTrace(
+%0A%09%0A%09public static double degreesToValue(double degrees) %7B%0A%09%09return VALUE_RANGE%5B0%5D + (1.0 / MAPPING_SLOPE) * (degrees - DEGREE_RANGE%5B0%5D
 );%0A
-%09%09
 %09%7D%0A%09
-%09%7D%0A%09%09%0A%09%09Logger.println(%22ayy%22, %22foo%22);%0A%09%09Logger.println(%22lmao%22, %22test%22);%0A%09%09%0A%09%09%7B%0A%09%09%09Logger.println(%22data%22, 1.0 + 2.0);%0A%09%09%09Logger.println(%22data-raw%22, 1.0 + 2.0, false
+%0A%09public static void main(String%5B%5D args) %7B%0A%09%09for(double d = 0.0; d %3C= 1.0; d += 0.125) %7B%09%0A%09%09%09double degrees = valueToDegrees(d);%0A%09%09%09System.out.println(degrees + %22 - %22 + degreesToValue(degrees)
 );%0A%09%09%7D%0A
-%09%09%0A
 %09%7D%0A%09

Add math testing for mapping values into ranges