void setStrokeOpacity(String opacityText) { strokeOpacity = PApplet.parseFloat(opacityText); strokeColor = ((int) (strokeOpacity * 255)) << 24 | strokeColor & 0xFFFFFF; }
void setFillOpacity(String opacityText) { fillOpacity = PApplet.parseFloat(opacityText); fillColor = ((int) (fillOpacity * 255)) << 24 | fillColor & 0xFFFFFF; }
void setStrokeOpacity(String opacityText) { strokeOpacity = PApplet.parseFloat(opacityText); strokeColor = ((int) (strokeOpacity * 255)) << 24 | strokeColor & 0xFFFFFF; }
void setOpacity(String opacityText) { opacity = PApplet.parseFloat(opacityText); strokeColor = ((int) (opacity * 255)) << 24 | strokeColor & 0xFFFFFF; fillColor = ((int) (opacity * 255)) << 24 | fillColor & 0xFFFFFF; }
void setOpacity(String opacityText) { opacity = PApplet.parseFloat(opacityText); strokeColor = ((int) (opacity * 255)) << 24 | strokeColor & 0xFFFFFF; fillColor = ((int) (opacity * 255)) << 24 | fillColor & 0xFFFFFF; }
void setFillOpacity(String opacityText) { fillOpacity = PApplet.parseFloat(opacityText); fillColor = ((int) (fillOpacity * 255)) << 24 | fillColor & 0xFFFFFF; }
static final public float[] parseFloat(String what[]) { return parseFloat(what, Float.NaN); }
static final public float parseFloat(String what) { return parseFloat(what, Float.NaN); }
static final public float parseFloat(String what) { return parseFloat(what, Float.NaN); }
static final public float[] parseFloat(String what[]) { return parseFloat(what, Float.NaN); }
/** * @param defaultValue the default value of the attribute */ public float getFloatContent(float defaultValue) { return PApplet.parseFloat(node.getTextContent(), defaultValue); }
/** * @param defaultValue the default value of the attribute */ public float getFloatContent(float defaultValue) { return PApplet.parseFloat(node.getTextContent(), defaultValue); }
/** * Construct an FloatList from a random pile of objects. * Un-parseable or null values will be set to NaN. */ public FloatList(Object... items) { // nuts, no good way to pass missingValue to this fn (varargs must be last) final float missingValue = Float.NaN; count = items.length; data = new float[count]; int index = 0; for (Object o : items) { float value = missingValue; if (o != null) { if (o instanceof Number) { value = ((Number) o).floatValue(); } else { value = PApplet.parseFloat(o.toString().trim(), missingValue); } } data[index++] = value; } }
public float getSize(String clazz, String property, float dflt) { Properties props = properties.get(clazz); if (props == null) return dflt; String value = props.get(property); if (value == null) return dflt; value = value.replaceAll("px", "").replaceAll("pt", ""); return Display.scalef(PApplet.parseFloat(value, dflt)); }
public float getPosition(String clazz, String property, float dflt) { Properties props = properties.get(clazz); if (props == null) return dflt; String value = props.get(property); if (value == null) return dflt; value = value.replaceAll("px", "").replaceAll("pt", ""); return Display.scalef(PApplet.parseFloat(value, dflt)); }
/** * Read a set of entries from a Reader that has each key/value pair on * a single line, separated by a tab. * * @nowebref */ public FloatDict(BufferedReader reader) { String[] lines = PApplet.loadStrings(reader); keys = new String[lines.length]; values = new float[lines.length]; for (int i = 0; i < lines.length; i++) { String[] pieces = PApplet.split(lines[i], '\t'); if (pieces.length == 2) { keys[count] = pieces[0]; values[count] = PApplet.parseFloat(pieces[1]); indices.put(pieces[0], count); count++; } } }
/** * Read a set of entries from a Reader that has each key/value pair on * a single line, separated by a tab. * * @nowebref */ public FloatDict(BufferedReader reader) { // public FloatHash(PApplet parent, String filename) { String[] lines = PApplet.loadStrings(reader); keys = new String[lines.length]; values = new float[lines.length]; // boolean csv = (lines[0].indexOf('\t') == -1); for (int i = 0; i < lines.length; i++) { // String[] pieces = csv ? Table.splitLineCSV(lines[i]) : PApplet.split(lines[i], '\t'); String[] pieces = PApplet.split(lines[i], '\t'); if (pieces.length == 2) { keys[count] = pieces[0]; values[count] = PApplet.parseFloat(pieces[1]); count++; } } }
/** * Get a float value from the specified row and column. If the value is null * or not parseable as a float, the "missing" value is returned. By default, * this is Float.NaN, but can be controlled with setMissingFloat(). * * @webref table:method * @brief Get a float value from the specified row and column * @param row ID number of the row to reference * @param column ID number of the column to reference * @see Table#getInt(int, int) * @see Table#getString(int, int) * @see Table#getStringColumn(String) * @see Table#setInt(int, int, int) * @see Table#setFloat(int, int, float) * @see Table#setString(int, int, String) */ public float getFloat(int row, int column) { checkBounds(row, column); if (columnTypes[column] == FLOAT) { float[] floatData = (float[]) columns[column]; return floatData[row]; } String str = getString(row, column); if (str == null || str.equals(missingString)) { return missingFloat; } return PApplet.parseFloat(str, missingFloat); }
/** * Get a float value from the specified row and column. If the value is null * or not parseable as a float, the "missing" value is returned. By default, * this is Float.NaN, but can be controlled with setMissingFloat(). * * @webref table:method * @brief Get a float value from the specified row and column * @param row ID number of the row to reference * @param column ID number of the column to reference * @see Table#getInt(int, int) * @see Table#getString(int, int) * @see Table#getStringColumn(String) * @see Table#setInt(int, int, int) * @see Table#setFloat(int, int, float) * @see Table#setString(int, int, String) */ public float getFloat(int row, int column) { checkBounds(row, column); if (columnTypes[column] == FLOAT) { float[] floatData = (float[]) columns[column]; return floatData[row]; } String str = getString(row, column); if (str == null || str.equals(missingString)) { return missingFloat; } return PApplet.parseFloat(str, missingFloat); }
/** * Construct an FloatList from an iterable pile of objects. * For instance, a float array, an array of strings, who knows). * Un-parseable or null values will be set to NaN. * @nowebref */ public FloatList(Iterable<Object> iter) { this(10); for (Object o : iter) { if (o == null) { append(Float.NaN); } else if (o instanceof Number) { append(((Number) o).floatValue()); } else { append(PApplet.parseFloat(o.toString().trim())); } } crop(); }