Changeset 16359
- Timestamp:
- 12/10/18 16:34:32 (6 years ago)
- Location:
- trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Files:
-
- 2 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)); -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/InfixExpressionParser.cs
r16356 r16359 102 102 { "EXP", new Exponential()}, 103 103 { "LOG", new Logarithm()}, 104 { "POW", new Power() },104 { "POW", new Power() }, 105 105 { "ROOT", new Root()}, 106 106 { "SQR", new Square() },
Note: See TracChangeset
for help on using the changeset viewer.