public override void VisitMatAdditionOperationElement(MatAddition element) { VisitElement(element.getLhs()); VisitElement(element.getRhs()); Console.Write("matrix addition"); }
public override void VisitMatAdditionOperationElement(MatAddition element) { //VisitElement(element.getLhs()); //VisitElement(element.getRhs()); operation = "+"; resultMessage += "performing matrix addition element" + "\n"; int index = 0, row = 0, column = 0; indicate = 2; VisitElement(element.getLhs()); indicate = 1; VisitElement(element.getRhs()); indicate = -1; String value = "0"; operation = "+"; CharEnumerator la = larr.GetEnumerator(); CharEnumerator ra = rarr.GetEnumerator(); la.MoveNext(); ra.MoveNext(); s = null; left = new int[ArrRow(larr), ArrColumn(larr)]; right = new int[ArrRow(rarr), ArrColumn(rarr)]; resrows = ArrRow(larr); rescolumns = ArrColumn(rarr); collim = ArrColumn(larr); while (index != larr.Length) { if (la.Current.CompareTo(']') == 0) { left[row, column] = int.Parse(value); row += 1; column = 0; value = "0"; } if (la.Current.CompareTo(',') != 0 && la.Current.CompareTo('[') != 0 && la.Current.CompareTo(']') != 0) { //String.Concat(value,value,la.Current.ToString()); value = value + la.Current.ToString(); } if (la.Current.CompareTo(',') == 0 && la.Current.CompareTo('[') != 0 && la.Current.CompareTo(']') != 0) { left[row, column] = int.Parse(value); column++; value = "0"; } index++; la.MoveNext(); } index = 0; row = 0; column = 0; value = "0"; while (index != rarr.Length) { if (ra.Current.CompareTo(']') == 0) { right[row, column] = int.Parse(value); row += 1; column = 0; value = "0"; } if (ra.Current.CompareTo(',') != 0 && ra.Current.CompareTo('[') != 0 && ra.Current.CompareTo(']') != 0) { //String.Concat(value,value,la.Current.ToString()); value = value + ra.Current.ToString(); } if (ra.Current.CompareTo(',') == 0 && ra.Current.CompareTo('[') != 0 && ra.Current.CompareTo(']') != 0) { right[row, column] = int.Parse(value); column++; value = "0"; } index++; ra.MoveNext(); } res = new int[resrows, rescolumns]; }