本文整理汇总了Java中gnu.trove.map.hash.TLongDoubleHashMap类的典型用法代码示例。如果您正苦于以下问题:Java TLongDoubleHashMap类的具体用法?Java TLongDoubleHashMap怎么用?Java TLongDoubleHashMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TLongDoubleHashMap类属于gnu.trove.map.hash包,在下文中一共展示了TLongDoubleHashMap类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryId
import gnu.trove.map.hash.TLongDoubleHashMap; //导入依赖的package包/类
long queryId(String sql) throws SQLException {
TLongDoubleHashMap vals = new TLongDoubleHashMap();
NativeSql.on(destDb).query(sql, r -> {
vals.put(r.getLong(1), r.getDouble(2));
return true;
});
long exchangeId = -1;
double delta = 0;
for (long id : vals.keys()) {
double dist = Math.abs(amount - vals.get(id));
if (exchangeId == -1 || dist < delta) {
exchangeId = id;
delta = dist;
}
}
return exchangeId;
}
示例2: causal
import gnu.trove.map.hash.TLongDoubleHashMap; //导入依赖的package包/类
private double causal(LongPair provider, CalcExchange e) {
if (exchangeFactors == null)
return 1d;
TLongDoubleHashMap map = exchangeFactors.get(provider);
if (map == null)
return 1d;
return map.get(e.exchangeId); // default is 1.0
}
示例3: loadFactors
import gnu.trove.map.hash.TLongDoubleHashMap; //导入依赖的package包/类
private void loadFactors(Connection con, String table,
TLongDoubleHashMap map) throws Exception {
Statement statement = con.createStatement();
String query = "select id, conversion_factor from " + table;
ResultSet set = statement.executeQuery(query);
while (set.next()) {
long id = set.getLong("id");
double factor = set.getDouble("conversion_factor");
map.put(id, factor);
}
statement.close();
set.close();
}
示例4: ConceptVector
import gnu.trove.map.hash.TLongDoubleHashMap; //导入依赖的package包/类
/**
* Constructs an empty ConceptVector.
*/
public ConceptVector() {
vector = new TLongDoubleHashMap();
}