List of usage examples for java.util Formatter Formatter
public Formatter(OutputStream os)
From source file:umontreal.iro.lecuyer.charts.MultipleDatasetChart.java
/** * Same as in {@link XYChart}./* w w w.j a va 2s . com*/ * * @param width Chart's width in centimeters. * * @param height Chart's height in centimeters. * * */ public String toLatex(double width, double height) { double xunit, yunit; double[] save = new double[4]; if (datasetList.size() == 0) throw new IllegalArgumentException("Empty chart"); //Calcul des parametres d'echelle et de decalage double XScale = computeXScale(XAxis.getTwinAxisPosition()); double YScale = computeYScale(YAxis.getTwinAxisPosition()); xunit = width / ((Math.max(XAxis.getAxis().getRange().getUpperBound(), XAxis.getTwinAxisPosition()) * XScale) - (Math.min(XAxis.getAxis().getRange().getLowerBound(), XAxis.getTwinAxisPosition()) * XScale)); //taille d'une unite en x et en cm dans l'objet "tikzpicture" yunit = height / ((Math.max(YAxis.getAxis().getRange().getUpperBound(), YAxis.getTwinAxisPosition()) * YScale) - (Math.min(YAxis.getAxis().getRange().getLowerBound(), YAxis.getTwinAxisPosition()) * YScale)); //taille d'une unite en y et en cm dans l'objet "tikzpicture" Formatter formatter = new Formatter(Locale.US); /*Entete du document*/ if (latexDocFlag) { formatter.format("\\documentclass[12pt]{article}%n%n"); formatter.format("\\usepackage{tikz}%n\\usetikzlibrary{plotmarks}%n\\begin{document}%n%n"); } if (chart.getTitle() != null) formatter.format("%% PGF/TikZ picture from SSJ : %s%n", chart.getTitle().getText()); else formatter.format("%% PGF/TikZ picture from SSJ %n"); formatter.format("%% XScale = %s, YScale = %s, XShift = %s, YShift = %s%n", XScale, YScale, XAxis.getTwinAxisPosition(), YAxis.getTwinAxisPosition()); formatter.format("%% Therefore, thisFileXValue = (originalSeriesXValue+XShift)*XScale%n"); formatter.format("%% and thisFileYValue = (originalSeriesYValue+YShift)*YScale%n%n"); if (chart.getTitle() != null) formatter.format("\\begin{figure}%n"); formatter.format("\\begin{center}%n"); formatter.format("\\begin{tikzpicture}[x=%scm, y=%scm]%n", xunit, yunit); formatter.format("\\footnotesize%n"); if (grid) formatter.format("\\draw[color=lightgray] (%s, %s) grid[xstep = %s, ystep=%s] (%s, %s);%n", (Math.min(XAxis.getAxis().getRange().getLowerBound(), XAxis.getTwinAxisPosition()) - XAxis.getTwinAxisPosition()) * XScale, (Math.min(YAxis.getAxis().getRange().getLowerBound(), YAxis.getTwinAxisPosition()) - YAxis.getTwinAxisPosition()) * YScale, xstepGrid * XScale, ystepGrid * YScale, (Math.max(XAxis.getAxis().getRange().getUpperBound(), XAxis.getTwinAxisPosition()) - XAxis.getTwinAxisPosition()) * XScale, (Math.max(YAxis.getAxis().getRange().getUpperBound(), YAxis.getTwinAxisPosition()) - YAxis.getTwinAxisPosition()) * YScale); formatter.format("%s", XAxis.toLatex(XScale)); formatter.format("%s", YAxis.toLatex(YScale)); for (int i = 0; i < datasetList.size(); i++) formatter.format("%s", datasetList.get(i).toLatex(XScale, YScale, XAxis.getTwinAxisPosition(), YAxis.getTwinAxisPosition(), XAxis.getAxis().getLowerBound(), XAxis.getAxis().getUpperBound(), YAxis.getAxis().getLowerBound(), YAxis.getAxis().getUpperBound())); formatter.format("\\end{tikzpicture}%n"); formatter.format("\\end{center}%n"); if (chart.getTitle() != null) { formatter.format("\\caption{"); formatter.format(chart.getTitle().getText()); formatter.format("}%n\\end{figure}%n"); } if (latexDocFlag) formatter.format("\\end{document}%n"); return formatter.toString(); }
From source file:com.itemanalysis.psychometrics.irt.estimation.ItemFitGeneralizedSX2.java
@Override public String toString() { StringBuilder sb = new StringBuilder(); Formatter f = new Formatter(sb); f.format("%5s", "SX2 "); f.format("%8.4f", getValue()); f.format("%2s", ""); f.format("%4d", (int) getDegreesOfFreedom()); f.format("%2s", ""); f.format("%1.4f", getPValue()); return f.toString(); }
From source file:com.itemanalysis.psychometrics.cmh.CochranMantelHaenszel.java
/** * From 1999 South Carolina PACT Technical Documentation * * * @return/*from w w w . ja v a 2s. c o m*/ */ // public String etsPolytomousClassification(double cochranMantelHaenszel, double pvalue, double polytomousEffectSize){ // String difClass = "BB"; // if(pvalue > 0.05){ // difClass = "AA "; // }else if(Math.abs(polytomousEffectSize)<=0.17){ // difClass = "AA "; // }else if(0.17<Math.abs(polytomousEffectSize) && Math.abs(polytomousEffectSize)<=0.25){ // difClass = "BB"; // if(polytomousEffectSize>=0) difClass += "+"; else difClass += "-"; // }else if(Math.abs(polytomousEffectSize)>0.25){ // difClass = "CC"; // if(polytomousEffectSize>=0) difClass += "+"; else difClass += "-"; // } // return difClass; // } public String printTables() { StringBuilder sb = new StringBuilder(); Formatter f = new Formatter(sb); Set<Double> keys = strata.keySet(); Iterator<Double> iter = keys.iterator(); CmhTable table = null; Double score = null; while (iter.hasNext()) { score = iter.next(); table = strata.get(score); f.format("%n"); f.format("%n"); f.format("%n"); f.format("%45s", "Score Level: "); f.format("%-10.4f", +score); f.format("%n"); f.format("%100s", table.toString()); f.format("%n"); } return f.toString(); }
From source file:com.itemanalysis.jmetrik.stats.itemanalysis.ItemAnalysis.java
public String getResults() throws IllegalArgumentException { StringBuilder headerBuffer = new StringBuilder(); Formatter f = new Formatter(headerBuffer); int outputMidpoint = 37; String s1 = String.format("%1$tB %1$te, %1$tY %tT", Calendar.getInstance()); int len = outputMidpoint + Double.valueOf(Math.floor(Double.valueOf(s1.length()).doubleValue() / 2.0)).intValue(); String dString = ""; dString = command.getDataString();/* www . j a va 2 s . c om*/ int len2 = outputMidpoint + Double.valueOf(Math.floor(Double.valueOf(dString.length()).doubleValue() / 2.0)).intValue(); f.format("%43s", "ITEM ANALYSIS"); f.format("%n"); f.format("%" + len2 + "s", dString); f.format("%n"); f.format("%" + len + "s", s1); f.format("%n"); f.format("%-70s", "======================================================================"); f.format("%n"); f.format("%n"); StringBuilder buffer = new StringBuilder(); buffer.append(f.toString()); int counter = 0; int nItems = item.size(); ClassicalItem temp; if (showItemStats) { for (Integer i : item.keySet()) { temp = item.get(i); if (counter == 0 || command.getSelectAllOption("options").isArgumentSelected("header")) { buffer.append(temp.printHeader()); } buffer.append(temp.toString()); if (command.getSelectAllOption("options").isArgumentSelected("all") || command.getSelectAllOption("options").isArgumentSelected("header")) { if (counter < (nItems - 1)) buffer.append("\n"); } counter++; } } buffer.append("======================================================================"); buffer.append("\n\n"); buffer.append(testSummary.print()); return buffer.toString(); }
From source file:com.linkedin.databus.client.netty.NettyHttpDatabusRelayConnection.java
private boolean populateStreamRequestUrl(StringBuilder uriString) { ObjectMapper objMapper = new ObjectMapper(); Formatter uriFmt = new Formatter(uriString); String filtersStr = null;// w w w . j a v a 2 s .c o m boolean error = false; if (null != _filter) { try { Map<Long, DbusKeyFilter> fMap = _filter.getFilterMap(); if (null != fMap && fMap.size() > 0) filtersStr = objMapper.writeValueAsString(fMap); } catch (IOException ex) { LOG.error("Got exception while serializing Filters. Filter Map was : " + _filter, ex); error = true; onRequestFailure(uriString.toString(), ex); } catch (RuntimeException ex) { LOG.error("Got exception while serializing Filters. Filter Map was : " + _filter, ex); error = true; onRequestFailure(uriString.toString(), ex); } } formRequest(uriFmt, filtersStr); return error; }
From source file:edu.uga.cs.fluxbuster.features.FeatureCalculator.java
/** * Calculates the previous cluster ratio feature for each cluster generated * on a specific run date and within the a specific window * * @param log_date the run date/* w w w . j ava 2 s. c om*/ * @param window the number of days previous to use in feature calculation * @return a table of results, the keys of the table are cluster ids and the * values are lists of two elements. The first element is the * last_growth_ratio_prev_clusters value and the second element is the * last_growth_prefix_ratio_prev_clusters value * @throws SQLException if there is and error calculating the feature */ public Hashtable<Integer, List<Double>> calculatePrevClusterRatios(Date log_date, int window) throws SQLException { Hashtable<Integer, List<Double>> retval = new Hashtable<Integer, List<Double>>(); ArrayList<Date> prevDates = getPrevDates(log_date, window); String query1 = properties.getProperty(PREVCLUSTER_QUERY1KEY); String query2 = properties.getProperty(PREVCLUSTER_QUERY2KEY); String logDateStr = df.format(log_date); String completequery = new String(); StringBuffer addQueryBuff = new StringBuffer(); for (int i = 0; i < prevDates.size(); i++) { String prevDateStr = df.format(prevDates.get(i)); StringBuffer querybuf = new StringBuffer(); Formatter formatter = new Formatter(querybuf); formatter.format(query1, logDateStr, logDateStr, prevDateStr, prevDateStr, prevDateStr); addQueryBuff.append(querybuf.toString()); if (i < prevDates.size() - 1) { addQueryBuff.append(" UNION "); } formatter.close(); } if (addQueryBuff.length() > 0) { StringBuffer querybuf = new StringBuffer(); Formatter formatter = new Formatter(querybuf); formatter.format(query2, logDateStr, logDateStr, addQueryBuff.toString()); completequery = querybuf.toString(); formatter.close(); } if (completequery.length() > 0) { ResultSet rs = null; try { rs = dbi.executeQueryWithResult(completequery); while (rs.next()) { ArrayList<Double> temp = new ArrayList<Double>(); temp.add(rs.getDouble(3)); temp.add(rs.getDouble(4)); retval.put(rs.getInt(1), temp); } } catch (Exception e) { if (log.isErrorEnabled()) { log.error(e); } } finally { if (rs != null && !rs.isClosed()) { rs.close(); } } Hashtable<Integer, Double> queryPerDomain = getQueriesPerDomain(log_date); for (Integer clusterid : retval.keySet()) { List<Double> values = retval.get(clusterid); values.set(0, values.get(0) / queryPerDomain.get(clusterid)); values.set(1, values.get(1) / queryPerDomain.get(clusterid)); } } return retval; }
From source file:fll.web.scoreEntry.ScoreEntry.java
/** * Output the body for the check_restrictions method. * /*from w ww . j a va 2s . com*/ * @param writer where to write * @throws IOException * @throws ParseException */ public static void generateCheckRestrictionsBody(final Writer writer, final ServletContext application) throws IOException, ParseException { final ChallengeDescription description = ApplicationAttributes.getChallengeDescription(application); final Formatter formatter = new Formatter(writer); final PerformanceScoreCategory performanceElement = description.getPerformance(); final Collection<String> goalsWithRestrictions = new LinkedList<String>(); final List<Restriction> restrictions = performanceElement.getRestrictions(); // find out which goals are involved in restrictions for (final Restriction restrictEle : restrictions) { goalsWithRestrictions.addAll(getGoalsInRestriction(restrictEle)); } // output variable declaration for each goal for (final String goalName : goalsWithRestrictions) { formatter.format(" var %s = \"\";%n", getElementIDForError(goalName)); } // output actual check of restriction for (int restrictIdx = 0; restrictIdx < restrictions.size(); ++restrictIdx) { final Restriction restrictEle = restrictions.get(restrictIdx); final double lowerBound = restrictEle.getLowerBound(); final double upperBound = restrictEle.getUpperBound(); final String message = restrictEle.getMessage(); final String polyString = polyToString(restrictEle); final String restrictValStr = String.format("restriction_%d_value", restrictIdx); formatter.format(" var %s = %s;%n", restrictValStr, polyString); formatter.format(" if(%s > %f || %s < %f) {%n", restrictValStr, upperBound, restrictValStr, lowerBound); // append error text to each error cell if the restriction is violated for (final String goalName : getGoalsInRestriction(restrictEle)) { final String errorId = getElementIDForError(goalName); formatter.format(" %s = %s + \" \" + \"%s\";%n", errorId, errorId, message); } formatter.format(" error_found = true;%n"); formatter.format(" }%n"); } // output text assignment for each goal involved in a restriction for (final String goalName : goalsWithRestrictions) { final String errorId = getElementIDForError(goalName); formatter.format(" replaceText(\"%s\", %s);%n", errorId, errorId); formatter.format(" if(%s.length > 0) {%n", errorId); formatter.format(" var el = document.getElementById(\"%s\");%n", errorId); formatter.format(" }%n"); formatter.format(" replaceText(\"%s\", %s);%n", errorId, errorId); formatter.format("%n"); } }
From source file:ch.entwine.weblounge.kernel.command.SiteCommand.java
/** * Does a search using the terms from the arguments and displays the search * hits on the console./*from ww w . jav a 2s . com*/ * * @param site * the site * @param args * search terms */ private void search(Site site, String[] args) { if (args.length == 0) { System.out.println("Please specify a search term"); System.err.println("Usage: site <id> search <terms>"); return; } // Build the search expression // TODO: Use AND? String text = StringUtils.join(args, " "); // Get hold of the content repository ContentRepository repository = site.getContentRepository(); SearchQuery query = new SearchQueryImpl(site); query.withVersion(Resource.LIVE); query.withFulltext(text.toString()); // Is it a page? Formatter formatter = null; try { SearchResult result = repository.find(query); // Format the output formatter = new Formatter(System.out); StringBuffer format = new StringBuffer(); int padding = Long.toString(result.getDocumentCount()).length(); format.append("%1$#").append(padding).append("s. %2$s\n"); // List results int i = 1; for (SearchResultItem item : result.getItems()) { formatter.format(format.toString(), i++, item.getUrl()); } System.out .println("Found " + result.getDocumentCount() + " results (" + result.getSearchTime() + " ms)"); } catch (ContentRepositoryException e) { System.err.println("Error trying to access the content repository"); e.printStackTrace(System.err); } finally { IOUtils.closeQuietly(formatter); } }
From source file:com.diablominer.DiabloMiner.DiabloMiner.java
void execute(String[] args) throws Exception { threads.add(Thread.currentThread()); Options options = new Options(); options.addOption("u", "user", true, "bitcoin host username"); options.addOption("p", "pass", true, "bitcoin host password"); options.addOption("o", "host", true, "bitcoin host IP"); options.addOption("r", "port", true, "bitcoin host port"); options.addOption("l", "url", true, "bitcoin host url"); options.addOption("x", "proxy", true, "optional proxy settings IP:PORT<:username:password>"); options.addOption("g", "worklifetime", true, "maximum work lifetime in seconds"); options.addOption("d", "debug", false, "enable debug output"); options.addOption("dt", "debugtimer", false, "run for 1 minute and quit"); options.addOption("D", "devices", true, "devices to enable, default all"); options.addOption("f", "fps", true, "target GPU execution timing"); options.addOption("na", "noarray", false, "turn GPU kernel array off"); options.addOption("v", "vectors", true, "vector size in GPU kernel"); options.addOption("w", "worksize", true, "override GPU worksize"); options.addOption("ds", "ksource", false, "output GPU kernel source and quit"); options.addOption("h", "help", false, "this help"); PosixParser parser = new PosixParser(); CommandLine line = null;/*ww w .j av a 2 s . c om*/ try { line = parser.parse(options, args); if (line.hasOption("help")) { throw new ParseException(""); } } catch (ParseException e) { System.out.println(e.getLocalizedMessage() + "\n"); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("DiabloMiner -u myuser -p mypassword [args]\n", "", options, "\nRemember to set rpcuser and rpcpassword in your ~/.bitcoin/bitcoin.conf " + "before starting bitcoind or bitcoin --daemon"); return; } String splitUrl[] = null; String splitUser[] = null; String splitPass[] = null; String splitHost[] = null; String splitPort[] = null; if (line.hasOption("url")) splitUrl = line.getOptionValue("url").split(","); if (line.hasOption("user")) splitUser = line.getOptionValue("user").split(","); if (line.hasOption("pass")) splitPass = line.getOptionValue("pass").split(","); if (line.hasOption("host")) splitHost = line.getOptionValue("host").split(","); if (line.hasOption("port")) splitPort = line.getOptionValue("port").split(","); int networkStatesCount = 0; if (splitUrl != null) networkStatesCount = splitUrl.length; if (splitUser != null) networkStatesCount = Math.max(splitUser.length, networkStatesCount); if (splitPass != null) networkStatesCount = Math.max(splitPass.length, networkStatesCount); if (splitHost != null) networkStatesCount = Math.max(splitHost.length, networkStatesCount); if (splitPort != null) networkStatesCount = Math.max(splitPort.length, networkStatesCount); if (networkStatesCount == 0) { error("You forgot to give any bitcoin connection info, please add either -l, or -u -p -o and -r"); System.exit(-1); } int j = 0; for (int i = 0; j < networkStatesCount; i++, j++) { String protocol = "http"; String host = "localhost"; int port = 8332; String path = "/"; String user = "diablominer"; String pass = "diablominer"; byte hostChain = 0; if (splitUrl != null && splitUrl.length > i) { String[] usernameFix = splitUrl[i].split("@", 3); if (usernameFix.length > 2) splitUrl[i] = usernameFix[0] + "+++++" + usernameFix[1] + "@" + usernameFix[2]; URL url = new URL(splitUrl[i]); if (url.getProtocol() != null && url.getProtocol().length() > 1) protocol = url.getProtocol(); if (url.getHost() != null && url.getHost().length() > 1) host = url.getHost(); if (url.getPort() != -1) port = url.getPort(); if (url.getPath() != null && url.getPath().length() > 1) path = url.getPath(); if (url.getUserInfo() != null && url.getUserInfo().length() > 1) { String[] userPassSplit = url.getUserInfo().split(":"); user = userPassSplit[0].replace("+++++", "@"); if (userPassSplit.length > 1 && userPassSplit[1].length() > 1) pass = userPassSplit[1]; } } if (splitUser != null && splitUser.length > i) user = splitUser[i]; if (splitPass != null && splitPass.length > i) pass = splitPass[i]; if (splitHost != null && splitHost.length > i) host = splitHost[i]; if (splitPort != null && splitPort.length > i) port = Integer.parseInt(splitPort[i]); NetworkState networkState; try { networkState = new JSONRPCNetworkState(this, new URL(protocol, host, port, path), user, pass, hostChain); } catch (MalformedURLException e) { throw new DiabloMinerFatalException(this, "Malformed connection paramaters"); } if (networkStateHead == null) { networkStateHead = networkStateTail = networkState; } else { networkStateTail.setNetworkStateNext(networkState); networkStateTail = networkState; } } networkStateTail.setNetworkStateNext(networkStateHead); if (line.hasOption("proxy")) { final String[] proxySettings = line.getOptionValue("proxy").split(":"); if (proxySettings.length >= 2) { proxy = new Proxy(Type.HTTP, new InetSocketAddress(proxySettings[0], Integer.valueOf(proxySettings[1]))); } if (proxySettings.length >= 3) { Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(proxySettings[2], proxySettings[3].toCharArray()); } }); } } if (line.hasOption("worklifetime")) workLifetime = Integer.parseInt(line.getOptionValue("worklifetime")) * 1000; if (line.hasOption("debug")) debug = true; if (line.hasOption("debugtimer")) { debugtimer = true; } if (line.hasOption("devices")) { String devices[] = line.getOptionValue("devices").split(","); enabledDevices = new HashSet<String>(); for (String s : devices) { enabledDevices.add(s); if (Integer.parseInt(s) == 0) { error("Do not use 0 with -D, devices start at 1"); System.exit(-1); } } } if (line.hasOption("fps")) { GPUTargetFPS = Float.parseFloat(line.getOptionValue("fps")); if (GPUTargetFPS < 0.1) { error("--fps argument is too low, adjusting to 0.1"); GPUTargetFPS = 0.1; } } if (line.hasOption("noarray")) { GPUNoArray = true; } if (line.hasOption("worksize")) GPUForceWorkSize = Integer.parseInt(line.getOptionValue("worksize")); if (line.hasOption("vectors")) { String tempVectors[] = line.getOptionValue("vectors").split(","); GPUVectors = new Integer[tempVectors.length]; try { for (int i = 0; i < GPUVectors.length; i++) { GPUVectors[i] = Integer.parseInt(tempVectors[i]); if (GPUVectors[i] > 16) { error("DiabloMiner now uses comma-seperated vector layouts, use those instead"); System.exit(-1); } else if (GPUVectors[i] != 1 && GPUVectors[i] != 2 && GPUVectors[i] != 3 && GPUVectors[i] != 4 && GPUVectors[i] != 8 && GPUVectors[i] != 16) { error(GPUVectors[i] + " is not a vector length of 1, 2, 3, 4, 8, or 16"); System.exit(-1); } } Arrays.sort(GPUVectors, Collections.reverseOrder()); } catch (NumberFormatException e) { error("Cannot parse --vector argument(s)"); System.exit(-1); } } else { GPUVectors = new Integer[1]; GPUVectors[0] = 1; } if (line.hasOption("ds")) GPUDebugSource = true; info("Started"); StringBuilder list = new StringBuilder(networkStateHead.getQueryUrl().toString()); NetworkState networkState = networkStateHead.getNetworkStateNext(); while (networkState != networkStateHead) { list.append(", " + networkState.getQueryUrl()); networkState = networkState.getNetworkStateNext(); } info("Connecting to: " + list); long previousHashCount = 0; double previousAdjustedHashCount = 0.0; long previousAdjustedStartTime = startTime = (now()) - 1; StringBuilder hashMeter = new StringBuilder(80); Formatter hashMeterFormatter = new Formatter(hashMeter); int deviceCount = 0; List<List<? extends DeviceState>> allDeviceStates = new ArrayList<List<? extends DeviceState>>(); List<? extends DeviceState> GPUDeviceStates = new GPUHardwareType(this).getDeviceStates(); deviceCount += GPUDeviceStates.size(); allDeviceStates.add(GPUDeviceStates); while (running.get()) { for (List<? extends DeviceState> deviceStates : allDeviceStates) { for (DeviceState deviceState : deviceStates) { deviceState.checkDevice(); } } long now = now(); long currentHashCount = hashCount.get(); double adjustedHashCount = (double) (currentHashCount - previousHashCount) / (double) (now - previousAdjustedStartTime); double hashLongCount = (double) currentHashCount / (double) (now - startTime) / 1000.0; if (now - startTime > TIME_OFFSET * 2) { double averageHashCount = (adjustedHashCount + previousAdjustedHashCount) / 2.0 / 1000.0; hashMeter.setLength(0); if (!debug) { hashMeterFormatter.format("\rmhash: %.1f/%.1f | accept: %d | reject: %d | hw error: %d", averageHashCount, hashLongCount, blocks.get(), rejects.get(), hwErrors.get()); } else { hashMeterFormatter.format("\rmh: %.1f/%.1f | a/r/hwe: %d/%d/%d | gh: ", averageHashCount, hashLongCount, blocks.get(), rejects.get(), hwErrors.get()); double basisAverage = 0.0; for (List<? extends DeviceState> deviceStates : allDeviceStates) { for (DeviceState deviceState : deviceStates) { hashMeterFormatter.format("%.1f ", deviceState.getDeviceHashCount() / 1000.0 / 1000.0 / 1000.0); basisAverage += deviceState.getBasis(); } } basisAverage = 1000 / (basisAverage / deviceCount); hashMeterFormatter.format("| fps: %.1f", basisAverage); } System.out.print(hashMeter); } else { System.out.print("\rWaiting..."); } if (now() - TIME_OFFSET * 2 > previousAdjustedStartTime) { previousHashCount = currentHashCount; previousAdjustedHashCount = adjustedHashCount; previousAdjustedStartTime = now - 1; } if (debugtimer && now() > startTime + 60 * 1000) { System.out.print("\n"); info("Debug timer is up, quitting..."); System.exit(0); } try { if (now - startTime > TIME_OFFSET) Thread.sleep(1000); else Thread.sleep(1); } catch (InterruptedException e) { } } hashMeterFormatter.close(); }
From source file:com.itemanalysis.psychometrics.cmh.CochranMantelHaenszel.java
public String printHeader() { StringBuilder buffer = new StringBuilder(); Formatter f = new Formatter(buffer); f.format("%-10s", " Item"); f.format("%2s", " "); f.format("%10s", "Chi-square"); f.format("%2s", " "); f.format("%7s", "p-value"); f.format("%2s", " "); f.format("%7s", "Valid N"); f.format("%2s", " "); f.format("%28s", " E.S. (95% C.I.) "); f.format("%2s", " "); f.format("%5s", "Class"); f.format("%2s", " "); f.format("%n"); f.format("%-10s", "----------"); f.format("%2s", " "); f.format("%10s", "----------"); f.format("%2s", " "); f.format("%7s", "-------"); f.format("%2s", " "); f.format("%7s", "-------"); f.format("%2s", " "); f.format("%28s", "----------------------------"); f.format("%2s", " "); f.format("%5s", "-----"); f.format("%2s", " "); f.format("%n"); return f.toString(); }