Package java.util

Examples of java.util.Formatter


    /**
     * Output periods in short format (e.g. "2w")
     */
    private String getInternalShortFormat() {
        final StringBuilder sb = new StringBuilder();
        final Formatter formatter = new Formatter(sb, Locale.US);
        formatter.format("%d%s", this.length, this.units.getShortFormat());
        return sb.toString();
    }
View Full Code Here


        logTimecards(timecards);
    }

    private void logTimecards(TimecardSummaryVO[] timecards) {

        Formatter formatter = new Formatter();
        formatter.format(TimecardHdrFormat, "Submitter", "Approver", "Status",    "Start Date");
        logger.info(formatter.toString());
        for (int i = 0; i < timecards.length; i++) {
            formatter = new Formatter();
            formatter.format(
                    TimecardRowFormat,
                    timecards[i].getSubmitterName(),
                    timecards[i].getApproverName(),
                    timecards[i].getStatus(),
                    timecards[i].getStartDate());
            logger.info(formatter.toString());
        }
    }
View Full Code Here

        public final String toString() {
            if ( isNull() )
                return "null date";
            else {
                final StringBuilder sb = new StringBuilder();
                final Formatter formatter = new Formatter(sb, Locale.US);
                formatter.format("%s %d, %d", month(), dayOfMonth(), year());
                return sb.toString();
            }
        }
View Full Code Here

        public final String toString() {
            if ( isNull() )
                return "null date";
            else {
                final StringBuilder sb = new StringBuilder();
                final Formatter formatter = new Formatter(sb, Locale.US);
                formatter.format("%02d/%02d/%4d", month().value(), dayOfMonth(), year());
                return sb.toString();
            }
        }
View Full Code Here

        public final String toString() {
            if ( isNull() )
                return "null date";
            else {
                final StringBuilder sb = new StringBuilder();
                final Formatter formatter = new Formatter(sb, Locale.US);
                formatter.format("%04d-%02d-%02d", year(), month().value(), dayOfMonth());
                return sb.toString();
            }
        }
View Full Code Here

      return getParamName().hashCode() + 37 * getLevelType1();
    }

    @Override
    public String cdmVariableName(GridTableLookup lookup, boolean useLevel, boolean useStat) {
      Formatter f = new Formatter();
      f.format("%s", getParameterName());

      if (useLevel) {
        String levelName = lookup.getLevelName(this);
        if (levelName.length() != 0) {
          if (lookup.isLayer(this))
            f.format("_%s_layer", lookup.getLevelName(this));
           else
            f.format("_%s", lookup.getLevelName(this));
        }
      }

      return f.toString();
    }
View Full Code Here

    return doc;
  }

  private String getDecl( VariableEnhanced ve) {
    Formatter sb = new Formatter();
    sb.format("%s ", ve.getDataType().toString());
    ve.getNameAndDimensions(sb, true, true);
    return sb.toString();
  }
View Full Code Here

  private boolean showCompare = false;
  private boolean showEach = false;
  private boolean compareData = false;

  public CompareNetcdf2() {
    this(new Formatter(System.out), false, false, false);
  }
View Full Code Here


  public static void main(String arg[]) throws IOException {
    NetcdfFile ncfile1 = NetcdfDataset.openFile("dods://thredds.cise-nsf.gov:8080/thredds/dodsC/satellite/SFC-T/SUPER-NATIONAL_1km/20090516/SUPER-NATIONAL_1km_SFC-T_20090516_2200.gini", null);
    NetcdfFile ncfile2 = NetcdfDataset.openFile("dods://motherlode.ucar.edu:8080/thredds/dodsC/satellite/SFC-T/SUPER-NATIONAL_1km/20090516/SUPER-NATIONAL_1km_SFC-T_20090516_2200.gini", null);
    compareFiles(ncfile1, ncfile2, new Formatter(System.out), false, true, false);
  }
View Full Code Here

      return param.hashCode() + 37 * getLevelType1();
    }

    @Override
    public String cdmVariableName(GridTableLookup lookup, boolean useLevel, boolean useStat) {
      Formatter f = new Formatter();
      f.format("%s", getParameterName());

      // always use level
      //if (useLevel) {
        String levelName = lookup.getLevelName(this);
        if (levelName.length() != 0) {
          if (lookup.isLayer(this))
            f.format("_%s_layer", lookup.getLevelName(this));
           else
            f.format("_%s", lookup.getLevelName(this));
        }
      //}

      return f.toString();
    }
View Full Code Here

TOP

Related Classes of java.util.Formatter

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.