public static void main(String args[]) { ProfileInspector profileInspector = new ProfileInspector(); Profile resultingProfile = null; if (args.length < 1 || args[0].indexOf("help") >= 0) { usage(); System.exit(0); } else { try { ArgumentProcessor.processArgs(args, ARG_DEFS, profileInspector); resultingProfile = profileInspector.processProfile(); } catch (ArgumentErrorException e) { System.err.println("Error processing command-line arguments: " + e.getMessage()); usage(); System.exit(255); } catch (Exception e) { System.err.println("Error proccessing:"); e.printStackTrace(); System.exit(1); } System.out.println(resultingProfile.getHumanOutput()); } }
public String getHumanOutput() { String results = ""; Set<String> leftOverCategoryNames = this.environment.getCategories().keySet(); for (ProfileFile[] round : this.files) { for (ProfileFile file : round) { String fileName = file.getFileName(); results += "###### " + fileName + "\n"; if (file.getType() == ProfileFile.TYPE_2D) { Vector<String> values = this.environment.getVars(fileName, "list"); results += Profile.array2DToString(values, "", "\n", "\n") + "\n"; leftOverCategoryNames.remove(fileName); } else if (file.getType() == ProfileFile.TYPE_3D) { HashMap<String, Vector<String>> category = this.environment.getCategoryKeys(fileName); results += Profile.array3DToString(category, " ", " ", "") + "\n"; leftOverCategoryNames.remove(fileName); } else if (file.getType() == ProfileFile.TYPE_KEYVAL_BASH) { HashMap<String, Vector<String>> category = this.environment.getCategoryKeys(fileName); results += Profile.array3DToString(category, "=\"", " ", "\"") + "\n"; leftOverCategoryNames.remove(fileName); } } } if (verbose) { // Warn about unhandled data for (String categoryName : leftOverCategoryNames) { HashMap<String, Vector<String>> keys = this.environment.getCategoryKeys(categoryName); Set<String> keyNames = keys.keySet(); for (String keyName : keyNames) { System.err.println("Warning: unhandled data: " + keyName); } } } return results; }