public double[] NormalizeMonth(int month) { var eq = new Equilateral(12, -1, 1); return eq.Encode(month); }
public double[] NormalizeSeconds(int Seconds) { var eq = new Equilateral(60, -1, 1); return eq.Encode(Seconds); }
public double[] NormalizeHour(int hour) { var eq = new Equilateral(24, -1, 1); return eq.Encode(hour); }
public double[] NormalizeDays(int days) { var eq = new Equilateral(31, -1, 1); return eq.Encode(days); }
public double[] NormalizeYear(int hour, int MaxYear) { var eq = new Equilateral(MaxYear, -1, 1); return eq.Encode(hour); }
public double[] NormalizeYear(int year) { var eq = new Equilateral(2011, -1, 1); return eq.Encode(year); }
public void TestDateNormalizeDaysEncode() { var eq = new Equilateral(DateTime.DaysInMonth(2012, 1), -1, 1); var encoded = eq.Encode(15); StringBuilder b = new StringBuilder(encoded.Length); for (int i = 0; i < encoded.Length; i++) { if (i < encoded.Length - 1) b.Append(encoded[i] + ","); else b.Append(encoded[i]); } Console.WriteLine("Encoded 15 to Equilaterable " + b.ToString()); Assert.IsNotNull(encoded, "Encoded is not null"); Assert.IsTrue(encoded[14].ToString() == "-0.984250984251476"); //Now we get the day back.. int res = eq.Decode(encoded); Console.WriteLine("Result decode == " + res); Assert.AreEqual(15, res, "Decoded back to 15"); }