Package org.encog.ml.prg.expvalue

Examples of org.encog.ml.prg.expvalue.ExpressionValue


        String str = tok.nextToken().trim();
        int idx = str.indexOf('#');
        if( idx!=-1) {
          int enumType = Integer.parseInt(str.substring(0,idx));
          int enumVal = Integer.parseInt(str.substring(idx+1));
          node.getData()[0] = new ExpressionValue(enumType,enumVal);
         
        }
        // is it boolean?
        else if( str.length()==1 && "tf".indexOf(Character.toLowerCase(str.charAt(0)))!=-1 ) {
          node.getData()[i] = new ExpressionValue(str.equalsIgnoreCase("t"));
        }
        // is it a string?
        else if( str.charAt(0)=='\"' ) {
          node.getData()[i] = new ExpressionValue(str.substring(1,str.length()-1));
        }
        // is it an integer
        else if( str.indexOf('.')==-1 && str.toLowerCase().indexOf('e')==-1) {
          long l;
          try {
            l = Long.parseLong(str);
          } catch(NumberFormatException ex) {
            // sometimes Java will output a long value that is larger than can be parsed
            // this is very likely not a useful genome and we just set it to zero so that
            // the population load does not fail.
            l=0;
          }
          node.getData()[i] = new ExpressionValue(l);
        }
        // At this point, must be a float
        else {
          node.getData()[i] = new ExpressionValue(CSVFormat.EG_FORMAT.parse(str));
        }
      }
    }
   
    return this.nodeStack.pop();
View Full Code Here

TOP

Related Classes of org.encog.ml.prg.expvalue.ExpressionValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.