Example usage for java.lang Float toString

List of usage examples for java.lang Float toString

Introduction

In this page you can find the example usage for java.lang Float toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of this Float object.

Usage

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindFloatDefMaxValue.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFBamMssCFBindFloatDefMaxValue.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//from   ww  w.j  a  va2s .  c  o  m

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFBamFloatDefObj) {
        Float maxValue = ((ICFBamFloatDefObj) genDef).getOptionalMaxValue();
        if (maxValue == null) {
            ret = null;
        } else {
            ret = maxValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamFloatDefObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindFloatDefMinValue.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFBamMssCFBindFloatDefMinValue.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }/*from   ww  w.j a  va 2 s .  co  m*/

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFBamFloatDefObj) {
        Float minValue = ((ICFBamFloatDefObj) genDef).getOptionalMinValue();
        if (minValue == null) {
            ret = null;
        } else {
            ret = minValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamFloatDefObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindFloatDefInitValue.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFBamMssCFBindFloatDefInitValue.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }// www  . j  a v a  2  s . c o m

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFBamFloatDefObj) {
        Float initValue = ((ICFBamFloatDefObj) genDef).getOptionalInitValue();
        if (initValue == null) {
            ret = null;
        } else {
            ret = initValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamFloatDefObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindFloatDefNullValue.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFBamMssCFBindFloatDefNullValue.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }// ww w  . j  a va 2 s . com

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFBamFloatDefObj) {
        Float nullValue = ((ICFBamFloatDefObj) genDef).getOptionalNullValue();
        if (nullValue == null) {
            ret = null;
        } else {
            ret = nullValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamFloatDefObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindFloatDefDefaultValue.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFBamMssCFBindFloatDefDefaultValue.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//from  w w  w  .j a v  a2 s .  co  m

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFBamFloatDefObj) {
        Float defaultValue = ((ICFBamFloatDefObj) genDef).getOptionalDefaultValue();
        if (defaultValue == null) {
            ret = null;
        } else {
            ret = defaultValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamFloatDefObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindFloatDefUnknownValue.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFBamMssCFBindFloatDefUnknownValue.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }/*ww w  .j  a  va2  s.c o m*/

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFBamFloatDefObj) {
        Float unknownValue = ((ICFBamFloatDefObj) genDef).getOptionalUnknownValue();
        if (unknownValue == null) {
            ret = null;
        } else {
            ret = unknownValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamFloatDefObj");
    }

    return (ret);
}

From source file:io.pivotal.strepsirrhini.chaoslemur.RandomFateEngine.java

@Autowired
RandomFateEngine(@Value("${blacklist:}") String[] blacklist,
        @Value("${default.probability:0.2}") Float defaultProbability, Environment environment, Random random,
        @Value("${whitelist:}") String[] whitelist) {

    this.blacklist = blacklist;
    this.defaultProbability = defaultProbability.toString();
    this.environment = environment;
    this.random = random;
    this.whitelist = whitelist;

    this.logger.info("Blacklist: {}", StringUtils.arrayToCommaDelimitedString(blacklist));
    this.logger.info("Whitelist: {}", StringUtils.arrayToCommaDelimitedString(whitelist));
    this.logger.info("Default probability: {}", defaultProbability);
}

From source file:org.onebusaway.util.impl.configuration.ConfigurationServiceImpl.java

@Override
public Float getConfigurationValueAsFloat(String configurationItemKey, Float defaultValue) {
    try {//from w  ww . j av a  2  s .  c o  m
        String defaultValueAsString = ((defaultValue != null) ? defaultValue.toString() : null);

        return Float.parseFloat(getConfigurationValueAsString(configurationItemKey, defaultValueAsString));
    } catch (NumberFormatException ex) {
        return defaultValue;
    }
}

From source file:org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils.java

public static HiveDecimal getHiveDecimal(Object o, PrimitiveObjectInspector oi) {
    if (o == null) {
        return null;
    }//  ww w .ja  va2s  .co m

    HiveDecimal result = null;
    switch (oi.getPrimitiveCategory()) {
    case VOID:
        result = null;
        break;
    case BOOLEAN:
        result = ((BooleanObjectInspector) oi).get(o) ? HiveDecimal.ONE : HiveDecimal.ZERO;
        break;
    case BYTE:
        result = HiveDecimal.create(((ByteObjectInspector) oi).get(o));
        break;
    case SHORT:
        result = HiveDecimal.create(((ShortObjectInspector) oi).get(o));
        break;
    case INT:
        result = HiveDecimal.create(((IntObjectInspector) oi).get(o));
        break;
    case LONG:
        result = HiveDecimal.create(((LongObjectInspector) oi).get(o));
        break;
    case FLOAT:
        Float f = ((FloatObjectInspector) oi).get(o);
        result = HiveDecimal.create(f.toString());
        break;
    case DOUBLE:
        Double d = ((DoubleObjectInspector) oi).get(o);
        result = HiveDecimal.create(d.toString());
        break;
    case STRING:
        result = HiveDecimal.create(((StringObjectInspector) oi).getPrimitiveJavaObject(o));
        break;
    case CHAR:
    case VARCHAR:
        result = HiveDecimal.create(getString(o, oi));
        break;
    case TIMESTAMP:
        Double ts = ((TimestampObjectInspector) oi).getPrimitiveWritableObject(o).getDouble();
        result = HiveDecimal.create(ts.toString());
        break;
    case DECIMAL:
        result = ((HiveDecimalObjectInspector) oi).getPrimitiveJavaObject(o);
        break;
    case DATE: // unsupported conversion
    default:
        throw new RuntimeException(
                "Hive 2 Internal error: unsupported conversion from type: " + oi.getTypeName());
    }
    return result;
}

From source file:com.esri.geoevent.solutions.adapter.geomessage.DefenseOutboundAdapter.java

@SuppressWarnings("incomplete-switch")
@Override// w  w  w.  j a va 2s. co m
public synchronized void receive(GeoEvent geoEvent) {

    ByteBuffer byteBuffer = ByteBuffer.allocate(10 * 1024);
    Integer wkid = -1;
    String message = "";

    message += "<geomessage v=\"1.0\">\n\r";
    message += "<_type>";
    message += messageType;
    message += "</_type>\n\r";
    message += "<_action>";
    message += "update";
    message += "</_action>\n\r";
    String messageid = UUID.randomUUID().toString();
    message += "<_id>";
    message += "{" + messageid + "}";
    message += "</_id>\n\r";
    MapGeometry geom = geoEvent.getGeometry();
    if (geom.getGeometry().getType() == com.esri.core.geometry.Geometry.Type.Point) {
        Point p = (Point) geom.getGeometry();
        message += "<_control_points>";
        message += ((Double) p.getX()).toString();
        message += ",";
        message += ((Double) p.getY()).toString();
        message += "</_control_points>\n\r";
        wkid = ((Integer) geom.getSpatialReference().getID());
    }

    if (wkid > 0) {
        String wkidValue = wkid.toString();
        message += "<_wkid>";
        message += wkidValue.toString();
        message += "</_wkid>\n\r";
    }
    GeoEventDefinition definition = geoEvent.getGeoEventDefinition();
    for (FieldDefinition fieldDefinition : definition.getFieldDefinitions()) {

        String attributeName = fieldDefinition.getName();
        Object value = geoEvent.getField(attributeName);

        if (value == null || value.equals("null")) {
            continue;
        }
        FieldType t = fieldDefinition.getType();
        if (t != FieldType.Geometry) {
            message += "<" + attributeName + ">";

            switch (t) {
            case String:
                // if(((String)value).isEmpty())
                // continue;
                message += value;
                break;
            case Date:
                Date date = (Date) value;
                message += (formatter.format(date));
                break;
            case Double:
                Double doubleValue = (Double) value;
                message += doubleValue.toString();
                break;
            case Float:
                Float floatValue = (Float) value;
                message += floatValue.toString();
                break;

            case Integer:
                Integer intValue = (Integer) value;
                message += intValue.toString();
                break;
            case Long:
                Long longValue = (Long) value;
                message += longValue.toString();
                break;
            case Short:
                Short shortValue = (Short) value;
                message += shortValue.toString();
                break;
            case Boolean:
                Boolean booleanValue = (Boolean) value;
                message += booleanValue.toString();
                break;

            }
            message += "</" + attributeName + ">\n\r";
        } else {
            if (definition.getIndexOf(attributeName) == definition.getIndexOf("GEOMETRY")) {
                continue;
            } else {
                String json = GeometryEngine.geometryToJson(wkid, (Geometry) value);
                message += "<" + attributeName + ">";
                message += json;
                message += "</" + attributeName + ">\n\r";
            }
            break;
        }

    }
    message += "</geomessage>";
    // stringBuffer.append("</geomessages>");
    message += "\r\n";

    ByteBuffer buf = charset.encode(message);
    if (buf.position() > 0)
        buf.flip();

    try {
        byteBuffer.put(buf);
    } catch (BufferOverflowException ex) {
        LOG.error(
                "Csv Outbound Adapter does not have enough room in the buffer to hold the outgoing data.  Either the receiving transport object is too slow to process the data, or the data message is too big.");
    }
    byteBuffer.flip();
    super.receive(byteBuffer, geoEvent.getTrackId(), geoEvent);
    byteBuffer.clear();
}