- Timestamp:
- 12/10/18 16:34:32 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs
r15583 r16359 62 62 if (node.SubtreeCount > 1) { 63 63 var token = GetToken(node.Symbol); 64 if (token == "+" || token == "-" || token == "OR" || token == "XOR") { 65 strBuilder.Append("("); 66 FormatRecursively(node.Subtrees.First(), strBuilder); 67 68 foreach (var subtree in node.Subtrees.Skip(1)) { 69 strBuilder.Append(" ").Append(token).Append(" "); 70 FormatRecursively(subtree, strBuilder); 71 } 72 strBuilder.Append(")"); 73 74 } else if (token == "*" || token == "/" || token == "AND") { 64 // operators 65 if (token == "+" || token == "-" || token == "OR" || token == "XOR" || 66 token == "*" || token == "/" || token == "AND" || 67 token == "^") { 75 68 strBuilder.Append("("); 76 69 FormatRecursively(node.Subtrees.First(), strBuilder); … … 184 177 185 178 private string GetToken(ISymbol symbol) { 186 var tok = InfixExpressionParser.knownSymbols.GetBySecond(symbol). SingleOrDefault();179 var tok = InfixExpressionParser.knownSymbols.GetBySecond(symbol).FirstOrDefault(); 187 180 if (tok == null) 188 181 throw new ArgumentException(string.Format("Unknown symbol {0} found.", symbol.Name));
Note: See TracChangeset
for help on using the changeset viewer.