/** * @param destinationUnit The unit to be converted to * @return The converted value as result */ public String mapToUnit(Unit destinationUnit) { return mapToUnit(mLengthString, destinationUnit); }
/** * Returns the value of the given length as double. * @param length the <code>double</code> value should be obtained from * @return Returns a <code>double</code> value representing the specified Length value. */ public static double parseDouble(String length) { return parseDouble(length, null); }
/** * Returns a Length instance representing the specified String value * * @param stringValue * a String value * @return return a Length instance representing stringValue * @throws NumberFormatException if the given argument is not a valid Length */ public static Length valueOf(String stringValue) throws NumberFormatException { return new Length(stringValue); }
/** * Construct Length by the parsing the given string * * @param length * The String to be parsed into Length * @throws NumberFormatException if the given argument is not a valid Length */ public Length(String length) throws NumberFormatException { if (!isValid(length)) { throw new NumberFormatException("parameter is invalid for datatype Length"); } mLengthString = length; }
/** * Construct Length by the parsing the given string * * @param length * The String to be parsed into Length * @throws NumberFormatException if the given argument is not a valid Length */ public Length(String length) throws NumberFormatException { if (!isValid(length)) { throw new NumberFormatException("parameter is invalid for datatype Length"); } mLengthString = length; }
/** * Returns the value of the given length as int. * @param length the <code>int</code> value should be obtained from * @return Returns a <code>int</code> value representing the specified Length value. */ public static int parseInt(String length) { return (int) parseDouble(length, null); }
/** * @param destinationUnit The unit to be converted to * @return The converted value as result */ public String mapToUnit(Unit destinationUnit) { return mapToUnit(mLengthString, destinationUnit); }
/** * Construct Length by the parsing the given string * * @param length * The String to be parsed into Length * @throws NumberFormatException if the given argument is not a valid Length */ public Length(String length) throws NumberFormatException { if (!isValid(length)) { throw new NumberFormatException("parameter is invalid for datatype Length"); } mLengthString = length; }
/** * Returns a Length instance representing the specified String value * * @param stringValue * a String value * @return return a Length instance representing stringValue * @throws NumberFormatException if the given argument is not a valid Length */ public static Length valueOf(String stringValue) throws NumberFormatException { return new Length(stringValue); }
/** * Maps the a length string to a different unit * * @param length The value to be mapped * @param destinationUnit The unit to be converted to * @return The converted value without unit suffix as Double */ public static long parseLong(String length, Unit destinationUnit) { return (long) parseDouble(length, destinationUnit); }
/** * @param destinationUnit The unit to be converted to * @return The converted value as result */ public String mapToUnit(Unit destinationUnit) { return mapToUnit(mLengthString, destinationUnit); }
/** * Returns a Length instance representing the specified String value * * @param stringValue * a String value * @return return a Length instance representing stringValue * @throws NumberFormatException if the given argument is not a valid Length */ public static Length valueOf(String stringValue) throws NumberFormatException { return new Length(stringValue); }
/** * Maps the a length string to a different unit * * @param length The value to be mapped * @param destinationUnit The unit to be converted to * @return The converted value without unit suffix as Double */ public static long parseLong(String length, Unit destinationUnit) { return (long) parseDouble(length, destinationUnit); }
/** * Returns the provided Millimeter value as Inch value * * @param value the value to set the attribute value to (in Millimeter) */ private static String getInchValue(double value) { // build the string for mm final String mmValueString = value + Unit.MILLIMETER.abbr(); // convert the length to inch final String inchValueString = Length.mapToUnit(mmValueString, Unit.INCH); // return the value return inchValueString; }
/** * Returns the value of the given length as double. * @param length the <code>double</code> value should be obtained from * @return Returns a <code>double</code> value representing the specified Length value. */ public static double parseDouble(String length) { return parseDouble(length, null); }
/** * Returns the provided Millimeter value as Inch value * * @param value the value to set the attribute value to (in Millimeter) */ private static String getInchValue(double value) { // build the string for mm final String mmValueString = value + Unit.MILLIMETER.abbr(); // convert the length to inch final String inchValueString = Length.mapToUnit(mmValueString, Unit.INCH); // return the value return inchValueString; }
/** * Returns the value of the given length as double. * @param length the <code>double</code> value should be obtained from * @return Returns a <code>double</code> value representing the specified Length value. */ public static double parseDouble(String length) { return parseDouble(length, null); }
/** * Returns the provided Millimeter value as Inch value * * @param value * the value to set the attribute value to (in Millimeter) */ private static String getInchValue(double value) { // build the string for mm final String mmValueString = value + Unit.MILLIMETER.abbr(); // convert the length to inch final String inchValueString = Length.mapToUnit(mmValueString, Unit.INCH); // return the value return inchValueString; }
/** * Returns the value of the given length as int. * @param length the <code>int</code> value should be obtained from * @param destinationUnit The unit to be converted to * @return Returns a <code>int</code> value representing the specified Length value. */ public static int parseInt(String length, Unit destinationUnit) { return (int) parseDouble(length, destinationUnit); }
/** * Returns the provided Millimeter value as Inch value * * @param value * the value to set the attribute value to (in Millimeter) */ private static String getInchValue(double value) { // build the string for mm final String mmValueString = value + Unit.MILLIMETER.abbr(); // convert the length to inch final String inchValueString = Length.mapToUnit(mmValueString, Unit.INCH); // return the value return inchValueString; }