Java 类java.lang.NumberFormatException 实例源码

项目:fsharpadvent2016    文件:LispReader.java   
static private Object readNumber(PushbackReader r, char initch) {
    StringBuilder sb = new StringBuilder();
    sb.append(initch);

    for(; ;)
        {
        int ch = read1(r);
        if(ch == -1 || isWhitespace(ch) || isMacro(ch))
            {
            unread(r, ch);
            break;
            }
        sb.append((char) ch);
        }

    String s = sb.toString();
    Object n = matchNumber(s);
    if(n == null)
        throw new NumberFormatException("Invalid number: " + s);
    return n;
}
项目:eclojure    文件:LispReader.java   
static private Object readNumber(PushbackReader r, char initch) {
    StringBuilder sb = new StringBuilder();
    sb.append(initch);

    for(; ;)
        {
        int ch = read1(r);
        if(ch == -1 || isWhitespace(ch) || isMacro(ch))
            {
            unread(r, ch);
            break;
            }
        sb.append((char) ch);
        }

    String s = sb.toString();
    Object n = matchNumber(s);
    if(n == null)
        throw new NumberFormatException("Invalid number: " + s);
    return n;
}
项目:ca-iris    文件:FeedParser.java   
protected static Integer parseAirTemperature(String s) {
    String a = trimAndNullEmpty(s);
    if (a == null)
        return null;
    int val;
    try {
        val = Integer.parseInt(a);
    }
    catch (NumberFormatException e) {
        return null;
    }
    if (val == ESS_TEMP_UNAVAIL)
        return null;
    double degC = (((double)val)/10.0D);
    int i = (new Temperature(degC, Temperature.Units.CELSIUS)).round(CELSIUS);
    return Integer.valueOf(i);
}
项目:ca-iris    文件:FeedParser.java   
protected static Integer parseAvgWindSpeed(String s) {
    String a = trimAndNullEmpty(s);
    if (a == null)
        return null;
    int val;
    try {
        val = Integer.parseInt(a);
    }
    catch (NumberFormatException e) {
        return null;
    }
    if (val == ESS_SPEED_UNAVAIL)
        return null;
    double mps = ((double)val) / 10.0D;
    double kph = mps*((double)SEC_PER_HOUR/1000.0D);
    int i = (new Speed(kph, Speed.Units.KPH)).round(KPH);
    return Integer.valueOf(i);
}
项目:ca-iris    文件:FeedParser.java   
protected static Integer parseAvgWindDir(String s) {
    String a = trimAndNullEmpty(s);
    if (a == null)
        return null;
    int val;
    try {
        val = Integer.parseInt(a);
    }
    catch (NumberFormatException e) {
        return null;
    }
    if (val == ESS_DIR_UNAVAIL)
        return null;
    if (val == 360)
        val = 0;
    return Integer.valueOf(val);
}
项目:ca-iris    文件:FeedParser.java   
protected static Integer parseGustSpeed(String s) {
    String a = trimAndNullEmpty(s);
    if (a == null)
        return null;
    int val;
    try {
        val = Integer.parseInt(a);
    }
    catch (NumberFormatException e) {
        return null;
    }
    if (val == ESS_SPEED_UNAVAIL)
        return null;

    double mps = ((double)val) / 10.0D;
    double kph = mps*((double)SEC_PER_HOUR/1000.0D);
    int i = (new Speed(kph, Speed.Units.KPH)).round(KPH);
    return Integer.valueOf(i);
}
项目:ca-iris    文件:FeedParser.java   
protected static Integer parseGustDir(String s) {
    String a = trimAndNullEmpty(s);
    if (a == null)
        return null;
    int val;
    try {
        val = Integer.parseInt(a);
    }
    catch (NumberFormatException e) {
        return null;
    }
    if (val == ESS_DIR_UNAVAIL)
        return null;
    if (val == 360)
        val = 0;
    return Integer.valueOf(val);
}
项目:ca-iris    文件:FeedParser.java   
protected static Integer parsePrecipRate(String s) {
    String a = trimAndNullEmpty(s);
    if (a==null)
        return null;
    int val;
    try {
        val = Integer.parseInt(a);
    }
    catch (NumberFormatException e) {
        return null;
    }
    if (val == ESS_PRECIPRATE_UNAVAIL)
        return null;

    float gramsPerSqMPerSecond = (((float)(val)) / 10.0F);

    float mmPerHr = (
        ( gramsPerSqMPerSecond / (float)G_PER_L_H2O)
        / (float)L_PER_MM_RAINFALL) * (float)SEC_PER_HOUR ;

    return Integer.valueOf(Math.round(mmPerHr));
}
项目:ca-iris    文件:FeedParser.java   
protected static Integer parseVisibility(String s) {
    String a = trimAndNullEmpty(s);
    if (a==null)
        return null;
    int val;
    try {
        val = Integer.parseInt(a);
    }
    catch (NumberFormatException e) {
        return null;
    }
    if (val == ESS_VIS_UNAVAIL)
        return null;

    double meters = (((double)val)/10.0D);
    int i = (new Distance(meters, Distance.Units.METERS)).round(Distance.Units.METERS);
    return Integer.valueOf(i);
}
项目:ca-iris    文件:FeedParser.java   
protected static Integer parseSurfaceTemperature(String s) {
    String a = trimAndNullEmpty(s);
    if (a==null)
        return null;
    int val;
    try {
        val = Integer.parseInt(a);
    }
    catch (NumberFormatException e) {
        return null;
    }
    if (val == ESS_TEMP_UNAVAIL)
        return null;
    double degC = (((double)val)/10.0D);
    int i = (new Temperature(degC, Temperature.Units.CELSIUS)).round(CELSIUS);
    return Integer.valueOf(i);
}
项目:ca-iris    文件:FeedParser.java   
protected static Integer parseSubSurfaceTemperature(String s) {
    String a = trimAndNullEmpty(s);
    if (a==null)
        return null;
    int val;
    try {
        val = Integer.parseInt(a);
    }
    catch (NumberFormatException e) {
        return null;
    }
    if (val == ESS_TEMP_UNAVAIL)
        return null;
    double degC = (((double)val)/10.0D);
    int i = (new Temperature(degC, Temperature.Units.CELSIUS)).round(CELSIUS);
    return Integer.valueOf(i);
}
项目:twidlit    文件:Io.java   
public static int toInt(String value, StringBuilder err) {
   if (value != null && !"".equals(value)) {
      int neg = 1;
      if (value.length() > 0 && value.charAt(0) == '-') {
         value = value.substring(1).trim();
         neg = -1;
      }
      try {
         int parsed;
         if (value.length() > 1 && value.substring(0,2).equals("0x")) {
            parsed = toIntWarnParse(value.substring(2), 16, err);
         } else {
            parsed = toIntWarnParse(value, err);
         }
         return parsed == sm_PARSE_FAILED ? parsed : neg * parsed;
      } catch (NumberFormatException e) {}
   }
   return sm_PARSE_FAILED;
}
项目:HTML5_WebSite    文件:SuperDotChart.java   
/**
   * reset dataTable to default (demo data), and refesh chart
   */


  protected List createValueList(String in){
//      System.out.println("in="+in);
   String vs = in;
   //   String[] values = in.split("( *)+,+( *)");
   //      int count = java.lang.reflect.Array.getLength(values);

   StringTokenizer st = new StringTokenizer(in,DELIMITERS);
   int count = st.countTokens();
   String[] values = new String[count];
   for (int i=0; i<count; i++)
       values[i]=st.nextToken();

       List<Double> result = new java.util.ArrayList<Double>();
    try{
       for (int i = 0; i < count; i++) {
           double v = Double.parseDouble(values[i]);
           result.add(new Double(v));   
       }}catch(NumberFormatException e)
            {
                showMessageDialog("Data format error!");
                return null;}
       return result;
   }
项目:HTML5_WebSite    文件:SuperBoxAndWhiskerChart.java   
/**
  * 
  * @param in
  * @return
  */
 protected List createValueList(String in){
  vs = in;
  //   String[] values = in.split("( *)+,+( *)");
  //       int count = java.lang.reflect.Array.getLength(values);

  StringTokenizer st = new StringTokenizer(in,DELIMITERS);
  int count = st.countTokens();
  String[] values = new String[count];
  for (int i=0; i<count; i++)
   values[i]=st.nextToken();

      List<Double> result = new java.util.ArrayList<Double>();
try{
    double v;
      for (int i = 0; i < count; i++) {
        if (values[i]!=null && values[i].length()!=0){
         v = Double.parseDouble(values[i]);
         result.add(new Double(v));  
        }
      }}catch(NumberFormatException e)
        {
            showMessageDialog("Data format error!");
            return null;}
      return result;
  }
项目:pluotsorbet    文件:constructor.java   
/**
 * Runs the test using the specified harness.
 *
 * @param harness  the test harness (<code>null</code> not permitted).
 */
public void test(TestHarness harness)
{
    NumberFormatException object1 = new NumberFormatException();
    harness.check(object1 != null);
    harness.check(object1.toString(), "java.lang.NumberFormatException");

    NumberFormatException object2 = new NumberFormatException("nothing happens");
    harness.check(object2 != null);
    harness.check(object2.toString(), "java.lang.NumberFormatException: nothing happens");

    NumberFormatException object3 = new NumberFormatException(null);
    harness.check(object3 != null);
    harness.check(object3.toString(), "java.lang.NumberFormatException");

}
项目:ActiveSearch    文件:DataConnectionRest.java   
public LinkedList<Integer> getUsersByEmail(int email)
   {
WebResource webResource = client.resource(ActiveSearchConstants.REST_URL_PREFIX + "getUsersByMessage/" + email);
String[] messages = webResource.accept("text/plain").get(String.class).split("[\\r\\n]+");

LinkedList<Integer> retList = new LinkedList<Integer>();
for (int i = 0; i < messages.length; i++) {
    try {
    int id = Integer.parseInt(messages[i]);
    retList.add(id);
    }
    catch (NumberFormatException e) {
    // this is ok
    }
}

return retList;
   }
项目:ActiveSearch    文件:DataConnectionRest.java   
public LinkedList<Integer> getEmailRecipientsByEmail(int email)
   {
WebResource webResource = client.resource(ActiveSearchConstants.REST_URL_PREFIX + "getMessageRecipientsByMessage/" + email);
String[] recipients = webResource.accept("text/plain").get(String.class).split("[\\r\\n]+");

LinkedList<Integer> retList = new LinkedList<Integer>();
for (int i = 0; i < recipients.length; i++) {
    if (!recipients[i].isEmpty()) {
    try {
        int id = Integer.parseInt(recipients[i]);
        retList.add(id);
    }
    catch (NumberFormatException e) {
        // this is ok
    }
    }
}

return retList;
   }
项目:delay-tolerant-network    文件:StandardEventsReader.java   
private int convertToInteger(String str){
    String dataUnit = str.replaceAll("[\\d.]","").trim();
    String numericPart = str.replaceAll("[^\\d.]","");
    int number = Integer.parseInt(numericPart);

    if (dataUnit.equals("k")) {
        return (number * 1000);
    }
    else if (dataUnit.equals("M")) {
        return (number * 1000000);
    }
    else if (dataUnit.equals("G")) {
        return (number * 1000000000);
    }
    else if (dataUnit.equals("kiB")) {
        return (number * 1024);
    }
    else if (dataUnit.equals("MiB")) {
        return (number * 1048576);
    }
    else if (dataUnit.equals("GiB")) {
        return (number * 1073741824);
    }
    else{
        throw new NumberFormatException("Invalid number format for StandardEventsReader: ["+str+"]");
    }
}
项目:orbiter    文件:SimulationView.java   
/**
* Gets the desired lifetime of the new simulation.
* @return the desired lifetime of the new simulation
*/
public int getLifetimeFieldValue()
{
    try {
        return Integer.parseInt(lifetimeTextField.getText());
    } catch (NumberFormatException ex) {
        JOptionPane.showMessageDialog(new JFrame(),
                                      "Invalid input, infinite assumed.",
                                      "Error", JOptionPane.ERROR_MESSAGE);
    }

    return 0;
}
项目:ca-iris    文件:WizardRec.java   
/** Get field as int. */
static private int getFieldInt(String[] fs, int i) {
    String f = getFieldString(fs, i);
    if (f == null)
        return Constants.MISSING_DATA;
    try {
        return Integer.parseInt(f);
    }
    catch (NumberFormatException e) {
        return Constants.MISSING_DATA;
    }
}
项目:ca-iris    文件:WizardRec.java   
/** Get field as float. */
static private float getFieldFloat(String[] fs, int i) {
    String f = getFieldString(fs, i);
    if (f == null)
        return Constants.MISSING_DATA;
    try {
        return Float.parseFloat(f);
    }
    catch (NumberFormatException e) {
        return Constants.MISSING_DATA;
    }
}
项目:thesis-disassembler    文件:TryCatchBlockNode.java   
int finallyWithReturn() {
    String number = "1";
    try {
        return Integer.valueOf(number);
    } catch (NumberFormatException e) {
        return 0;
    } finally {
        return -1;
    }
}
项目:the-one    文件:StandardEventsReader.java   
private int convertToInteger(String str){
    String dataUnit = str.replaceAll("[\\d.]","").trim();
    String numericPart = str.replaceAll("[^\\d.]","");
    int number = Integer.parseInt(numericPart);

    if (dataUnit.equals("k")) {
        return (number * 1000);
    }
    else if (dataUnit.equals("M")) {
        return (number * 1000000);
    }
    else if (dataUnit.equals("G")) {
        return (number * 1000000000);
    }
    else if (dataUnit.equals("kiB")) {
        return (number * 1024);
    }
    else if (dataUnit.equals("MiB")) {
        return (number * 1048576);
    }
    else if (dataUnit.equals("GiB")) {
        return (number * 1073741824);
    }
    else{
        throw new NumberFormatException("Invalid number format for StandardEventsReader: ["+str+"]");
    }
}
项目:twidlit    文件:Io.java   
public static int toIntWarnParse(String value, int base, StringBuilder err) {
   try {
      return Integer.parseInt(value, base);
   } catch (NumberFormatException e) {
      Log.warn(err, "Failed to parse \"" + value + "\" to integer");
      return sm_PARSE_FAILED;
   }
}
项目:HTML5_WebSite    文件:SuperBoxAndWhiskerChart_Vertical.java   
/**
  * 
  * @param in
  * @return
  */
 protected List<Double> createValueList(String in){
  vs = in;
  //   String[] values = in.split("( *)+,+( *)");
  //       int count = java.lang.reflect.Array.getLength(values);

  StringTokenizer st = new StringTokenizer(in,DELIMITERS);
  int count = st.countTokens();
  String[] values = new String[count];
  for (int i=0; i<count; i++)
   values[i]=st.nextToken();

//  System.out.println("count="+count);
      List<Double> result = new java.util.ArrayList<Double>();
try{
    for (int i = 0; i < count; i++) {
        //System.out.println("values["+i+"]=*"+values[i]+"*");
        double v;
        if (values[i]!=null && values[i].length()!=0 && !values[i].equals("null")){
             v = Double.parseDouble(values[i]);
             result.add(new Double(v));   
        }
    }
}catch(NumberFormatException e){
    showMessageDialog("Data format error!");
    return null;
}
      return result;
  }
项目:HTML5_WebSite    文件:SuperCategoryChart_Stat_Raw.java   
/**
 * 
 * @param in
 * @return
 */
protected Double[] createValueList(String in){
 vs = in;
 //  String[] values = in.split("( *)+,+( *)");
 //int count = java.lang.reflect.Array.getLength(values);

 StringTokenizer st = new StringTokenizer(in,DELIMITERS);
 int count = st.countTokens();
 String[] values = new String[count];
 for (int i=0; i<count; i++)
  values[i]=st.nextToken();

 Double[] result = new Double[count];

  for (int i = 0; i < count; i++) {
  // System.out.println(" SuperCat_stat_Raw: vlaues["+i+"]=*"+values[i]+"*");
   if (values[i]!= null){
       try{
           double v = Double.parseDouble(values[i]); 
           result[i] = new Double(v);   
       }catch(NumberFormatException e){
           result[i] = Double.NaN;
       }

   }else  result[i] = Double.NaN;

  }

     return result;
 }
项目:openhab-hdl    文件:HdlGenericBindingProvider.java   
/**
 * {@inheritDoc}
 */
@Override
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException
{
  super.processBindingConfiguration(context, item, bindingConfig);

  HdlBindingConfig config = new HdlBindingConfig();

  String[] parts = bindingConfig.split(":");
  if (parts.length != 2) {
    throw new BindingConfigParseException(bindingConfig);
  }

  try {
    config.channel = Integer.parseInt(parts[1]);
    parts = parts[0].split("\\.");

    if (parts.length != 2) {
      throw new BindingConfigParseException(bindingConfig);
    }

    byte subNet = (byte)Integer.parseInt(parts[0]);
    byte devAddr = (byte)Integer.parseInt(parts[1]);

    config.address = ((subNet << 8) & 0xff00) | (devAddr & 0xff);

    int hash = (config.address << 8) | config.channel;

    addBindingConfig(item, config);
    items.put(new Integer(hash), item.getName());

  }
  catch (NumberFormatException e)
  {
    throw new BindingConfigParseException(bindingConfig);
  }
}
项目:openhab-hdl    文件:ZWaveCommandClass.java   
/**
 * Extract a decimal value from a byte array.
 * @param buffer the buffer to be parsed.
 * @param offset the offset at which to start reading
 * @return the extracted decimal value
 */
protected BigDecimal extractValue(byte[] buffer, int offset) {
    int size = buffer[offset] & SIZE_MASK;
    int precision = (buffer[offset] & PRECISION_MASK) >> PRECISION_SHIFT;

    if((size+offset) >= buffer.length) {
        logger.error("Error extracting value - length={}, offset={}, size={}.", 
                new Object[] { buffer.length, offset, size});
        throw new NumberFormatException();
    }

    int value = 0;
    int i;
    for (i = 0; i < size; ++i) {
        value <<= 8;
        value |= buffer[offset + i + 1] & 0xFF;
    }

    // Deal with sign extension. All values are signed
    BigDecimal result;
    if ((buffer[offset + 1] & 0x80) == 0x80) {
        // MSB is signed
        if (size == 1) {
            value |= 0xffffff00;
        } else if (size == 2) {
            value |= 0xffff0000;
        }
    }

    result = BigDecimal.valueOf(value);

    BigDecimal divisor = BigDecimal.valueOf(Math.pow(10, precision));
    return result.divide(divisor);
}
项目:hexgui    文件:SgfReader.java   
private int parseInt(String str) throws SgfError
   {
int ret;
try {
    ret = Integer.parseInt(str);
}
catch (NumberFormatException e) {
    throw sgfError("Error parsing integer.");
}
return ret;
   }
项目:pluotsorbet    文件:TryCatch.java   
/**
 * Runs the test using the specified harness.
 *
 * @param harness  the test harness (<code>null</code> not permitted).
 */
public void test(TestHarness harness)
{
    // flag that is set when exception is caught
    boolean caught = false;
    try {
        throw new NumberFormatException("NumberFormatException");
    }
    catch (NumberFormatException e) {
        // correct exception was caught
        caught = true;
    }
    harness.check(caught);
}
项目:javascript-codemodel    文件:JSStringValue.java   
public JSValue asNumber( JSContext context) throws JSException {
    try {
    return new JSNumberValue( Double.valueOf(_s).doubleValue());
  }
  catch( NumberFormatException e) {
    throw new JSException( "Invalid number format converting string (" + _s + ") to number.", context);
  }
}
项目:SolutionsHackerRank    文件:Solution_Volume.java   
public int getINTVal() throws NumberFormatException {
    int val = this.scanner.nextInt();
    if (val <= 0) {
        throw new NumberFormatException("All the values must be positive");
    }
    return val;
}
项目:SolutionsHackerRank    文件:Solution_Volume.java   
public double getDoubleVal() throws NumberFormatException {
    double val =this.scanner.nextDouble();
    if (val <= 0) {
        throw new NumberFormatException("All the values must be positive");
    }
    return val;
}
项目:ShaderEditor    文件:Preferences.java   
private static int parseInt(String s, int preset) {
    try {
        if (s != null && s.length() > 0) {
            return Integer.parseInt(s);
        }
    } catch (NumberFormatException e) {
        // use preset
    }

    return preset;
}
项目:ShaderEditor    文件:Preferences.java   
private static long parseLong(String s, long preset) {
    try {
        if (s != null && s.length() > 0) {
            return Long.parseLong(s);
        }
    } catch (NumberFormatException e) {
        // use preset
    }

    return preset;
}
项目:pinochle    文件:HighScoreModel.java   
/**
 * Rather than instantiate a score somewhere
 * else, we'll just ask the caller to send us
 * names|score and we'll do the parsing here...
 */
public void setHighScore(String line) {
  String   names = null;
  int      value = 0;
  String[] array = line.split("\\|",-1);  
  try {
    names = array[0];
    value = Integer.parseInt(array[1]);
  } catch (NumberFormatException e) {
    value = 0;
  }
  if (value == 0) return;
  model.add(names, value, DateUtils.now()); 
}
项目:TimeseriesDelta    文件:RollingAverageMapper.java   
@Override
public void map(LongWritable unusedKey, Text value, Context context) 
throws IOException, InterruptedException
{
  String stringValue = new String(value.getBytes(), 0, value.getLength());
  String delimiter   = tConfig.getDelimiter();
  String[] tokens    = stringValue.split(delimiter);

  int timeIDX      = tConfig.getTimeColumn();
  String[] aliases = tConfig.getAliases();

  long tStamp = 0;
  try {
    String time = tokens[timeIDX];
    tStamp      = (long) (Double.parseDouble(time));
  } catch ( NumberFormatException e ) {
  }

  for(String alias: aliases)
  {
    TimeseriesAlias tAlias  = tConfig.getAlias( alias );

    TimeseriesKey key = new TimeseriesKey();
    int groupIdx      = tAlias.getCategoryColumn();
    String category   = tokens[groupIdx];
    key.set( category, alias, tStamp );

    int valueIdx            = tAlias.getMetricType();
    TimeseriesDataPoint val = new TimeseriesDataPoint();
    val.fValue              = ( valueIdx == TimeseriesAlias.COUNT_METRIC )
                            ?  1.0 
                            :  Double.parseDouble( tokens[valueIdx] );
    val.lDateTime = tStamp;

    context.write(key, val);
  }
}
项目:OpenNMS    文件:IpValidator.java   
/**
 * <p>isIpValid</p>
 *
 * @param ipAddr a {@link java.lang.String} object.
 * @return a boolean.
 */
public static boolean isIpValid(String ipAddr) {
    ThreadCategory log = ThreadCategory.getInstance(IpValidator.class);
    StringTokenizer token = new StringTokenizer(ipAddr, ".");
    if(token.countTokens() != 4) {
        if (log.isDebugEnabled())
            log.debug("Invalid format for IpAddress " + ipAddr);
        return false;
    }
    int temp;
    int i = 0;
    while (i < 4) {
        try{
            temp = Integer.parseInt(token.nextToken(), 10);
            if (temp < 0 || temp > 255) {
                if (log.isDebugEnabled())
                    log.debug("Invalid value " + temp + " in IpAddress");
                return false;
            }
            i++;
        } catch (NumberFormatException ex) {
            if (log.isDebugEnabled())
                log.debug("Invalid format for IpAddress, " + ex);
            return false;
        }
    }
    return true;
}
项目:HTML5_WebSite    文件:SuperYIntervalChartA.java   
/**
   * 
   * @param isDemo data come from demo(true) or dataTable(false)
   * @return
   */  
   protected IntervalXYDataset createDataset(boolean isDemo) {
    if(isDemo){
            updateStatus("isDemo==true in "+this.getClass().getName()+" class! return null Dataset, check the code!");
        return null; }
    else {
        try{
        double[] x;
        double[] y1, y2;

        setArrayFromTable();
        y1 = new double[xyLength];
        y2 = new double[xyLength];
        x = new double[xyLength];
        int[] skipx = new int[xyLength];
        int[] skipy = new int[xyLength];
        String yy[] = new String[2];    


        for (int i = 0; i < xyLength; i++) 
            if (indepValues[i][0]==null || indepValues[i][0].length()==0)
                skipx[i] =1;
            else    x[i]= Double.parseDouble(indepValues[i][0]);


        for (int i = 0; i < xyLength; i++) {
            if (depValues[i][0]==null || depValues[i][0].length()==0||
                    depValues[i][1]==null || depValues[i][1].length()==0){
                skipy[i]= 1;
            }
            else{
            /*  StringTokenizer st = new StringTokenizer(depValues[i][0],DELIMITERS);
                yy[0]= st.nextToken();
                yy[1]= st.nextToken();
                //yy = depValues[i][0].split("( *)+,+( *)") ;
                y1[i] = Double.parseDouble(yy[0]);
                y2[i] = Double.parseDouble(yy[1]);*/
                y1[i]=Double.parseDouble(depValues[i][0]);
                y2[i]=Double.parseDouble(depValues[i][1]);
            }
        }

        ArrayList<Double> yy1 = new ArrayList<Double>();
        ArrayList<Double> yy2 = new ArrayList<Double>();
        ArrayList<Double> xx = new ArrayList<Double>();
        for (int i=0; i<xyLength; i++)
            if(skipx[i]!=1&&skipy[i]!=1){
                yy1.add(y1[i]);
                yy2.add(y2[i]);
                xx.add(x[i]);
            }

        y1 = new double[yy1.size()];
        y2 = new double[yy1.size()];
        x = new double[yy1.size()];
        for (int i=0; i<yy1.size(); i++){
            y1[i]=yy1.get(i);
            y2[i]=yy2.get(i);
            x[i]=xx.get(i);
        }

        SimpleIntervalXYDataset2 ds = new SimpleIntervalXYDataset2(yy1.size(), x, y1, y2);  
        if(dependentHeaders!=null &&dependentHeaders[0]!=null){
            String name = dependentHeaders[0];
            if(name.indexOf(":")!=-1)
                name = name.substring(0, name.indexOf(":"));
            ds.setSeriesKey(name);
        }
           return   ds;     
        }catch(NumberFormatException e)
            {
                showMessageDialog("Data format error!");
                return null;}
    }

}
项目:HTML5_WebSite    文件:SuperCategoryChart_StatA.java   
/**
 * @param isdemo data come from demo(true) or dataTable(false)
 */
   protected  CategoryDataset createDataset(boolean isDemo) {

    if (isDemo){
        return super.createDataset(true);
        }
    else{
        try{

            setArrayFromTable();

            double[][] xmean = new double[xyLength][independentVarLength]; 
            double[][] xstdDev =  new double[xyLength][independentVarLength];
            String[][] y = new String[xyLength][dependentVarLength];
            String [] ss = new String[2] ;

            for (int index=0; index<independentVarLength; index++)
                for (int i = 0; i < xyLength; i++) {
                    if (indepValues[i][index]==null || indepValues[i][index].length()==0)
                    {
                        if (index%2==0)
                            xmean[i][index/2]=0.0;
                        else
                            xstdDev[i][index/2]=0.0;
                    }
                    else{

                        if (index%2==0)
                            xmean[i][index/2] = Double.parseDouble(indepValues[i][index]);
                        else
                            xstdDev[i][index/2] = Double.parseDouble(indepValues[i][index]);
                    }
                }

            for (int index=0; index<dependentVarLength; index++)
                for (int i = 0; i < xyLength; i++) 
                        y[i][index] = depValues[i][index];

            // create the dataset... 
            dataset = new DefaultStatisticalCategoryDataset(); 

                //dependent 
                for (int j=0; j<xyLength; j++)
                    for (int i=0; i<independentVarLength/2; i++){
                        String header="C"+i;
                        if (independentHeaders[i*2].length()!=0 &&independentHeaders[i*2].indexOf("Mean")!=-1)
                            header = independentHeaders[i*2].substring(0, independentHeaders[i*2].indexOf("Mean"));
                        if(y[j][0]!=null)
                            dataset.add(xmean[j][i], xstdDev[j][i], y[j][0], header); 
                        //System.out.println("adding :("+x[j][i]+","+y[j]+","+independentHeaders[i]+")" );
                    }

                return dataset; 
        }catch(NumberFormatException e)
            {
                showMessageDialog("Data format error!");
                return null;}
    }

}