本文整理了Java中java.lang.Float.longValue()
方法的一些代码示例,展示了Float.longValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Float.longValue()
方法的具体详情如下:
包路径:java.lang.Float
类名称:Float
方法名:longValue
[英]Returns value of this Float as a long (by casting to type long).
[中]以long形式返回此浮点值(通过强制转换为long类型)。
代码示例来源:origin: apache/incubator-pinot
@Override
public Long toLong(Object value) {
return ((Float) value).longValue();
}
代码示例来源:origin: jfinal/jfinal
public Long toLong(Float self) {
return self.longValue();
}
代码示例来源:origin: debezium/debezium
public static Number add(Float first, BigDecimal second) {
return second.add(BigDecimal.valueOf(first.longValue()));
}
代码示例来源:origin: debezium/debezium
public static Number add(Float first, BigInteger second) {
return second.add(BigInteger.valueOf(first.longValue()));
}
代码示例来源:origin: apache/incubator-pinot
@Override
public long getLongValue(int dictId) {
return ((Float) get(dictId)).longValue();
}
代码示例来源:origin: apache/incubator-pinot
@Override
public long getLongValue(int dictId) {
return ((Float) get(dictId)).longValue();
}
代码示例来源:origin: json-path/JsonPath
public Long convert(Object src) {
if(src == null){
return null;
}
if(Long.class.isAssignableFrom(src.getClass())){
return (Long) src;
} else if (Integer.class.isAssignableFrom(src.getClass())) {
return ((Integer) src).longValue();
} else if (Double.class.isAssignableFrom(src.getClass())) {
return ((Double) src).longValue();
} else if (BigDecimal.class.isAssignableFrom(src.getClass())) {
return ((BigDecimal) src).longValue();
} else if (Float.class.isAssignableFrom(src.getClass())) {
return ((Float) src).longValue();
} else if (String.class.isAssignableFrom(src.getClass())) {
return Long.valueOf(src.toString());
}
throw new MappingException("can not map a " + src.getClass() + " to " + Long.class.getName());
}
}
代码示例来源:origin: hibernate/hibernate-orm
return (X) Long.valueOf( value.longValue() );
return (X) BigInteger.valueOf( value.longValue() );
代码示例来源:origin: CalebFenton/simplify
resultValue = typedValue.intValue();
} else if (opName.endsWith("long")) {
resultValue = typedValue.longValue();
代码示例来源:origin: postgresql/postgresql
return new PGLong(new Long( val.longValue() ));
case Types.INTEGER:
return new PGInteger(new Integer( val.intValue() ) );
代码示例来源:origin: CalebFenton/simplify
@Test
public void canFloatToLong() {
Float value = 11204.0345F;
when(item.getValue()).thenReturn(value);
when(item.getType()).thenReturn("F");
when(instruction.getOpcode()).thenReturn(Opcode.FLOAT_TO_LONG);
op = (UnaryMathOp) opFactory.create(location, addressToLocation, vm);
op.execute(node, mState);
verify(mState, times(1)).assignRegister(eq(REGISTER_A), eq(new HeapItem(value.longValue(), "J")));
}
代码示例来源:origin: EngineHub/WorldEdit
/**
* Get a long named with the given key, even if it's another
* type of number.
*
* <p>If the key does not exist or its value is not a number,
* then {@code 0} will be returned.</p>
*
* @param key the key
* @return a long
*/
public long asLong(String key) {
Tag tag = value.get(key);
if (tag instanceof ByteTag) {
return ((ByteTag) tag).getValue();
} else if (tag instanceof ShortTag) {
return ((ShortTag) tag).getValue();
} else if (tag instanceof IntTag) {
return ((IntTag) tag).getValue();
} else if (tag instanceof LongTag) {
return ((LongTag) tag).getValue();
} else if (tag instanceof FloatTag) {
return ((FloatTag) tag).getValue().longValue();
} else if (tag instanceof DoubleTag) {
return ((DoubleTag) tag).getValue().longValue();
} else {
return 0L;
}
}
代码示例来源:origin: Sable/soot
= new Float((new Float(labelID).floatValue() / new Float(units.size()).intValue()) * 100.0).longValue();
if (xmlLabel.stmtPercentage > maxStmtCount) {
maxStmtCount = xmlLabel.stmtPercentage;
= new Float((new Float(labelID).floatValue() / new Float(units.size()).floatValue()) * 100.0).longValue();
if (xmlLabel.stmtPercentage > maxStmtCount) {
maxStmtCount = xmlLabel.stmtPercentage;
tempLabel.stmtPercentage
= new Float((new Float(tempLabel.stmtPercentage).floatValue() / new Float(maxStmtCount).floatValue()) * 100.0)
.longValue();
代码示例来源:origin: EngineHub/WorldEdit
/**
* Get a long named with the given index, even if it's another
* type of number.
*
* <p>If the index does not exist or its value is not a number,
* then {@code 0} will be returned.</p>
*
* @param index the index
* @return a long
*/
public long asLong(int index) {
Tag tag = getIfExists(index);
if (tag instanceof ByteTag) {
return ((ByteTag) tag).getValue();
} else if (tag instanceof ShortTag) {
return ((ShortTag) tag).getValue();
} else if (tag instanceof IntTag) {
return ((IntTag) tag).getValue();
} else if (tag instanceof LongTag) {
return ((LongTag) tag).getValue();
} else if (tag instanceof FloatTag) {
return ((FloatTag) tag).getValue().longValue();
} else if (tag instanceof DoubleTag) {
return ((DoubleTag) tag).getValue().longValue();
} else {
return 0;
}
}
代码示例来源:origin: apache/incubator-druid
@Test
public void testDoubleFirstCombiningBufferAggregator()
{
BufferAggregator agg = combiningAggFactory.factorizeBuffered(
colSelectorFactory);
ByteBuffer buffer = ByteBuffer.wrap(new byte[floatFirstAggregatorFactory.getMaxIntermediateSizeWithNulls()]);
agg.init(buffer, 0);
aggregate(agg, buffer, 0);
aggregate(agg, buffer, 0);
aggregate(agg, buffer, 0);
aggregate(agg, buffer, 0);
Pair<Long, Float> result = (Pair<Long, Float>) agg.get(buffer, 0);
Pair<Long, Float> expected = (Pair<Long, Float>) pairs[2];
Assert.assertEquals(expected.lhs, result.lhs);
Assert.assertEquals(expected.rhs, result.rhs, 0.0001);
Assert.assertEquals(expected.rhs.longValue(), agg.getLong(buffer, 0));
Assert.assertEquals(expected.rhs, agg.getFloat(buffer, 0), 0.0001);
}
代码示例来源:origin: apache/incubator-druid
@Test
public void testDoubleLastCombiningBufferAggregator()
{
BufferAggregator agg = combiningAggFactory.factorizeBuffered(
colSelectorFactory);
ByteBuffer buffer = ByteBuffer.wrap(new byte[floatLastAggregatorFactory.getMaxIntermediateSizeWithNulls()]);
agg.init(buffer, 0);
aggregate(agg, buffer, 0);
aggregate(agg, buffer, 0);
aggregate(agg, buffer, 0);
aggregate(agg, buffer, 0);
Pair<Long, Float> result = (Pair<Long, Float>) agg.get(buffer, 0);
Pair<Long, Float> expected = (Pair<Long, Float>) pairs[2];
Assert.assertEquals(expected.lhs, result.lhs);
Assert.assertEquals(expected.rhs, result.rhs, 0.0001);
Assert.assertEquals(expected.rhs.longValue(), agg.getLong(buffer, 0));
Assert.assertEquals(expected.rhs, agg.getFloat(buffer, 0), 0.0001);
}
代码示例来源:origin: prestodb/presto
assertFunction("sign(BIGINT '" + intValue + "')", BIGINT, signum.longValue());
代码示例来源:origin: apache/incubator-druid
@Test
public void testDoubleLastCombiningAggregator()
{
Aggregator agg = combiningAggFactory.factorize(colSelectorFactory);
aggregate(agg);
aggregate(agg);
aggregate(agg);
aggregate(agg);
Pair<Long, Float> result = (Pair<Long, Float>) agg.get();
Pair<Long, Float> expected = (Pair<Long, Float>) pairs[2];
Assert.assertEquals(expected.lhs, result.lhs);
Assert.assertEquals(expected.rhs, result.rhs, 0.0001);
Assert.assertEquals(expected.rhs.longValue(), agg.getLong());
Assert.assertEquals(expected.rhs, agg.getFloat(), 0.0001);
}
代码示例来源:origin: apache/incubator-druid
@Test
public void testDoubleFirstCombiningAggregator()
{
Aggregator agg = combiningAggFactory.factorize(colSelectorFactory);
aggregate(agg);
aggregate(agg);
aggregate(agg);
aggregate(agg);
Pair<Long, Float> result = (Pair<Long, Float>) agg.get();
Pair<Long, Float> expected = (Pair<Long, Float>) pairs[2];
Assert.assertEquals(expected.lhs, result.lhs);
Assert.assertEquals(expected.rhs, result.rhs, 0.0001);
Assert.assertEquals(expected.rhs.longValue(), agg.getLong());
Assert.assertEquals(expected.rhs, agg.getFloat(), 0.0001);
}
代码示例来源:origin: com.jayway.jsonpath/json-path
public Long convert(Object src) {
if(src == null){
return null;
}
if(Long.class.isAssignableFrom(src.getClass())){
return (Long) src;
} else if (Integer.class.isAssignableFrom(src.getClass())) {
return ((Integer) src).longValue();
} else if (Double.class.isAssignableFrom(src.getClass())) {
return ((Double) src).longValue();
} else if (BigDecimal.class.isAssignableFrom(src.getClass())) {
return ((BigDecimal) src).longValue();
} else if (Float.class.isAssignableFrom(src.getClass())) {
return ((Float) src).longValue();
} else if (String.class.isAssignableFrom(src.getClass())) {
return Long.valueOf(src.toString());
}
throw new MappingException("can not map a " + src.getClass() + " to " + Long.class.getName());
}
}
内容来源于网络,如有侵权,请联系作者删除!