private Object toObject (String key, String value) { if (key.endsWith("b")) return new Boolean(Boolean.parseBoolean(value)); if (key.endsWith("i")) return new Integer(Integer.parseInt(value)); if (key.endsWith("l")) return new Long(Long.parseLong(value)); if (key.endsWith("f")) return new Float(Float.parseFloat(value)); return value; }
private Object toObject (String key, String value) { if (key.endsWith("b")) return new Boolean(Boolean.parseBoolean(value)); if (key.endsWith("i")) return new Integer(Integer.parseInt(value)); if (key.endsWith("l")) return new Long(Long.parseLong(value)); if (key.endsWith("f")) return new Float(Float.parseFloat(value)); return value; }
public Map<String, ?> get () { Map<String, Object> map = new HashMap<String, Object>(); for (Entry<Object, Object> val : properties.entrySet()) { if (val.getValue() instanceof Boolean) map.put((String)val.getKey(), (Boolean)Boolean.parseBoolean((String)val.getValue())); if (val.getValue() instanceof Integer) map.put((String)val.getKey(), (Integer)Integer.parseInt((String)val.getValue())); if (val.getValue() instanceof Long) map.put((String)val.getKey(), (Long)Long.parseLong((String)val.getValue())); if (val.getValue() instanceof String) map.put((String)val.getKey(), (String)val.getValue()); if (val.getValue() instanceof Float) map.put((String)val.getKey(), (Float)Float.parseFloat((String)val.getValue())); } return map; }
@Override public float convertToFloat(CharSequence value) { if (value instanceof AsciiString) { return ((AsciiString) value).parseFloat(); } return Float.parseFloat(value.toString()); }
public float getFloatAttribute (String name, float defaultValue) { String value = getAttribute(name, null); if (value == null) return defaultValue; return Float.parseFloat(value); }
/** Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name. * @throws GdxRuntimeException if no attribute or child was not found. */ public float getFloat (String name, float defaultValue) { String value = get(name, null); if (value == null) return defaultValue; return Float.parseFloat(value); }
/** Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name. * @throws GdxRuntimeException if no attribute or child was not found. */ public float getFloat (String name, float defaultValue) { String value = get(name, null); if (value == null) return defaultValue; return Float.parseFloat(value); }
@Override public Map<String, ?> get () { Map<String, Object> map = new HashMap<String, Object>(); for (Entry<Object, Object> val : properties.entrySet()) { if (val.getValue() instanceof Boolean) map.put((String)val.getKey(), (Boolean)Boolean.parseBoolean((String)val.getValue())); if (val.getValue() instanceof Integer) map.put((String)val.getKey(), (Integer)Integer.parseInt((String)val.getValue())); if (val.getValue() instanceof Long) map.put((String)val.getKey(), (Long)Long.parseLong((String)val.getValue())); if (val.getValue() instanceof String) map.put((String)val.getKey(), (String)val.getValue()); if (val.getValue() instanceof Float) map.put((String)val.getKey(), (Float)Float.parseFloat((String)val.getValue())); } return map; }
public float getFloatAttribute (String name, float defaultValue) { String value = getAttribute(name, null); if (value == null) return defaultValue; return Float.parseFloat(value); }
public float parseFloat(int start, int end) { return Float.parseFloat(toString(start, end)); }
public float floatValue() { String strVal = numberString(); float floatValue = Float.parseFloat(strVal); if (floatValue == 0 || floatValue == Float.POSITIVE_INFINITY) { char c0 = strVal.charAt(0); if (c0 > '0' && c0 <= '9') { throw new JSONException("float overflow : " + strVal); } } return floatValue; }
/** Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name. * @throws GdxRuntimeException if no attribute or child was not found. */ public float getFloat (String name) { String value = get(name, null); if (value == null) throw new GdxRuntimeException("Element " + this.name + " doesn't have attribute or child: " + name); return Float.parseFloat(value); }
/** Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name. * @throws GdxRuntimeException if no attribute or child was not found. */ public float getFloat (String name) { String value = get(name, null); if (value == null) throw new GdxRuntimeException("Element " + this.name + " doesn't have attribute or child: " + name); return Float.parseFloat(value); }
public float getParameter(String key, float defaultValue) { Number n = getNumbers().get(key); if (n != null) { return n.floatValue(); } String value = getParameter(key); if (StringUtils.isEmpty(value)) { return defaultValue; } float f = Float.parseFloat(value); getNumbers().put(key, f); return f; }
public float getParameter(String key, float defaultValue) { Number n = getNumbers().get(key); if (n != null) { return n.floatValue(); } String value = getParameter(key); if (StringUtils.isEmpty(value)) { return defaultValue; } float f = Float.parseFloat(value); getNumbers().put(key, f); return f; }
public float getMethodParameter(String method, String key, float defaultValue) { String methodKey = method + "." + key; Number n = getNumbers().get(methodKey); if (n != null) { return n.floatValue(); } String value = getMethodParameter(method, key); if (StringUtils.isEmpty(value)) { return defaultValue; } float f = Float.parseFloat(value); getNumbers().put(methodKey, f); return f; }
public float getMethodParameter(String method, String key, float defaultValue) { String methodKey = method + "." + key; Number n = getNumbers().get(methodKey); if (n != null) { return n.floatValue(); } String value = getMethodParameter(method, key); if (StringUtils.isEmpty(value)) { return defaultValue; } float f = Float.parseFloat(value); getNumbers().put(methodKey, f); return f; }
public static Literal getRealLiteral(String numberToken, int startPos, int endPos, boolean isFloat) { try { if (isFloat) { float value = Float.parseFloat(numberToken); return new FloatLiteral(numberToken, startPos, endPos, value); } else { double value = Double.parseDouble(numberToken); return new RealLiteral(numberToken, startPos, endPos, value); } } catch (NumberFormatException ex) { throw new InternalParseException(new SpelParseException(startPos, ex, SpelMessage.NOT_A_REAL, numberToken)); } }
protected void loadBasicLayerInfo (MapLayer layer, Element element) { String name = element.getAttribute("name", null); float opacity = Float.parseFloat(element.getAttribute("opacity", "1.0")); boolean visible = element.getIntAttribute("visible", 1) == 1; float offsetX = element.getFloatAttribute("offsetx", 0); float offsetY = element.getFloatAttribute("offsety", 0); layer.setName(name); layer.setOpacity(opacity); layer.setVisible(visible); layer.setOffsetX(offsetX); layer.setOffsetY(offsetY); }
protected void loadBasicLayerInfo (MapLayer layer, Element element) { String name = element.getAttribute("name", null); float opacity = Float.parseFloat(element.getAttribute("opacity", "1.0")); boolean visible = element.getIntAttribute("visible", 1) == 1; float offsetX = element.getFloatAttribute("offsetx", 0); float offsetY = element.getFloatAttribute("offsety", 0); layer.setName(name); layer.setOpacity(opacity); layer.setVisible(visible); layer.setOffsetX(offsetX); layer.setOffsetY(offsetY); }