• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Tuple2类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.mapdb.Fun.Tuple2的典型用法代码示例。如果您正苦于以下问题:Java Tuple2类的具体用法?Java Tuple2怎么用?Java Tuple2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Tuple2类属于org.mapdb.Fun包,在下文中一共展示了Tuple2类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: compile

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
static void compile(String file, String database){
	DB db = DBMaker.newFileDB(new File(database)).compressionEnable().closeOnJvmShutdown().make();
	NavigableSet<Tuple2<String, Tuple2<String,Double>>> multiset = db.getTreeSet("SW");
	multiset.clear();
	try {
		BufferedReader swFile = new BufferedReader(new InputStreamReader(new BZip2InputStream(new FileInputStream(new File(file)), false), "UTF-8"));
		int entry = 0;
		for(String line=swFile.readLine();line != null;line = swFile.readLine()){
			String key = line.trim();
			String[] values = swFile.readLine().trim().split(" ");
			for(int i = 1;i < values.length;i += 2){
				multiset.add(Fun.t2(key, Fun.t2(values[i-1], Double.parseDouble(values[i]))));
			}
			if(entry++ > 100){
				db.commit();
				entry = 0;
			}
		}
		swFile.close();
	} catch (IOException e) {
		e.printStackTrace();
	}
	db.commit();
	db.close();
}
 
开发者ID:tticoin,项目名称:JointER,代码行数:26,代码来源:NICTNounSynonymsDB.java


示例2: reset

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
public void reset() 
{
	//RESET MAP
	this.map.clear();
	
	//RESET INDEXES
	for(Set<Tuple2<?, T>> set: this.indexes.values())
	{
		set.clear();
	}
	
	//NOTIFY LIST
	if(this.getObservableData().containsKey(NOTIFY_LIST))
	{
		//CREATE LIST
		SortableList<T, U> list = new SortableList<T, U>(this);
		
		//UPDATE
		this.setChanged();
		this.notifyObservers(new ObserverMessage(this.getObservableData().get(NOTIFY_LIST), list));
	}
}
 
开发者ID:razakal,项目名称:Qora,代码行数:23,代码来源:DBMap.java


示例3: createIndexes

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
protected void createIndexes(DB database)
{
	//HEIGHT INDEX
	Tuple2Comparator<Integer, byte[]> comparator = new Fun.Tuple2Comparator<Integer, byte[]>(Fun.COMPARATOR, UnsignedBytes.lexicographicalComparator());
	NavigableSet<Tuple2<Integer, byte[]>> heightIndex = database.createTreeSet("blocks_index_height")
			.comparator(comparator)
			.makeOrGet();
	
	NavigableSet<Tuple2<Integer, byte[]>> descendingHeightIndex = database.createTreeSet("blocks_index_height_descending")
			.comparator(new ReverseComparator(comparator))
			.makeOrGet();
	
	createIndex(HEIGHT_INDEX, heightIndex, descendingHeightIndex, new Fun.Function2<Integer, byte[], Block>() {
	   	@Override
	    public Integer run(byte[] key, Block value) {
	   		return value.getHeight();
	    }
	});
}
 
开发者ID:razakal,项目名称:Qora,代码行数:21,代码来源:BlockMap.java


示例4: createIndexes

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void createIndexes(DB database)
{
	//AMOUNT INDEX
	NavigableSet<Tuple2<BigDecimal, String>> namesIndex = database.createTreeSet("namesales_index_amount")
			.comparator(Fun.COMPARATOR)
			.makeOrGet();
	
	NavigableSet<Tuple2<BigDecimal, String>> descendingNamesIndex = database.createTreeSet("namesales_index_amount_descending")
			.comparator(new ReverseComparator(Fun.COMPARATOR))
			.makeOrGet();
	
	createIndex(AMOUNT_INDEX, namesIndex, descendingNamesIndex, new Fun.Function2<BigDecimal, String, BigDecimal>() {
	   	@Override
	    public BigDecimal run(String key, BigDecimal value) {
	   		return value;
	    }
	});
}
 
开发者ID:razakal,项目名称:Qora,代码行数:20,代码来源:NameExchangeMap.java


示例5: createIndexes

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void createIndexes(DB database)
{
	//TIMESTAMP INDEX
	Tuple2Comparator<Long, byte[]> comparator = new Fun.Tuple2Comparator<Long, byte[]>(Fun.COMPARATOR, UnsignedBytes.lexicographicalComparator());
	NavigableSet<Tuple2<Integer, byte[]>> heightIndex = database.createTreeSet("transactions_index_timestamp")
			.comparator(comparator)
			.makeOrGet();
			
	NavigableSet<Tuple2<Integer, byte[]>> descendingHeightIndex = database.createTreeSet("transactions_index_timestamp_descending")
			.comparator(new ReverseComparator(comparator))
			.makeOrGet();
			
	createIndex(TIMESTAMP_INDEX, heightIndex, descendingHeightIndex, new Fun.Function2<Long, byte[], Transaction>() {
	   	@Override
	    public Long run(byte[] key, Transaction value) {
	   		return value.getTimestamp();
	    }
	});
}
 
开发者ID:razakal,项目名称:Qora,代码行数:21,代码来源:TransactionMap.java


示例6: get

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<NameSale> get(Account account)
{
	List<NameSale> nameSales = new ArrayList<NameSale>();
	
	try
	{
		Map<Tuple2<String, String>, BigDecimal> accountNames = ((BTreeMap) this.map).subMap(
				Fun.t2(account.getAddress(), null),
				Fun.t2(account.getAddress(), Fun.HI()));
		
		for(Entry<Tuple2<String, String>, BigDecimal> entry: accountNames.entrySet())
		{
			NameSale nameSale = new NameSale(entry.getKey().b, entry.getValue());
			nameSales.add(nameSale);
		}
	}
	catch(Exception e)
	{
		//ERROR
		e.printStackTrace();
	}
	
	return nameSales;
}
 
开发者ID:razakal,项目名称:Qora,代码行数:26,代码来源:NameSaleMap.java


示例7: filter

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
public QueryResult<T> filter(Tuple2<String, String> tup) throws Exception {
	if (!this.is_ready)
		throw new Exception();
	String field = tup.a;
	List<String> keys = new ArrayList<String>();
	keys.add(tup.b);
	if (!field.equals(pk_field.getName())) {
		BTreeMap<String, List<String>> tm = db.getTreeMap(mapname + "__" + field);
		keys = tm.get(tup.b);
	}
	QueryResult<T> ret = new QueryResult<T>();
	for (String k : keys)
		ret.add(pk.get(k));

	return ret;
}
 
开发者ID:sirmmo,项目名称:ColDb,代码行数:17,代码来源:ColDB.java


示例8: getInitiatedTrades

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<Trade> getInitiatedTrades(Order order) 
{
	//FILTER ALL TRADES
	Collection<Tuple2> keys = this.getKeys(order);
	
	//GET ALL TRADES FOR KEYS
	List<Trade> trades = new ArrayList<Trade>();
	for(Tuple2 key: keys)
	{
		trades.add(this.get(key));
	}
	
	//RETURN
	return trades;
}
 
开发者ID:razakal,项目名称:Qora,代码行数:17,代码来源:TradeMap.java


示例9: syncUpdate

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void syncUpdate(Observable o, Object arg)
{
	ObserverMessage message = (ObserverMessage) arg;
	
	//CHECK IF NEW LIST
	if(message.getType() == ObserverMessage.LIST_TRANSACTION_TYPE)
	{
		if(this.transactions == null)
		{
			this.transactions = (SortableList<Tuple2<String, String>, Transaction>) message.getValue();
			this.transactions.registerObserver();
			this.transactions.sort(TransactionMap.TIMESTAMP_INDEX, true);
		}
		
		this.fireTableDataChanged();
	}
	
	//CHECK IF LIST UPDATED
	if(message.getType() == ObserverMessage.ADD_TRANSACTION_TYPE || message.getType() == ObserverMessage.REMOVE_TRANSACTION_TYPE)
	{
		this.fireTableDataChanged();
	}	
}
 
开发者ID:razakal,项目名称:Qora,代码行数:25,代码来源:WalletTransactionsTableModel.java


示例10: onDataChanged

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
public void onDataChanged()
{
	//GET SELECTED ITEM
	Name selected = (Name) this.getSelectedItem();
				
	//EMPTY LIST
	this.removeAllElements();
		
	//INSERT ALL ACCOUNTS
	for(Pair<Tuple2<String, String>, Name> name: this.names)
	{
		this.addElement(name.getB());
	}
		
	//RESET SELECTED ITEM
	if(this.getIndexOf(selected) != -1)
	{
		this.setSelectedItem(selected);
	}
}
 
开发者ID:razakal,项目名称:Qora,代码行数:21,代码来源:NameComboBoxModel.java


示例11: syncUpdate

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void syncUpdate(Observable o, Object arg)
{
	ObserverMessage message = (ObserverMessage) arg;
	
	//CHECK IF NEW LIST
	if(message.getType() == ObserverMessage.LIST_POLL_TYPE)
	{
		if(this.polls == null)
		{
			this.polls = (SortableList<Tuple2<String, String>, Poll>) message.getValue();
			this.polls.registerObserver();
			this.polls.sort(PollMap.NAME_INDEX);
		}
		
		this.fireTableDataChanged();
	}
	
	//CHECK IF LIST UPDATED
	if(message.getType() == ObserverMessage.ADD_POLL_TYPE || message.getType() == ObserverMessage.REMOVE_POLL_TYPE)
	{
		this.fireTableDataChanged();
	}	
}
 
开发者ID:razakal,项目名称:Qora,代码行数:25,代码来源:WalletPollsTableModel.java


示例12: syncUpdate

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void syncUpdate(Observable o, Object arg)
{
	ObserverMessage message = (ObserverMessage) arg;
	
	//CHECK IF NEW LIST
	if(message.getType() == ObserverMessage.LIST_ASSET_TYPE)
	{
		if(this.assets == null)
		{
			this.assets = (SortableList<Tuple2<String, String>, Asset>) message.getValue();
			this.assets.registerObserver();
			//this.assets.sort(PollMap.NAME_INDEX);
		}
		
		this.fireTableDataChanged();
	}
	
	//CHECK IF LIST UPDATED
	if(message.getType() == ObserverMessage.ADD_ASSET_TYPE || message.getType() == ObserverMessage.REMOVE_ASSET_TYPE)
	{
		this.fireTableDataChanged();
	}	
}
 
开发者ID:razakal,项目名称:Qora,代码行数:25,代码来源:WalletAssetsTableModel.java


示例13: syncUpdate

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void syncUpdate(Observable o, Object arg)
{
	ObserverMessage message = (ObserverMessage) arg;
	
	//CHECK IF NEW LIST
	if(message.getType() == ObserverMessage.LIST_NAME_TYPE)
	{
		if(this.names == null)
		{
			this.names = (SortableList<Tuple2<String, String>, Name>) message.getValue();
			this.names.registerObserver();
			this.names.sort(NameMap.NAME_INDEX);
		}
		
		this.fireTableDataChanged();
	}
	
	//CHECK IF LIST UPDATED
	if(message.getType() == ObserverMessage.ADD_NAME_TYPE || message.getType() == ObserverMessage.REMOVE_NAME_TYPE)
	{
		this.fireTableDataChanged();
	}	
}
 
开发者ID:razakal,项目名称:Qora,代码行数:25,代码来源:WalletNamesTableModel.java


示例14: onDataChanged

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
public void onDataChanged()
{
	//GET SELECTED ITEM
	Name selected = (Name) this.getSelectedItem();
				
	//EMPTY LIST
	this.removeAllElements();
		
	//INSERT ALL ACCOUNTS
	for(Pair<Tuple2<String, String>, BigDecimal> entry: this.nameSales)
	{
		NameSale nameSale = new NameSale(entry.getA().b, entry.getB());
		this.addElement(nameSale);
	}
		
	//RESET SELECTED ITEM
	if(this.getIndexOf(selected) != -1)
	{
		this.setSelectedItem(selected);
	}
}
 
开发者ID:razakal,项目名称:Qora,代码行数:22,代码来源:NameSalesComboBoxModel.java


示例15: getValueAt

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@Override
public Object getValueAt(int row, int column) 
{
	if(this.balances == null || row > this.balances.size() - 1 )
	{
		return null;
	}
	
	Pair<Tuple2<String, Long>, BigDecimal> aRow = this.balances.get(row);
	Account account = new Account(aRow.getA().a);
	
	switch(column)
	{
	case COLUMN_ADDRESS:
		
		return account.getAddress();
		
	case COLUMN_BALANCE:
		
		return account.getConfirmedBalance(this.key).toPlainString();
	}
	
	return null;
}
 
开发者ID:razakal,项目名称:Qora,代码行数:25,代码来源:BalancesTableModel.java


示例16: syncUpdate

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void syncUpdate(Observable o, Object arg)
{
	ObserverMessage message = (ObserverMessage) arg;
	
	//CHECK IF NEW LIST
	if(message.getType() == ObserverMessage.LIST_ORDER_TYPE)
	{
		if(this.orders == null)
		{
			this.orders = (SortableList<Tuple2<String, BigInteger>, Order>) message.getValue();
			this.orders.registerObserver();
			//this.assets.sort(PollMap.NAME_INDEX);
		}
		
		this.fireTableDataChanged();
	}
	
	//CHECK IF LIST UPDATED
	if(message.getType() == ObserverMessage.ADD_ORDER_TYPE || message.getType() == ObserverMessage.REMOVE_ORDER_TYPE)
	{
		this.fireTableDataChanged();
	}	
}
 
开发者ID:razakal,项目名称:Qora,代码行数:25,代码来源:WalletOrdersTableModel.java


示例17: syncUpdate

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void syncUpdate(Observable o, Object arg)
{
	ObserverMessage message = (ObserverMessage) arg;
	
	//CHECK IF NEW LIST
	if(message.getType() == ObserverMessage.LIST_BLOCK_TYPE)
	{
		if(this.blocks == null)
		{
			this.blocks = (SortableList<Tuple2<String, String>, Block>) message.getValue();
			this.blocks.registerObserver();
			this.blocks.sort(BlockMap.TIMESTAMP_INDEX, true);
		}
		
		this.fireTableDataChanged();
	}
	
	//CHECK IF LIST UPDATED
	if(message.getType() == ObserverMessage.ADD_BLOCK_TYPE || message.getType() == ObserverMessage.REMOVE_BLOCK_TYPE)
	{
		this.fireTableDataChanged();
	}	
}
 
开发者ID:razakal,项目名称:Qora,代码行数:25,代码来源:WalletBlocksTableModel.java


示例18: ShapeMap

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
public ShapeMap (ConcurrentNavigableMap<Tuple2, Shape> allShapes, String shapeId) {
    this.wrapped = allShapes.subMap(
            new Tuple2 (shapeId, 0),
            new Tuple2 (shapeId, Fun.HI)
            );
    this.shapeId = shapeId;
}
 
开发者ID:conveyal,项目名称:gtfs-lib,代码行数:8,代码来源:ShapeMap.java


示例19: keySet

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@Override
public Set<Integer> keySet() {
    // use a linkedhashset so values come out in order
    Set<Integer> ret = new LinkedHashSet<>();

    for (Tuple2<String, Integer> t : wrapped.keySet()) {
        ret.add(t.b);
    }

    // Don't let the user modify the set as it won't do what they expect (change the map)
    return Collections.unmodifiableSet(ret);
}
 
开发者ID:conveyal,项目名称:gtfs-lib,代码行数:13,代码来源:ShapeMap.java


示例20: entrySet

import org.mapdb.Fun.Tuple2; //导入依赖的package包/类
@Override
public Set<Map.Entry<Integer, Shape>> entrySet() {
    // it's ok to pull all the values into RAM as this represents a single shape not all shapes
    // use a linkedhashset so values come out in order
    Set<Entry<Integer, Shape>> ret = new LinkedHashSet<>();

    for (Map.Entry<Tuple2, Shape> e : wrapped.entrySet()) {
        ret.add(new AbstractMap.SimpleImmutableEntry(e.getKey().b, e.getValue()));
    }

    return Collections.unmodifiableSet(ret);
}
 
开发者ID:conveyal,项目名称:gtfs-lib,代码行数:13,代码来源:ShapeMap.java



注:本文中的org.mapdb.Fun.Tuple2类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Pathway类代码示例发布时间:2022-05-23
下一篇:
Java ArgumentsProvider类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap