private void init_groups() { int num = 0; this.group = new List <List <DTrans> >(); int count = this.spec.dtrans_list.Count; this.ingroup = new int[count]; for (int i = 0; i < count; i++) { bool flag = false; DTrans dTrans = this.spec.dtrans_list[i]; for (int j = 0; j < num; j++) { List <DTrans> list = this.group[j]; DTrans dTrans2 = list[0]; for (int k = 1; k < list.Count; k++) { } if (dTrans2.GetAccept() == dTrans.GetAccept()) { list.Add(dTrans); this.ingroup[i] = j; flag = true; break; } } if (!flag) { List <DTrans> list2 = new List <DTrans>(); list2.Add(dTrans); this.ingroup[i] = this.group.Count; this.group.Add(list2); num++; } } }
/* * Function: init_groups */ private void init_groups() { bool group_found; int group_count = 0; group = new ArrayList(); int size = spec.dtrans_list.Count; ingroup = new int[size]; for (int i = 0; i < size; ++i) { group_found = false; DTrans dtrans = (DTrans)spec.dtrans_list[i]; #if DEBUG Utility.assert(i == dtrans.GetLabel()); Utility.assert(false == group_found); Utility.assert(group_count == group.Count); #endif for (int j = 0; j < group_count; j++) { ArrayList dtrans_group = (ArrayList)group[j]; #if DEBUG Utility.assert(false == group_found); Utility.assert(0 < dtrans_group.Count); #endif DTrans first = (DTrans)dtrans_group[0]; #if DEBUG int s = dtrans_group.Count; Utility.assert(0 < s); for (int k = 1; k < s; k++) { DTrans check = (DTrans)dtrans_group[k]; Utility.assert(check.GetAccept() == first.GetAccept()); } #endif if (first.GetAccept() == dtrans.GetAccept()) { dtrans_group.Add(dtrans); ingroup[i] = j; group_found = true; #if DEBUG Utility.assert(j == ingroup[dtrans.GetLabel()]); #endif break; } } if (!group_found) { ArrayList dtrans_group = new ArrayList(); dtrans_group.Add(dtrans); ingroup[i] = group.Count; group.Add(dtrans_group); group_count++; } } #if OLD_DUMP_DEBUG Console.WriteLine("Initial grouping:"); pgroups(); Console.WriteLine(""); #endif }
private void reduce() { int count = this.spec.dtrans_list.Count; BitArray bitArray = new BitArray(count); this.spec.anchor_array = new int[count]; this.spec.accept_list = new List <Accept>(); for (int i = 0; i < count; i++) { DTrans dTrans = this.spec.dtrans_list[i]; this.spec.accept_list.Add(dTrans.GetAccept()); this.spec.anchor_array[i] = dTrans.GetAnchor(); dTrans.SetAccept(null); } this.spec.col_map = new int[this.spec.dtrans_ncols]; for (int i = 0; i < this.spec.dtrans_ncols; i++) { this.spec.col_map[i] = -1; } int num = 0; while (true) { int i; for (i = 0; i < num; i++) { } i = num; while (i < this.spec.dtrans_ncols && -1 != this.spec.col_map[i]) { i++; } if (i >= this.spec.dtrans_ncols) { break; } if (i >= bitArray.Length) { bitArray.Length = i + 1; } bitArray.Set(i, true); this.spec.col_map[i] = num; for (int j = i + 1; j < this.spec.dtrans_ncols; j++) { if (-1 == this.spec.col_map[j] && this.col_equiv(i, j)) { this.spec.col_map[j] = num; } } num++; } int num2 = 0; for (int i = 0; i < this.spec.dtrans_ncols; i++) { if (i >= bitArray.Length) { bitArray.Length = i + 1; } if (bitArray.Get(i)) { num2++; bitArray.Set(i, false); int j = this.spec.col_map[i]; if (j != i) { this.col_copy(j, i); } } } this.spec.dtrans_ncols = num; int count2 = this.spec.dtrans_list.Count; this.spec.row_map = new int[count2]; for (int i = 0; i < count2; i++) { this.spec.row_map[i] = -1; } int num3 = 0; while (true) { int i; for (i = 0; i < num3; i++) { } i = num3; while (i < count2 && -1 != this.spec.row_map[i]) { i++; } if (i >= count2) { break; } bitArray.Set(i, true); this.spec.row_map[i] = num3; for (int j = i + 1; j < count2; j++) { if (-1 == this.spec.row_map[j] && this.row_equiv(i, j)) { this.spec.row_map[j] = num3; } } num3++; } num2 = 0; for (int i = 0; i < count2; i++) { if (bitArray.Get(i)) { num2++; bitArray.Set(i, false); int j = this.spec.row_map[i]; if (j != i) { this.row_copy(j, i); } } } this.spec.dtrans_list.RemoveRange(num3, count - num3); }