@Override public Float toFloat(Object value) { return ((Long) value).floatValue(); }
public Float toFloat(Long self) { return self.floatValue(); }
@Override public float getFloatValue(int dictId) { return ((Long) get(dictId)).floatValue(); }
public Float convert(Object src) { if(src == null){ return null; } if(Float.class.isAssignableFrom(src.getClass())){ return (Float) src; } else if (Integer.class.isAssignableFrom(src.getClass())) { return ((Integer) src).floatValue(); } else if (Long.class.isAssignableFrom(src.getClass())) { return ((Long) src).floatValue(); } else if (BigDecimal.class.isAssignableFrom(src.getClass())) { return ((BigDecimal) src).floatValue(); } else if (Double.class.isAssignableFrom(src.getClass())) { return ((Double) src).floatValue(); } else if (String.class.isAssignableFrom(src.getClass())) { return Float.valueOf(src.toString()); } throw new MappingException("can not map a " + src.getClass() + " to " + Float.class.getName()); } }
@Override @SuppressWarnings("UnnecessaryBoxing") public Float convertToEntityAttribute(Long dbData) { if ( dbData == null ) { return null; } return new Float( ( dbData.floatValue() ) / 100 ); } }
return (X) Float.valueOf( value.floatValue() );
resultValue = typedValue.intValue(); } else if (opName.endsWith("float")) { resultValue = typedValue.floatValue();
return (T) l; } else if (targetClass == Float.class) { return (T) (Float) l.floatValue(); } else if (targetClass == Double.class) { return (T) (Double) l.doubleValue();
private NodeInfo generateNodeInfo(long cuboidId, int dimensionCount, long cubeQueryCount, Map<Long, Long> rowCountMap, Map<Long, Long> hitFrequencyMap, Map<Long, Long> queryMatchMap, Set<Long> currentCuboidSet) { Long queryCount = hitFrequencyMap == null || hitFrequencyMap.get(cuboidId) == null ? 0L : hitFrequencyMap.get(cuboidId); float queryRate = cubeQueryCount <= 0 ? 0 : queryCount.floatValue() / cubeQueryCount; long queryExactlyMatchCount = queryMatchMap == null || queryMatchMap.get(cuboidId) == null ? 0L : queryMatchMap.get(cuboidId); boolean ifExist = currentCuboidSet.contains(cuboidId); long rowCount = rowCountMap == null ? 0L : rowCountMap.get(cuboidId); NodeInfo node = new NodeInfo(); node.setId(cuboidId); node.setName(Cuboid.getDisplayName(cuboidId, dimensionCount)); node.setQueryCount(queryCount); node.setQueryRate(queryRate); node.setExactlyMatchCount(queryExactlyMatchCount); node.setExisted(ifExist); node.setRowCount(rowCount); return node; }
return new PGBoolean(val.longValue()==0?Boolean.FALSE:Boolean.TRUE); case Types.REAL: return new PGFloat( new Float(val.floatValue()) ); case Types.FLOAT: case Types.DOUBLE:
@Test public void canLongToFloat() { Long value = 112040345L; when(item.getValue()).thenReturn(value); when(item.getType()).thenReturn("J"); when(instruction.getOpcode()).thenReturn(Opcode.LONG_TO_FLOAT); op = (UnaryMathOp) opFactory.create(location, addressToLocation, vm); op.execute(node, mState); verify(mState, times(1)).assignRegister(eq(REGISTER_A), eq(new HeapItem(value.floatValue(), "F"))); }
field.defaultValue = new Long(TextFormat.parseUInt64((HEX112!=null?HEX112.getText():null))); else if(field instanceof Field.Float) field.defaultValue = new Float(Long.decode((HEX112!=null?HEX112.getText():null)).floatValue()); else if(field instanceof Field.Double) field.defaultValue = new Double(Long.decode((HEX112!=null?HEX112.getText():null)).doubleValue()); field.defaultValue = new Long(TextFormat.parseUInt64((OCTAL113!=null?OCTAL113.getText():null))); else if(field instanceof Field.Float) field.defaultValue = new Float(Long.decode((OCTAL113!=null?OCTAL113.getText():null)).floatValue()); else if(field instanceof Field.Double) field.defaultValue = new Double(Long.decode((OCTAL113!=null?OCTAL113.getText():null)).doubleValue());
public Float convert(Object src) { if(src == null){ return null; } if(Float.class.isAssignableFrom(src.getClass())){ return (Float) src; } else if (Integer.class.isAssignableFrom(src.getClass())) { return ((Integer) src).floatValue(); } else if (Long.class.isAssignableFrom(src.getClass())) { return ((Long) src).floatValue(); } else if (BigDecimal.class.isAssignableFrom(src.getClass())) { return ((BigDecimal) src).floatValue(); } else if (Double.class.isAssignableFrom(src.getClass())) { return ((Double) src).floatValue(); } else if (String.class.isAssignableFrom(src.getClass())) { return Float.valueOf(src.toString()); } throw new MappingException("can not map a " + src.getClass() + " to " + Float.class.getName()); } }
@SuppressWarnings("unchecked") @Override public <T> T convertTo(Serializable value, Class<T> toType) throws PropertyConversionException { if (value == null || Long.class == toType) { return (T) value; } Long v = (Long) value; if (toType == Integer.class) { return (T) new Integer(v.intValue()); } if (toType == String.class) { return (T) v.toString(); } if (toType == Double.class) { return (T) new Double(v.doubleValue()); } if (toType == Float.class) { return (T) new Float(v.floatValue()); } if (toType == Short.class) { return (T) new Short(v.shortValue()); } if (toType == Byte.class) { return (T) new Byte(v.byteValue()); } throw new PropertyConversionException(value.getClass(), toType); }
userFidValue = new Double(newId.doubleValue()); } else if (Float.class == binding) { userFidValue = new Float(newId.floatValue()); } else { throw new IllegalArgumentException(
@Override public Float convertFrom(Long source, Type<Float> destinationType, MappingContext context) { return source.floatValue(); } }
/** * Converts Long to Float. * * @param value The Long to be converted. * @return The converted Float value. */ public static Float longToFloat(Long value) { return value.floatValue(); }
/** * 类型转换实现 * */ public Float evaluate(Long s) { if (s == null) { return null; } return s.floatValue(); }
public static Float toFloat(Object obj) { if (obj instanceof Double) return ((Double) obj).floatValue(); else if (obj instanceof Float) return ((Float) obj); else if (obj instanceof BigDecimal) return ((BigDecimal) obj).floatValue(); else if (obj instanceof Long) return ((Long) obj).floatValue(); else if (obj instanceof Integer) return ((Integer) obj).floatValue(); else if (obj instanceof Short) return ((Short) obj).floatValue(); else if (obj instanceof Byte) return ((Byte) obj).floatValue(); else { return null; } }
@AtlasConversionInfo(sourceType = FieldType.DATE_TIME_TZ, targetType = FieldType.FLOAT, concerns = AtlasConversionConcern.TIMEZONE) public Float toFloat(ZonedDateTime value) { return value != null ? getEpochMilli(value).floatValue() : null; }