Changeset 6387 for branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters
- Timestamp:
- 06/08/11 10:42:57 (14 years ago)
- Location:
- branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
r5817 r6387 73 73 FormatBegin(node, strBuilder); 74 74 75 if (node.Subtree sCount > 0) {75 if (node.SubtreeCount > 0) { 76 76 strBuilder.Append(FormatRecursively(node.GetSubtree(0))); 77 77 } … … 91 91 strBuilder.Append(@" \left( "); 92 92 } else if (node.Symbol is Subtraction) { 93 if (node.Subtree sCount == 1) {93 if (node.SubtreeCount == 1) { 94 94 strBuilder.Append(@"- \left("); 95 95 } else { … … 98 98 } else if (node.Symbol is Multiplication) { 99 99 } else if (node.Symbol is Division) { 100 if (node.Subtree sCount == 1) {100 if (node.SubtreeCount == 1) { 101 101 strBuilder.Append(@" \cfrac{1}{"); 102 102 } else { … … 105 105 } else if (node.Symbol is Average) { 106 106 // skip output of (1/1) if only one subtree 107 if (node.Subtree sCount > 1) {108 strBuilder.Append(@" \cfrac{1}{" + node.Subtree sCount + @"}");107 if (node.SubtreeCount > 1) { 108 strBuilder.Append(@" \cfrac{1}{" + node.SubtreeCount + @"}"); 109 109 } 110 110 strBuilder.Append(@" \left("); … … 246 246 } else if (node.Symbol is Division) { 247 247 strBuilder.Append("} "); 248 if (node.Subtree sCount > 1)248 if (node.SubtreeCount > 1) 249 249 strBuilder.Append("{1} "); 250 for (int i = 1; i < node.Subtree sCount; i++) {250 for (int i = 1; i < node.SubtreeCount; i++) { 251 251 strBuilder.Append(" } "); 252 252 } -
branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs
r5809 r6387 106 106 107 107 if (symbol is Addition) { 108 for (int i = 0; i < node.Subtree sCount; i++) {108 for (int i = 0; i < node.SubtreeCount; i++) { 109 109 if (i > 0) stringBuilder.Append("+"); 110 110 stringBuilder.Append(FormatRecursively(node.GetSubtree(i))); … … 112 112 } else if (symbol is And) { 113 113 stringBuilder.Append("(("); 114 for (int i = 0; i < node.Subtree sCount; i++) {114 for (int i = 0; i < node.SubtreeCount; i++) { 115 115 if (i > 0) stringBuilder.Append("&"); 116 116 stringBuilder.Append("(("); … … 121 121 } else if (symbol is Average) { 122 122 stringBuilder.Append("(1/"); 123 stringBuilder.Append(node.Subtree sCount);123 stringBuilder.Append(node.SubtreeCount); 124 124 stringBuilder.Append(")*("); 125 for (int i = 0; i < node.Subtree sCount; i++) {125 for (int i = 0; i < node.SubtreeCount; i++) { 126 126 if (i > 0) stringBuilder.Append("+"); 127 127 stringBuilder.Append("("); … … 138 138 stringBuilder.Append(")"); 139 139 } else if (symbol is Division) { 140 if (node.Subtree sCount == 1) {140 if (node.SubtreeCount == 1) { 141 141 stringBuilder.Append("1/"); 142 142 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); … … 144 144 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 145 145 stringBuilder.Append("/("); 146 for (int i = 1; i < node.Subtree sCount; i++) {146 for (int i = 1; i < node.SubtreeCount; i++) { 147 147 if (i > 1) stringBuilder.Append("*"); 148 148 stringBuilder.Append(FormatRecursively(node.GetSubtree(i))); … … 187 187 stringBuilder.Append(")"); 188 188 } else if (symbol is Multiplication) { 189 for (int i = 0; i < node.Subtree sCount; i++) {189 for (int i = 0; i < node.SubtreeCount; i++) { 190 190 if (i > 0) stringBuilder.Append("*"); 191 191 stringBuilder.Append(FormatRecursively(node.GetSubtree(i))); … … 197 197 } else if (symbol is Or) { 198 198 stringBuilder.Append("(("); 199 for (int i = 0; i < node.Subtree sCount; i++) {199 for (int i = 0; i < node.SubtreeCount; i++) { 200 200 if (i > 0) stringBuilder.Append("|"); 201 201 stringBuilder.Append("(("); … … 209 209 stringBuilder.Append(")"); 210 210 } else if (symbol is Subtraction) { 211 if (node.Subtree sCount == 1) {211 if (node.SubtreeCount == 1) { 212 212 stringBuilder.Append("-1*"); 213 213 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 214 214 } else { 215 215 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 216 for (int i = 1; i < node.Subtree sCount; i++) {216 for (int i = 1; i < node.SubtreeCount; i++) { 217 217 stringBuilder.Append("-"); 218 218 stringBuilder.Append(FormatRecursively(node.GetSubtree(i)));
Note: See TracChangeset
for help on using the changeset viewer.