Package org.dmd.util.formatting

Examples of org.dmd.util.formatting.PrintfFormat


  public DmcTraceableInputStream(InputStream is, SchemaManager sm, boolean cf, int padding){
    dis     = new DataInputStream(is);
    schema     = sm;
    calledFrom   = cf;
    format     = new PrintfFormat("%-" + padding + "s");
  }
View Full Code Here


  PrintfFormat    format;
 
  public DmcTraceableOutputStream(OutputStream os, boolean cf, int padding) {
    dos = new DataOutputStream(os);
    calledFrom = cf;
    format = new PrintfFormat("%-" + padding + "s");
    isFile = true;
  }
View Full Code Here

  }

  public DmcTraceableOutputStream(OutputStream os, boolean cf, int padding, boolean mode) {
    dos = new DataOutputStream(os);
    calledFrom = cf;
    format = new PrintfFormat("%-" + padding + "s");
    isFile = mode;
  }
View Full Code Here

  }

  String formatImports(TreeMap<String,String> map, int longest){
    int padding = longest+17;
    StringBuffer sb = new StringBuffer();
    PrintfFormat format = new PrintfFormat("%-" + padding + "s");
   
    sb.append("// Generated from: " + DebugInfo.getWhereWeAreNow() + "\n");
   
    Iterator<String> keys = map.keySet().iterator();
    while(keys.hasNext()){
      String key = keys.next();
      sb.append(format.sprintf("import " + key + ";") + "// " + map.get(key) + "\n");
    }
   
    sb.append("\n");
   
    return(sb.toString());
View Full Code Here

     */
    public void run(String[] args) {
        CommandLine         cl          = new CommandLine();
        ResultSet           rs          = new ResultSet();

        nameFormat = new PrintfFormat("%-30s");
        numFormat  = new PrintfFormat("%10d");
        colFormat  = new PrintfFormat("%10s");
        longestName = 0;

        packages    = new TreeMap<String,TreeMap<String,CodeCountInfo>>();
        out         = null;

        help = new StringBuffer();
        //            ***************************************************************************
        help.append("count -h -workspace -id -of -r -skip\n\n");
        help.append("The code count tool provides a simple code count mechansism. It indicates the\n");
        help.append("number of source, comment, import and blank lines in a set of Java files\n");
        help.append("and how many files are auto generated.\n");
        help.append("\n");
        help.append("-h          Dumps the help information\n");
        help.append("\n");
        help.append("-workspace  Indicates the workspace prefix.\n");
        help.append("\n");
        help.append("-id         Indicates the directory beneath the workspace at which parsing should start. \n");
        help.append("\n");
        help.append("-of         The output file name.\n");
        help.append("\n");
        help.append("-r          Indicates that you want to recurse through all subdirectories. \n");
        help.append("\n");
        help.append("-skip      (suffix) Indicates that you want to skip subdirectories that end with the \n");
        help.append("           specified suffix.\n");
        help.append("\n");
        help.append("\n");

        cl.addOption("-h",helpFlag,"Dumps the help message.");
        cl.addOption("-o",ofn,"Output file name.");
        cl.addOption("-workspace",   workspace,   "The workspace prefix");
        cl.addOption("-indir",inDir,"The input directory");
        cl.addOption("-of",outDir,"The output directory");
        cl.addOption("-r",recursiveFlag,"Recurses through all subdirectories.");
        cl.addOption("-skip",skip,"Skips the specified directory.");

        cl.parseArgs(args);

        if (ofn.length() > 0){
            try {
                out = new BufferedWriter(new FileWriter(ofn.toString()));
            } catch (IOException e) {
                System.out.println("IO Error:\n" + e);
                System.exit(1);
            }
        }

        // println("The args " + args[0] + "\n");

        if ((args.length == 0) || helpFlag.booleanValue() == true){
            println(help.toString());
            System.exit(0);
        }

        if (workspace.length() == 0){
          System.err.println("You must specify the -workspace argument");
          System.exit(1);
        }
       
        String startDir = workspace.toString();
       
        if (inDir.length() > 0){
          startDir = startDir + File.separator + inDir.toString();
        }

        readDirectory(rs,startDir);

        nameFormat = new PrintfFormat("%-" + longestName + "s");
        totalFormat = new PrintfFormat("%" + longestName + "s");
        dumpInfo();

        println(rs.toString());

        if (out != null){
View Full Code Here

//        Iterator<AttributeDefinition> adit = attrDefs.values().iterator();
//        Iterator<ClassDefinition> cdit = classDefs.values().iterator();
//        AttributeDefinition ad  = null;
//        ClassDefinition     cd  = null;
        StringBuffer    sb  = new StringBuffer();
        PrintfFormat  format = null;
       
        if (longestAttrName > longest)
          longest = longestAttrName;
       
        String  longestStr = "" + longest;
        format = new PrintfFormat("%-" + longestStr + "s ");

        sb.append("*** Attributes\n");
        TreeMap<StringName,AttributeDefinition> sattrs = new TreeMap<StringName, AttributeDefinition>();
       
        for(AttributeDefinition ad : attrDefs.values())
          sattrs.put(ad.getName(), ad);
       
        for(AttributeDefinition ad : sattrs.values())
            sb.append(format.sprintf(ad.getObjectName()) + ad.getDefinedIn().getName() + "\n");
       

        sb.append("*** Classes\n");
        TreeMap<StringName,ClassDefinition> scdefs = new TreeMap<StringName, ClassDefinition>();
       
        for(ClassDefinition cd : classDefs.values())
          scdefs.put(cd.getName(), cd);
       
        for(ClassDefinition cd : scdefs.values()){
            sb.append(format.sprintf(cd.getObjectName()));
            if (cd.getAbbrev() != null)
                sb.append(" AB " + cd.getAbbrev());
            sb.append(cd.getDefinedIn().getName() + "\n");
        }
      
View Full Code Here

    }
   
    rules = sd.getParsedRules();
    if (rules != null){
      out.write("\n");
      PrintfFormat pf = new PrintfFormat("%-28s");
      out.write("        // Generated from: " + DebugInfo.getWhereWeAreNow() + "\n");
      out.write("        try{\n");
     
      while(rules.hasNext()){
        DmcUncheckedObject ruleData = rules.next();
View Full Code Here

      }
    }
   
    if ((rules != null) && (rules.size() > 0)){
      out.write("\n");
      PrintfFormat pf = new PrintfFormat("%-28s");
      out.write("        try{\n");
     
      for(DmcUncheckedObject ruleData: rules){
       
       
View Full Code Here

    int longest = finder.getLongestName() + 4;
   
    docGenerator = new DmsHtmlDocGenerator();
   
    String f = "%-" + longest + "s";
    format = new PrintfFormat(f);
   
    classifier = new Classifier();
  }
View Full Code Here

    parser = new DmgParser(baseWithDMGSchema, configFinder);
   
    codeGenerator = new DmoGenerator(System.out);
   
    String f = "%-" + configFinder.getLongestName() + "s";
    format = new PrintfFormat(f);
   
    fileHeader = "";
  }
View Full Code Here

TOP

Related Classes of org.dmd.util.formatting.PrintfFormat

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.