Refine search
@Override public void update(long bytesRead, long contentLength, boolean done) { if (done) { System.out.println("completed"); } else { if (firstUpdate) { firstUpdate = false; if (contentLength == -1) { System.out.println("content-length: unknown"); } else { System.out.format("content-length: %d\n", contentLength); } } System.out.println(bytesRead); if (contentLength != -1) { System.out.format("%d%% done\n", (100 * bytesRead) / contentLength); } } } };
public void printCoefficients(int[] indices, String[] factors) { if (coeffs != null) { System.out.println("Linear regression:"); if (b0Term) { System.out.format(" %.5f\n", coeffs[0]); for (int j = 1; j < coeffs.length; j++) System.out.format(" %.5f (%s)\n", coeffs[j], factors[indices[j - 1]]); } else { for (int j = 0; j < coeffs.length; j++) System.out.format(" %.5f (%s)\n", coeffs[j], factors[indices[j]]); } } else System.out.println("There is no coefficients to print."); }
public void printCoefficients(int[] indices, String[] factors) { if (coeffs != null) { System.out.println("Linear regression:"); if (b0Term) { System.out.format(" %.5f\n", coeffs[0]); for (int j = 1; j < coeffs.length; j++) System.out.format(" %.5f (%s)\n", coeffs[j], factors[indices[j - 1]]); } else { for (int j = 0; j < coeffs.length; j++) System.out.format(" %.5f (%s)\n", coeffs[j], factors[indices[j]]); } } else System.out.println("There is no coefficients to print."); }
private static void printTasks(String target) { System.out.format("The following tasks are available to run on %s:%n", target); Collection<ValidationTask> tasks = TARGET_TASKS.get(target); for (ValidationTask task: tasks) { String taskName = TASKS.get(task); System.out.printf("%s: %s%n", taskName, TASK_DESCRIPTIONS.get(taskName)); } System.out.println(); }
public void printCoefficients() { if (coeffs != null) { System.out.println("SoP coefficients (factor : factorIndex in FeatureDefinition)"); for (int j = 0; j < coeffs.length; j++) System.out.format(" %.5f (%s : %d)\n", coeffs[j], factors[j], factorsIndex[j]); } else System.out.println("There is no coefficients to print (coeffs=null)."); }
public void printCoefficients() { if (coeffs != null) { System.out.println("SoP coefficients (factor : factorIndex in FeatureDefinition)"); for (int j = 0; j < coeffs.length; j++) System.out.format(" %.5f (%s : %d)\n", coeffs[j], factors[j], factorsIndex[j]); } else System.out.println("There is no coefficients to print (coeffs=null)."); }
public static void printProperties(String message, Properties properties, PrintStream stream) { if (message != null) { stream.println(message); } if (properties.isEmpty()) { stream.println(" [empty]"); } else { List<Map.Entry<String, String>> entries = getSortedEntries(properties); for (Map.Entry<String, String> entry : entries) { if ( ! "".equals(entry.getKey())) { stream.format(" %-30s = %s%n", entry.getKey(), entry.getValue()); } } } stream.println(); }
private void dumpConfiguration() { System.out.println("-------------------------------------------"); System.out.println("Configuration for container " + this); System.out.println("-------------------------------------------"); LocalConfiguration configuration = getConfiguration(); System.out.format("Name: %s%n", configuration); System.out.format("Class: %s%n", configuration.getClass()); System.out.println("Properties:"); configuration.getProperties().entrySet().forEach(System.out::println); System.out.println("-------------------------------------------"); System.out.println(""); }
/** * Prints usage for all commands. */ protected void printUsage() { System.out.println("Usage: alluxio " + getShellName() + " [generic options]"); SortedSet<String> sortedCmds = new TreeSet<>(mCommands.keySet()); for (String cmd : sortedCmds) { System.out.format("%-60s%n", "\t [" + mCommands.get(cmd).getUsage() + "]"); } } }
@NoWarning("FS") public static void falsePositive() { System.out.printf("last updated %1$tY-%1$tm-%1$te %1$tH:%1$tM:%1$tS.%1$tL, threshold %2$d min.%n", new Date(), 20); java.util.Formatter f = new java.util.Formatter(); System.out.println(String.format("%d %s", 8, "boy")); // no warning System.out.println(f.format("%d %s %f %d %f %d", 8, "boy", 7.7, 9, 9.9, 10)); // no // warning System.out.printf("%d", 7); // no warning System.out.format("%d", 8); // no warning System.out.println(f.format("%d %%%%%s %% %f %d %%%f %%%d", 8, "boy", 7.7, 9, 9.9, 10)); // no // warning System.out.println(String.format("%d %n", 1)); // no warning (%n does // not consume an // argument) }
public static void main(String[] args) { // This prints out the values of the probability density function for N(2.0.0.6) // A graph of this is here: http://www.cs.bu.edu/fac/snyder/cs237/Lecture%20Materials/GaussianExampleJava.png double mu = 2.0; double sigma = 1.5; System.out.println("PDF for N(2.0,0.6) in range [-4..8]:"); for (double z = -4.0; z <= 8.0; z += 0.2) System.out.format("%.1f\t%.4f\n", z, pdf(z, mu, sigma)); // This prints out the values of the cumulative density function for N(2.0.0.6) // A graph of this is here: http://www.cs.bu.edu/fac/snyder/cs237/Lecture%20Materials/GaussianExample2Java.png System.out.println("CDF for N(2.0,0.6) in range [-4..8]:"); for (double z = -4.0; z <= 8.0; z += 0.2) System.out.format("%.1f\t%.4f\n", z, cdf(z, mu, sigma)); // Calculates the probability that for N(2.0, 0.6), the random variable produces a value less than 3.45 System.out.format("\nIf X ~ N(2.0, 1.5), then P(X <= 3.2) is %.4f\n", cdf(3.2, 2.0, 1.5)); // Calculates the value x for X ~ N(2.0, 0.6) which is the 78.81% cutoff (i.e., 78.81% of the values lie below x and 21.19% above). System.out.format("\nIf X ~ N(2.0, 1.5), then x such that P(X <= x ) = 0.7881 is %.4f\n", PhiInverse(0.7881, 2.0, 1.5)); }
public static void main(final String[] args) throws Exception { System.out.println("capacity:" + ConcurrentQueueByTypeFactory.QUEUE_CAPACITY + " reps:" + REPETITIONS); final ConcurrentQueue<Integer> queue = ConcurrentQueueByTypeFactory.createQueue(); final long[] results = new long[20]; for (int i = 0; i < 20; i++) { System.gc(); results[i] = performanceRun(i, queue); } // only average last 10 results for summary long sum = 0; for (int i = 10; i < 20; i++) { sum += results[i]; } System.out.format("summary,QueuePerfTest,%s,%d\n", queue.getClass().getSimpleName(), sum / 10); }