Examples of PrintfFormat


Examples of org.hyperic.sigar.util.PrintfFormat

        String[] subArgs;

        if (args.length == 0) {
            StringBuffer res = new StringBuffer();
            Object[] fArgs = new Object[2];
            PrintfFormat fmt;
            String fmtStr;
            int maxLen;

            res.append("    " + this.getUsageShort());
            res.append(".\n    For further help on each subcommand, ");
            res.append("type 'help ");
            res.append(this.getCommandName() + " <subcommand>'\n\n");

            maxLen = 0;
            for (Iterator i=this.getHandlerNames().iterator(); i.hasNext();) {
                String cmdName = (String)i.next();
               
                if (cmdName.length() > maxLen)
                    maxLen = cmdName.length();
            }

            fmtStr = "      %-" + (maxLen + 1) + "s %s";
            fmt = new PrintfFormat(fmtStr);
            for (Iterator i=this.getHandlerNames().iterator(); i.hasNext();) {
                String cmdName = (String)i.next();
                ShellCommandHandler sub = this.getSubHandler(cmdName);

                fArgs[0] = cmdName + ":";
                fArgs[1] = sub.getUsageShort();

                res.append(fmt.sprintf(fArgs));
                if (i.hasNext())
                    res.append("\n");
            }
            return res.toString();
        }
View Full Code Here

Examples of org.hyperic.sigar.util.PrintfFormat

        this(new Shell());
        this.shell.setPageSize(PageControl.SIZE_UNLIMITED);
    }

    public void setOutputFormat(String format) {
        this.formatter = new PrintfFormat(format);
    }
View Full Code Here

Examples of org.hyperic.sigar.util.PrintfFormat

    public PrintfFormat getFormatter() {
        return this.formatter;
    }

    public String sprintf(String format, Object[] items) {
        return new PrintfFormat(format).sprintf(items);
    }
View Full Code Here

Examples of org.hyperic.sigar.util.PrintfFormat

    public void printf(String format, Object[] items) {
        println(sprintf(format, items));
    }

    public void printf(Object[] items) {
        PrintfFormat formatter = getFormatter();
        if (formatter == null) {
            //see flushPrintfItems
            this.printfItems.add(items);
        }
        else {
            println(formatter.sprintf(items));
        }
    }
View Full Code Here

Examples of org.hyperic.sigar.util.PrintfFormat

        ShellCommandHandler handler;
        PrintStream out = this.getOutStream();
        int useArgs;

        if (args.length == 0) {
            PrintfFormat fmt = new PrintfFormat("\t%-14s - %s");
            Object[] fArgs = new Object[2];
            ArrayList cmdNamesList = new ArrayList();
            String[] cmdNames;
            Iterator i;

            i = itsShell.getCommandNameIterator();
            while (i.hasNext()) {
                cmdNamesList.add(i.next());
            }
           
            cmdNames = (String[])cmdNamesList.toArray(new String[0]);
            Arrays.sort(cmdNames);
           
           
            out.println("Available commands:");

            for (int j=0; j<cmdNames.length; j++) {
                handler = itsShell.getHandler(cmdNames[j]);
                fArgs[0] = cmdNames[j];
                fArgs[1] = handler.getUsageShort();
                out.println(fmt.sprintf(fArgs));
            }

            return;
        }
View Full Code Here

Examples of org.hyperic.sigar.util.PrintfFormat

        String[] subArgs;

        if (args.length == 0) {
            StringBuffer res = new StringBuffer();
            Object[] fArgs = new Object[2];
            PrintfFormat fmt;
            String fmtStr;
            int maxLen;

            res.append("    " + this.getUsageShort());
            res.append(".\n    For further help on each subcommand, ");
            res.append("type 'help ");
            res.append(this.getCommandName() + " <subcommand>'\n\n");

            maxLen = 0;
            for (Iterator i=this.getHandlerNames().iterator(); i.hasNext();) {
                String cmdName = (String)i.next();
               
                if (cmdName.length() > maxLen)
                    maxLen = cmdName.length();
            }

            fmtStr = "      %-" + (maxLen + 1) + "s %s";
            fmt = new PrintfFormat(fmtStr);
            for (Iterator i=this.getHandlerNames().iterator(); i.hasNext();) {
                String cmdName = (String)i.next();
                ShellCommandHandler sub = this.getSubHandler(cmdName);

                fArgs[0] = cmdName + ":";
                fArgs[1] = sub.getUsageShort();

                res.append(fmt.sprintf(fArgs));
                if (i.hasNext())
                    res.append("\n");
            }
            return res.toString();
        }
View Full Code Here

Examples of simtools.util.PrintfFormat

     */
    public void setPrintfFormat(String printfFormat) {
        this.printfFormat = printfFormat;
        if (printfFormat != null) {
            try {
                printfFormater = new PrintfFormat(printfFormat);
                return;
            } catch (IllegalArgumentException e) {
            }
        }
        printfFormater = null;
View Full Code Here

Examples of umontreal.iro.lecuyer.util.PrintfFormat

    *
    *    @return a confidence interval formatted as a string
    *
    */
   public String formatCINormal (double level, int d)  {
      PrintfFormat str = new PrintfFormat();
      double ci[] = new double[2];
      confidenceIntervalNormal (level, ci);
      str.append ("  " + (100*level) + "%");
      str.append (" confidence interval for mean (normal): (");
      str.append (7 + d, d-1, d, ci[0] - ci[1]).append (',');
      str.append (7 + d, d-1, d, ci[0] + ci[1]).append (" )" + PrintfFormat.NEWLINE);
      return str.toString();
}
View Full Code Here

Examples of umontreal.iro.lecuyer.util.PrintfFormat

    *
    *    @return a confidence interval formatted as a string
    *
    */
   public String formatCIStudent (double level, int d)  {
      PrintfFormat str = new PrintfFormat();
      double ci[] = new double[2];
      confidenceIntervalStudent (level, ci);
      str.append ("  " + (100*level) + "%");
      str.append (" confidence interval for mean (student): (");
      str.append (7 + d, d, d-1, ci[0] - ci[1]).append (',');
      str.append (7 + d, d, d-1, ci[0] + ci[1]).append (" )" + PrintfFormat.NEWLINE);
      return str.toString();
   }
View Full Code Here

Examples of umontreal.iro.lecuyer.util.PrintfFormat

    *
    *    @return a confidence interval formatted as a string
    *
    */
   public String formatCIVarianceChi2 (double level, int d)  {
      PrintfFormat str = new PrintfFormat();
      double ci[] = new double[2];
      confidenceIntervalVarianceChi2 (level, ci);
      str.append ("  " + (100*level) + "%");
      str.append (" confidence interval for variance (chi2): (");
      str.append (7 + d, d, d-1, ci[0]).append (',');
      str.append (7 + d, d, d-1, ci[1]).append (" )" + PrintfFormat.NEWLINE);
      return str.toString();
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.