Ignore:
Timestamp:
2020-03-10T23:08:20+01:00 (4 years ago)
Author:
Don-vip
Message:

add MapCSS conversion functions: to_boolean, to_byte, to_short, to_int, to_long, to_float, to_double

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java

    r15723 r16110  
    11921192        return new LatLon(lat, lon).equalsEpsilon(center(env));
    11931193    }
     1194
     1195    /**
     1196     * Parses the string argument as a boolean.
     1197     * @param value the {@code String} containing the boolean representation to be parsed
     1198     * @return the boolean represented by the string argument
     1199     * @see Boolean#parseBoolean
     1200     * @since 16110
     1201     */
     1202    public static boolean to_boolean(String value) { // NO_UCD (unused code)
     1203        return Boolean.parseBoolean(value);
     1204    }
     1205
     1206    /**
     1207     * Parses the string argument as a byte.
     1208     * @param value the {@code String} containing the byte representation to be parsed
     1209     * @return the byte represented by the string argument
     1210     * @see Byte#parseByte
     1211     * @since 16110
     1212     */
     1213    public static byte to_byte(String value) { // NO_UCD (unused code)
     1214        return Byte.parseByte(value);
     1215    }
     1216
     1217    /**
     1218     * Parses the string argument as a short.
     1219     * @param value the {@code String} containing the short representation to be parsed
     1220     * @return the short represented by the string argument
     1221     * @see Short#parseShort
     1222     * @since 16110
     1223     */
     1224    public static short to_short(String value) { // NO_UCD (unused code)
     1225        return Short.parseShort(value);
     1226    }
     1227
     1228    /**
     1229     * Parses the string argument as an int.
     1230     * @param value the {@code String} containing the int representation to be parsed
     1231     * @return the int represented by the string argument
     1232     * @see Integer#parseInt
     1233     * @since xxx
     1234     */
     1235    public static int to_int(String value) { // NO_UCD (unused code)
     1236        return Integer.parseInt(value);
     1237    }
     1238
     1239    /**
     1240     * Parses the string argument as a long.
     1241     * @param value the {@code String} containing the long representation to be parsed
     1242     * @return the long represented by the string argument
     1243     * @see Long#parseLong
     1244     * @since 16110
     1245     */
     1246    public static long to_long(String value) { // NO_UCD (unused code)
     1247        return Long.parseLong(value);
     1248    }
     1249
     1250    /**
     1251     * Parses the string argument as a float.
     1252     * @param value the {@code String} containing the float representation to be parsed
     1253     * @return the float represented by the string argument
     1254     * @see Float#parseFloat
     1255     * @since 16110
     1256     */
     1257    public static float to_float(String value) { // NO_UCD (unused code)
     1258        return Float.parseFloat(value);
     1259    }
     1260
     1261    /**
     1262     * Parses the string argument as a double.
     1263     * @param value the {@code String} containing the double representation to be parsed
     1264     * @return the double represented by the string argument
     1265     * @see Double#parseDouble
     1266     * @since 16110
     1267     */
     1268    public static double to_double(String value) { // NO_UCD (unused code)
     1269        return Double.parseDouble(value);
     1270    }
    11941271}
Note: See TracChangeset for help on using the changeset viewer.