/// <summary>for testing purposes only</summary> public static void Main(string[] args) { object[] a1 = new object[] { "a", "b" }; object[] a2 = new object[] { "a", "b" }; System.Console.Out.WriteLine(Arrays.Equals(a1, a2)); GeneralizedCounter <string> gc = new GeneralizedCounter <string>(3); gc.IncrementCount(Arrays.AsList(new string[] { "a", "j", "x" }), 3.0); gc.IncrementCount(Arrays.AsList(new string[] { "a", "l", "x" }), 3.0); gc.IncrementCount(Arrays.AsList(new string[] { "b", "k", "y" }), 3.0); gc.IncrementCount(Arrays.AsList(new string[] { "b", "k", "z" }), 3.0); System.Console.Out.WriteLine("incremented counts."); System.Console.Out.WriteLine(gc.DumpKeys()); System.Console.Out.WriteLine("string representation of generalized counter:"); System.Console.Out.WriteLine(gc.ToString()); gc.PrintKeySet(); System.Console.Out.WriteLine("entry set:\n" + gc.EntrySet()); ArrayPrintDouble(gc.GetCounts(Arrays.AsList(new string[] { "a", "j", "x" }))); ArrayPrintDouble(gc.GetCounts(Arrays.AsList(new string[] { "a", "j", "z" }))); ArrayPrintDouble(gc.GetCounts(Arrays.AsList(new string[] { "b", "k", "w" }))); ArrayPrintDouble(gc.GetCounts(Arrays.AsList(new string[] { "b", "k", "z" }))); GeneralizedCounter <string> gc1 = gc.Conditionalize(Arrays.AsList(new string[] { "a" })); gc1.IncrementCount(Arrays.AsList(new string[] { "j", "x" })); gc1.IncrementCount2D("j", "z"); GeneralizedCounter <string> gc2 = gc1.Conditionalize(Arrays.AsList(new string[] { "j" })); gc2.IncrementCount1D("x"); System.Console.Out.WriteLine("Pretty-printing gc after incrementing gc1:"); gc.PrettyPrint(); System.Console.Out.WriteLine("Total: " + gc.TotalCount()); gc1.PrintKeySet(); System.Console.Out.WriteLine("another entry set:\n" + gc1.EntrySet()); ClassicCounter <IList <string> > c = gc.CounterView(); System.Console.Out.WriteLine("string representation of counter view:"); System.Console.Out.WriteLine(c.ToString()); double d1 = c.GetCount(Arrays.AsList(new string[] { "a", "j", "x" })); double d2 = c.GetCount(Arrays.AsList(new string[] { "a", "j", "w" })); System.Console.Out.WriteLine(d1 + " " + d2); ClassicCounter <IList <string> > c1 = gc1.CounterView(); System.Console.Out.WriteLine("Count of {j,x} -- should be 3.0\t" + c1.GetCount(Arrays.AsList(new string[] { "j", "x" }))); System.Console.Out.WriteLine(c.KeySet() + " size " + c.KeySet().Count); System.Console.Out.WriteLine(c1.KeySet() + " size " + c1.KeySet().Count); System.Console.Out.WriteLine(c1.Equals(c)); System.Console.Out.WriteLine(c.Equals(c1)); System.Console.Out.WriteLine(c.Equals(c)); System.Console.Out.WriteLine("### testing equality of regular Counter..."); ClassicCounter <string> z1 = new ClassicCounter <string>(); ClassicCounter <string> z2 = new ClassicCounter <string>(); z1.IncrementCount("a1"); z1.IncrementCount("a2"); z2.IncrementCount("b"); System.Console.Out.WriteLine(z1.Equals(z2)); System.Console.Out.WriteLine(z1.ToString()); System.Console.Out.WriteLine(z1.KeySet().ToString()); }