package rainbowPackage;

import javafx.scene.paint.Color;

public class ColorArrayReverser
{
	ColorTooSimilar colorTooSimilar = new ColorTooSimilar();
	TransparencySlider transparencySlider = new TransparencySlider();
	int b = 0;
	double c = 0;
	public Color[] colorArray;
	public ColorArrayReverser()
	{
		colorArray = new Color[0];
	}
	public ColorArrayReverser(int Length)
	{
		colorArray = new Color[Length];
	}
	public ColorArrayReverser(Color[] ColorArray)
	{
		colorArray = ColorArray;
	}
	public Color[] ReverseArray(Color[] ColorArray)
	{
		colorArray = new Color[ColorArray.length];
		c = ColorArray.length / 2.;
		if ( Math.floor(c) != c )
			for (int a = 0; a < ColorArray.length; a++)
			{
				b = ColorArray.length - 1 - a;
				if ( b != a )
					colorArray[b] = ColorArray[a];
				else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], ColorArray[b]) )
					colorArray[b] = ColorArray[a];
				else
				{
					transparencySlider.TransparencySliderFunction(2, 1, ColorArray[a], ColorArray[b]);
					if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), VibrantColors.Pink.ToFXColor()) )
						colorArray[b] = VibrantColors.Pink.ToFXColor();
					else if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), VibrantColors.NeonGreen.ToFXColor()) )
						colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
					else //if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), VibrantColors.OxylBlue.ToFXColor()) )
						colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
				}
			}
		else
			for (int a = 0; a < ColorArray.length; a++)
			{
				b = ColorArray.length - 1 - a;
				if ( !( a <= c && a >= c - 1 ) )
					colorArray[b] = ColorArray[a];
				else
				{
					if ( a != c)
						if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.NeonGreen.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.NeonGreen.ToFXColor()) )
							colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.OxylBlue.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.OxylBlue.ToFXColor()) )
							colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Pink.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Pink.ToFXColor()) )
							colorArray[b] = VibrantColors.Pink.ToFXColor();
						else //if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Brown.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Brown.ToFXColor()) )
							colorArray[b] = VibrantColors.Brown.ToFXColor();
						else
						if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.OxylBlue.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.OxylBlue.ToFXColor()) )
							colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.NeonGreen.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.NeonGreen.ToFXColor()) )
							colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Brown.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Brown.ToFXColor()) )
							colorArray[b] = VibrantColors.Brown.ToFXColor();
						else //if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Pink.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Pink.ToFXColor()) )
							colorArray[b] = VibrantColors.Pink.ToFXColor();
				}
			}
		return colorArray;
	}
	public Color[] ReverseArray(Color[] ColorArray, Color ReplacementColor)
	{
		colorArray = new Color[ColorArray.length];
		c = ColorArray.length / 2.;
		if ( Math.floor(c) != c )
			for (int a = 0; a < ColorArray.length; a++)
			{
				b = ColorArray.length - 1 - a;
				if ( b != a )
					colorArray[b] = ColorArray[a];
				else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], ColorArray[b]) )
					colorArray[b] = ColorArray[a];
				else
				{
					transparencySlider.TransparencySliderFunction(2, 1, ColorArray[a], ColorArray[b]);
					if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), ReplacementColor) )
						colorArray[b] = ReplacementColor;
					else if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), VibrantColors.NeonGreen.ToFXColor()) )
						colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
					else if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), VibrantColors.OxylBlue.ToFXColor()) )
						colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
					else //if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), VibrantColors.Pink.ToFXColor()) )
						colorArray[b] = VibrantColors.Pink.ToFXColor();
				}
			}
		else
			for (int a = 0; a < ColorArray.length; a++)
			{
				b = ColorArray.length - 1 - a;
				if ( !( a <= c && a >= c - 1 ) )
					colorArray[b] = ColorArray[a];
				else
				{
					if ( a != c)
						if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], ReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], ReplacementColor) )
							colorArray[b] = ReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.NeonGreen.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.NeonGreen.ToFXColor()) )
							colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.OxylBlue.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.OxylBlue.ToFXColor()) )
							colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Pink.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Pink.ToFXColor()) )
							colorArray[b] = VibrantColors.Pink.ToFXColor();
						else //if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Brown.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Brown.ToFXColor()) )
							colorArray[b] = VibrantColors.Brown.ToFXColor();
					else
						if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], ReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], ReplacementColor) )
							colorArray[b] = ReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.OxylBlue.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.OxylBlue.ToFXColor()) )
							colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.NeonGreen.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.NeonGreen.ToFXColor()) )
							colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Brown.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Brown.ToFXColor()) )
							colorArray[b] = VibrantColors.Brown.ToFXColor();
						else //if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Pink.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Pink.ToFXColor()) )
							colorArray[b] = VibrantColors.Pink.ToFXColor();
				}
			}
		return colorArray;
	}
	public Color[] ReverseArray(Color[] ColorArray, Color FirstReplacementColor, Color SecondReplacementColor)
	{
		colorArray = new Color[ColorArray.length];
		c = ColorArray.length / 2.;
		if ( Math.floor(c) != c )
			for (int a = 0; a < ColorArray.length; a++)
			{
				b = ColorArray.length - 1 - a;
				if ( b != a )
					colorArray[b] = ColorArray[a];
				else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], ColorArray[b]) )
					colorArray[b] = ColorArray[a];
				else
				{
					transparencySlider.TransparencySliderFunction(2, 1, ColorArray[a], ColorArray[b]);
					if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), FirstReplacementColor) )
						colorArray[b] = FirstReplacementColor;
					else if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), SecondReplacementColor) )
						colorArray[b] = SecondReplacementColor;
					else if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), VibrantColors.NeonGreen.ToFXColor()) )
						colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
					else if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), VibrantColors.OxylBlue.ToFXColor()) )
						colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
					else //if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), VibrantColors.Pink.ToFXColor()) )
						colorArray[b] = VibrantColors.Pink.ToFXColor();
				}
			}
		else
			for (int a = 0; a < ColorArray.length; a++)
			{
				b = ColorArray.length - 1 - a;
				if ( !( a <= c && a >= c - 1 ) )
					colorArray[b] = ColorArray[a];
				else
				{
					if ( a != c)
						if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], FirstReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], FirstReplacementColor) )
							colorArray[b] = FirstReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], SecondReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], SecondReplacementColor) )
							colorArray[b] = SecondReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.NeonGreen.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.NeonGreen.ToFXColor()) )
							colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.OxylBlue.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.OxylBlue.ToFXColor()) )
							colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Pink.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Pink.ToFXColor()) )
							colorArray[b] = VibrantColors.Pink.ToFXColor();
						else //if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Brown.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Brown.ToFXColor()) )
							colorArray[b] = VibrantColors.Brown.ToFXColor();
					else
						if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], SecondReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], SecondReplacementColor) )
							colorArray[b] = SecondReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], FirstReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], FirstReplacementColor) )
							colorArray[b] = FirstReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.OxylBlue.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.OxylBlue.ToFXColor()) )
							colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.NeonGreen.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.NeonGreen.ToFXColor()) )
							colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Brown.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Brown.ToFXColor()) )
							colorArray[b] = VibrantColors.Brown.ToFXColor();
						else //if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Pink.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Pink.ToFXColor()) )
							colorArray[b] = VibrantColors.Pink.ToFXColor();
				}
			}
		return colorArray;
	}
	public Color[] ReverseArray(Color[] ColorArray, Color FirstReplacementColor, Color SecondReplacementColor, Color ThirdReplacementColor)
	{
		colorArray = new Color[ColorArray.length];
		c = ColorArray.length / 2.;
		if ( Math.floor(c) != c )
			for (int a = 0; a < ColorArray.length; a++)
			{
				b = ColorArray.length - 1 - a;
				if ( b != a )
					colorArray[b] = ColorArray[a];
				else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], ColorArray[b]) )
					colorArray[b] = ColorArray[a];
				else
				{
					transparencySlider.TransparencySliderFunction(2, 1, ColorArray[a], ColorArray[b]);
					if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), FirstReplacementColor) )
						colorArray[b] = FirstReplacementColor;
					else if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), SecondReplacementColor) )
						colorArray[b] = SecondReplacementColor;
					else if ( !colorTooSimilar.ColorTooSimilarFunction(transparencySlider.ToFXColor(), ThirdReplacementColor) )
						colorArray[b] = ThirdReplacementColor;
					else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.NeonGreen.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.NeonGreen.ToFXColor()) )
						colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
					else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.OxylBlue.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.OxylBlue.ToFXColor()) )
						colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
					else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Pink.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Pink.ToFXColor()) )
						colorArray[b] = VibrantColors.Pink.ToFXColor();
					else //if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Brown.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Brown.ToFXColor()) )
						colorArray[b] = VibrantColors.Brown.ToFXColor();
				}
			}
		else
			for (int a = 0; a < ColorArray.length; a++)
			{
				b = ColorArray.length - 1 - a;
				if ( !( a <= c && a >= c - 1 ) )
					colorArray[b] = ColorArray[a];
				else
				{
					if ( a != c)
						if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], FirstReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], FirstReplacementColor) )
							colorArray[b] = FirstReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], SecondReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], SecondReplacementColor) )
							colorArray[b] = SecondReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], ThirdReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], ThirdReplacementColor) )
							colorArray[b] = ThirdReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.NeonGreen.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.NeonGreen.ToFXColor()) )
							colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.OxylBlue.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.OxylBlue.ToFXColor()) )
							colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Pink.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Pink.ToFXColor()) )
							colorArray[b] = VibrantColors.Pink.ToFXColor();
						else //if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Brown.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Brown.ToFXColor()) )
							colorArray[b] = VibrantColors.Brown.ToFXColor();
					else
						if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], SecondReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], SecondReplacementColor) )
							colorArray[b] = SecondReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], ThirdReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], ThirdReplacementColor) )
							colorArray[b] = ThirdReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], FirstReplacementColor) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], FirstReplacementColor) )
							colorArray[b] = FirstReplacementColor;
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.OxylBlue.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.OxylBlue.ToFXColor()) )
							colorArray[b] = VibrantColors.OxylBlue.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.NeonGreen.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.NeonGreen.ToFXColor()) )
							colorArray[b] = VibrantColors.NeonGreen.ToFXColor();
						else if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Brown.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Brown.ToFXColor()) )
							colorArray[b] = VibrantColors.Brown.ToFXColor();
						else //if ( !colorTooSimilar.ColorTooSimilarFunction(ColorArray[b], VibrantColors.Pink.ToFXColor()) && !colorTooSimilar.ColorTooSimilarFunction(ColorArray[a], VibrantColors.Pink.ToFXColor()) )
							colorArray[b] = VibrantColors.Pink.ToFXColor();
				}
			}
		return colorArray;
	}
	public int Length()
	{
		return colorArray.length;
	}
	public void set(Color[] ColorArray) { colorArray = ColorArray; }//14th Square DiagnosticsClass.java
	public Color[] get() { return colorArray; }
}