// quick test static public void Main(String[] args) { XEquivalenceClass foo1 = new XEquivalenceClass("NONE"); String[][] tests = { new String[] { "b", "a1" }, new String[] { "b", "c" }, new String[] { "a1", "c" }, new String[] { "d", "e" }, new String[] { "e", "f" }, new String[] { "c", "d" } }; for (int i = 0; i < tests.Length; ++i) { System.Console.Out.WriteLine("Adding: " + tests[i][0] + ", " + tests[i][1]); foo1.Add(tests[i][0], tests[i][1], ((int)(i))); for (IIterator it = new ILOG.J2CsMapping.Collections.IteratorAdapter(foo1.GetExplicitItems().GetEnumerator()); it.HasNext();) { Object item = it.Next(); System.Console.Out.WriteLine("\t" + item + ";\t" + foo1.GetSample(item) + ";\t" + foo1.GetEquivalences(item)); System.Console.Out.WriteLine("\t\t" + foo1.GetReasons(item, foo1.GetSample(item))); } } }
/// <summary> /// Add all the information from the other class /// </summary> /// public XEquivalenceClass AddAll(XEquivalenceClass other) { // For now, does the simple, not optimized version for (IIterator it = new ILOG.J2CsMapping.Collections.IteratorAdapter(new ILOG.J2CsMapping.Collections.ListSet(other.obj_obj_reasons.Keys).GetEnumerator()); it .HasNext();) { Object a = it.Next(); IDictionary obj_reasons = (IDictionary)ILOG.J2CsMapping.Collections.Collections.Get(other.obj_obj_reasons, a); for (IIterator it2 = new ILOG.J2CsMapping.Collections.IteratorAdapter(new ILOG.J2CsMapping.Collections.ListSet(obj_reasons.Keys).GetEnumerator()); it2.HasNext();) { Object b = it2.Next(); ILOG.J2CsMapping.Collections.ISet reasons = (ISet)ILOG.J2CsMapping.Collections.Collections.Get(obj_reasons, b); for (IIterator it3 = new ILOG.J2CsMapping.Collections.IteratorAdapter(reasons.GetEnumerator()); it3.HasNext();) { Object reason = it3.Next(); Add(a, b, reason); } } } return(this); }