示例#1
0
文件: U.java 项目: 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");
 }
示例#2
0
文件: U.java 项目: 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());
 }
示例#3
0
文件: U.java 项目: 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());
 }
示例#4
0
文件: U.java 项目: 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 + "");
 }
示例#5
0
文件: U.java 项目: abinns/bdmds
 public static void p(double[] arr) {
   U.p(Arrays.toString(arr));
 }