Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/01/21 13:40:55 (3 years ago)
Author:
chaider
Message:

#3140

  • some more refactoring
  • added possibility to set value of num nodes in infix parser
  • changed displaying style of number
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs

    r17811 r18100  
    5454
    5555          var power = node.GetSubtree(1);
    56           if(power is ConstantTreeNode constNode && Math.Truncate(constNode.Value) == constNode.Value) {
     56          if(power is NumberTreeNode constNode && Math.Truncate(constNode.Value) == constNode.Value) {
    5757            strBuilder.Append(" ").Append(token).Append(" ").Append(constNode.Value.ToString(formatString, numberFormat));
    5858          } else {
     
    141141
    142142          if (!factorNode.Weight.IsAlmost(1.0)) strBuilder.Append(")");
    143         } else if (node.Symbol is Constant) {
    144           var constNode = node as ConstantTreeNode;
     143        } else if (node.Symbol is Number) {
     144          var constNode = node as NumberTreeNode;
    145145          if (constants == null && constNode.Value < 0) {
    146146            strBuilder.Append("(").Append(constNode.Value.ToString(formatString, numberFormat))
     
    204204    /// </summary>
    205205    /// <param name="symbolicExpressionTree">The tree representation of the expression.</param>
    206     /// <param name="numberFormat">Number format that should be used for numeric parameters (e.g. NumberFormatInfo.InvariantInfo (default)).</param>
     206    /// <param name="numberFormat">Constant format that should be used for numeric parameters (e.g. NumberFormatInfo.InvariantInfo (default)).</param>
    207207    /// <param name="formatString">The format string for numeric parameters (e.g. \"G4\" to limit to 4 digits, default is \"G\")</param>
    208208    /// <returns>Infix expression</returns>
Note: See TracChangeset for help on using the changeset viewer.