Esempio n. 1
0
File: U.java Progetto: abinns/bdmds
 /**
  * Simple confirmation function, returns a true or false in response to the passed message.
  *
  * @param message the question to ask the person.
  * @return true or false depending on the user response.
  */
 public static boolean confirm(String message) {
   U.p(message);
   String in = U.input.next();
   while (!in.equalsIgnoreCase("yes")
       && !in.equalsIgnoreCase("y")
       && !in.equalsIgnoreCase("no")
       && !in.equalsIgnoreCase("n")) {
     U.p("Invalid response, please input 'yes' or 'no'");
     in = U.input.next();
   }
   return in.equalsIgnoreCase("yes") || in.equalsIgnoreCase("y");
 }
Esempio n. 2
0
File: U.java Progetto: abinns/bdmds
 public static void p(float[][] arr) {
   int i;
   StringBuilder[] grid = new StringBuilder[arr[0].length];
   for (i = 0; i < grid.length; i++) grid[i] = new StringBuilder();
   for (float[] col : arr) {
     i = 0;
     for (float cur : col) grid[i++].append("," + cur);
   }
   for (StringBuilder cur : grid) cur.deleteCharAt(0);
   StringBuilder res = new StringBuilder("\n");
   for (StringBuilder cur : grid) {
     res.append(cur);
     res.append('\n');
   }
   U.p(res.toString());
 }
Esempio n. 3
0
File: U.java Progetto: abinns/bdmds
 /**
  * Prints the specified object as general output.
  *
  * @param in the object to print.
  */
 public static void p(Object in) {
   U.p(in.toString());
 }
Esempio n. 4
0
File: U.java Progetto: abinns/bdmds
 /**
  * Prints the specified integer as simple output
  *
  * @param in the score to print out.
  */
 public static void p(int in) {
   U.p(in + "");
 }
Esempio n. 5
0
File: U.java Progetto: abinns/bdmds
 public static void p(double[] arr) {
   U.p(Arrays.toString(arr));
 }