/** * Tell whether the string contains a positive or negative number delta, i.e., a number with an obligatory + or - sign. */ private boolean isNumberDelta(String string) { String s = string.trim(); if (s.length() < 2) return false; return (s.charAt(0) == '+' || s.charAt(0) == '-') && isUnsignedNumber(s.substring(1)); }
/** * Tell whether the string contains a positive or negative number delta, i.e., a number with an obligatory + or - sign. */ private boolean isNumberDelta(String string) { String s = string.trim(); if (s.length() < 2) return false; return (s.charAt(0) == '+' || s.charAt(0) == '-') && isUnsignedNumber(s.substring(1)); }
/** * Tell whether the string contains an unsigned semitones expression, such as "12st" or "5.4st". */ private boolean isUnsignedSemitones(String string) { String s = string.trim(); if (s.length() < 3) return false; return s.substring(s.length() - 2).equals("st") && isUnsignedNumber(s.substring(0, s.length() - 2)); }
/** * Tell whether the string contains an unsigned semitones expression, such as "12st" or "5.4st". */ private boolean isUnsignedSemitones(String string) { String s = string.trim(); if (s.length() < 3) return false; return s.substring(s.length() - 2).equals("st") && isUnsignedNumber(s.substring(0, s.length() - 2)); }
/** * For a string containing an unsigned number as judged by <code>isUnsignedNumber()</code>, return the numerical value, * rounded to an integer. * * @return the numeric value, rounded to an integer, or 0 if the string is not a valid unsigned number. */ private int getUnsignedNumber(String string) { String s = string.trim(); if (!isUnsignedNumber(s)) return 0; double value = 0; try { value = Double.parseDouble(s); } catch (NumberFormatException e) { logger.warn("Unexpected number value `" + s + "'"); } return (int) Math.round(value); }
/** * For a string containing an unsigned number as judged by <code>isUnsignedNumber()</code>, return the numerical value, * rounded to an integer. * * @return the numeric value, rounded to an integer, or 0 if the string is not a valid unsigned number. */ private int getUnsignedNumber(String string) { String s = string.trim(); if (!isUnsignedNumber(s)) return 0; double value = 0; try { value = Double.parseDouble(s); } catch (NumberFormatException e) { logger.warn("Unexpected number value `" + s + "'"); } return (int) Math.round(value); }
newVolume = 100; settings.setVolume(newVolume); } else if (isUnsignedNumber(sVolume)) { settings.setVolume(getUnsignedNumber(sVolume)); } else if (sVolume.equals("silent")) {
newVolume = 100; settings.setVolume(newVolume); } else if (isUnsignedNumber(sVolume)) { settings.setVolume(getUnsignedNumber(sVolume)); } else if (sVolume.equals("silent")) {
/** * Tell whether the string contains a positive or negative number delta, i.e., a number with an obligatory + or - sign. */ private boolean isNumberDelta(String string) { String s = string.trim(); if (s.length() < 2) return false; return (s.charAt(0) == '+' || s.charAt(0) == '-') && isUnsignedNumber(s.substring(1)); }
/** * Tell whether the string contains an unsigned semitones expression, such as "12st" or "5.4st". */ private boolean isUnsignedSemitones(String string) { String s = string.trim(); if (s.length() < 3) return false; return s.substring(s.length() - 2).equals("st") && isUnsignedNumber(s.substring(0, s.length() - 2)); }
/** * For a string containing an unsigned number as judged by <code>isUnsignedNumber()</code>, return the numerical value, * rounded to an integer. * * @return the numeric value, rounded to an integer, or 0 if the string is not a valid unsigned number. */ private int getUnsignedNumber(String string) { String s = string.trim(); if (!isUnsignedNumber(s)) return 0; double value = 0; try { value = Double.parseDouble(s); } catch (NumberFormatException e) { logger.warn("Unexpected number value `" + s + "'"); } return (int) Math.round(value); }
newVolume = 100; settings.setVolume(newVolume); } else if (isUnsignedNumber(sVolume)) { settings.setVolume(getUnsignedNumber(sVolume)); } else if (sVolume.equals("silent")) {