/** * Compares the two given sets of options. * * @param options1 the first set of options * @param options2 the second set of options * @throws Exception if the two sets of options differ */ protected void compareOptions(String[] options1, String[] options2) throws Exception { if (options1 == null) { throw new Exception("first set of options is null!"); } if (options2 == null) { throw new Exception("second set of options is null!"); } if (options1.length != options2.length) { throw new Exception("problem found!\n" + "First set: " + printOptions(options1) + '\n' + "Second set: " + printOptions(options2) + '\n' + "options differ in length"); } for (int i = 0; i < options1.length; i++) { if (!options1[i].equals(options2[i])) { throw new Exception("problem found!\n" + "\tFirst set: " + printOptions(options1) + '\n' + "\tSecond set: " + printOptions(options2) + '\n' + '\t' + options1[i] + " != " + options2[i]); } } }
/** * Compares the two given sets of options. * * @param options1 the first set of options * @param options2 the second set of options * @throws Exception if the two sets of options differ */ protected void compareOptions(String[] options1, String[] options2) throws Exception { if (options1 == null) { throw new Exception("first set of options is null!"); } if (options2 == null) { throw new Exception("second set of options is null!"); } if (options1.length != options2.length) { throw new Exception("problem found!\n" + "First set: " + printOptions(options1) + '\n' + "Second set: " + printOptions(options2) + '\n' + "options differ in length"); } for (int i = 0; i < options1.length; i++) { if (!options1[i].equals(options2[i])) { throw new Exception("problem found!\n" + "\tFirst set: " + printOptions(options1) + '\n' + "\tSecond set: " + printOptions(options2) + '\n' + '\t' + options1[i] + " != " + options2[i]); } } }
println("--> Info"); print("Default options: "); println(printOptions(getDefaultOptions())); print("User options: "); println(printOptions(getUserOptions()));
println("--> Info"); print("Default options: "); println(printOptions(getDefaultOptions())); print("User options: "); println(printOptions(getUserOptions()));
/** * checks whether the user-supplied options can be processed completely or * some "left-over" options remain * * @return index 0 is true if the test was passed, index 1 is always false */ public boolean checkRemainingOptions() { boolean result; String[] options; print("Remaining options..."); options = getUserOptions(); try { getDefaultHandler().setOptions(options); if (getDebug()) { println("\n remaining: " + printOptions(options)); } println("yes"); result = true; } catch (Exception e) { println("no"); result = false; if (getDebug()) { println(e); } } return result; }
/** * checks whether the user-supplied options can be processed completely or * some "left-over" options remain * * @return index 0 is true if the test was passed, index 1 is always false */ public boolean checkRemainingOptions() { boolean result; String[] options; print("Remaining options..."); options = getUserOptions(); try { getDefaultHandler().setOptions(options); if (getDebug()) { println("\n remaining: " + printOptions(options)); } println("yes"); result = true; } catch (Exception e) { println("no"); result = false; if (getDebug()) { println(e); } } return result; }
println(printOptions(userOptions));
println(printOptions(userOptions));