Ejemplo n.º 1
0
 /** nicely formatted information */
 public String getInfo() {
   StringBuilder buf = new StringBuilder(200);
   buf.setLength(0);
   buf.append(getFullName());
   Format.tab(buf, 30, true);
   buf.append(getUnitsString());
   Format.tab(buf, 60, true);
   buf.append(hasMissingData());
   Format.tab(buf, 66, true);
   buf.append(getDescription());
   return buf.toString();
 }
Ejemplo n.º 2
0
    /**
     * Put a projection in the dialog for editing
     *
     * @param projClass projection class
     * @param proj projection
     */
    private void putProjInDialog(ProjectionClass projClass, Projection proj) {
      //      nameTF.setText (proj.getName().trim());

      for (int i = 0; i < projClass.paramList.size(); i++) {
        ProjectionParam pp = (ProjectionParam) projClass.paramList.get(i);
        // fetch the value from the projection object
        Double value;
        try {
          if (debugBeans) {
            System.out.println("Projection putProjInDialog invoke reader on " + pp);
          }
          value = (Double) pp.reader.invoke(proj, VOIDOBJECTARG);
          if (debugBeans) {
            System.out.println("Projection putProjInDialog value " + value);
          }
        } catch (Exception ee) {
          System.err.println(
              "ProjectionManager: putProjInDialog failed "
                  + " invoking read "
                  + pp.name
                  + " class "
                  + projClass);
          continue;
        }
        String valstr = Format.d(value.doubleValue(), 5);
        pp.getTextField().setText(valstr);
      }
    }
Ejemplo n.º 3
0
 /**
  * Return a String representation of this
  *
  * @return a String representation of this
  */
 public String toString() {
   StringBuilder builder = new StringBuilder();
   builder.append(StringUtil.padRight((stid.trim() + std2.trim()), 8));
   builder.append(" ");
   builder.append(Format.i(stnm, 6));
   builder.append(" ");
   builder.append(StringUtil.padRight(sdesc, 32));
   builder.append(" ");
   builder.append(StringUtil.padLeft(stat.trim(), 2));
   builder.append(" ");
   builder.append(StringUtil.padLeft(coun.trim(), 2));
   builder.append(" ");
   builder.append(Format.i(slat, 5));
   builder.append(" ");
   builder.append(Format.i(slon, 6));
   builder.append(" ");
   builder.append(Format.i(selv, 5));
   builder.append(" ");
   builder.append(Format.i(spri, 2));
   builder.append(" ");
   builder.append(StringUtil.padLeft(swfo.trim(), 3));
   return builder.toString();
 }
Ejemplo n.º 4
0
  public static void copyURL2null(String url, int bufferSize) throws IOException {

    long start = System.currentTimeMillis();
    long count = IO.copyUrlB(url, null, bufferSize);
    double len = (double) count / (1000 * 1000);
    double took = .001 * (System.currentTimeMillis() - start);

    double rate = len / took;
    System.out.println(
        " copyURL2null ("
            + url
            + ") took = "
            + took
            + " sec; len= "
            + len
            + " Mbytes; rate = "
            + Format.d(rate, 3)
            + " Mb/sec");
  }
Ejemplo n.º 5
0
  public static void copyURL(String url, String filenameOut, int bufferSize) throws IOException {

    File outFile = new File(filenameOut);

    long start = System.currentTimeMillis();
    String ok = IO.readURLtoFileWithExceptions(url, outFile, bufferSize);
    double took = .001 * (System.currentTimeMillis() - start);

    double len = (double) outFile.length() / (1000 * 1000);

    double rate = len / took;
    System.out.println(
        " copyURL ("
            + url
            + ") took = "
            + took
            + " sec; len= "
            + len
            + " Mbytes; rate = "
            + Format.d(rate, 3)
            + "Mb/sec ok="
            + ok);
  }