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

Java StringBinding类代码示例

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

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



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

示例1: getSequence

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
public synchronized Sequence getSequence(String name)
    throws DatabaseException {

    checkOpen();

    if (storeConfig.getReadOnly()) {
        throw new IllegalStateException("Store is read-only");
    }

    Sequence seq = sequenceMap.get(name);
    if (seq == null) {
        if (sequenceDb == null) {
            String dbName = storePrefix + SEQUENCE_DB;
            DatabaseConfig dbConfig = new DatabaseConfig();
            dbConfig.setTransactional(storeConfig.getTransactional());
            dbConfig.setAllowCreate(true);
            sequenceDb = env.openDatabase(null, dbName, dbConfig);
        }
        DatabaseEntry entry = new DatabaseEntry();
        StringBinding.stringToEntry(name, entry);
        seq = sequenceDb.openSequence(null, entry, getSequenceConfig(name));
        sequenceMap.put(name, seq);
    }
    return seq;
}
 
开发者ID:nologic,项目名称:nabs,代码行数:26,代码来源:Store.java


示例2: getSequence

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
public synchronized Sequence getSequence(String name)
    throws DatabaseException {

    checkOpen();

    if (storeConfig.getReadOnly()) {
        throw new IllegalStateException("Store is read-only");
    }
    
    Sequence seq = sequenceMap.get(name);
    if (seq == null) {
        if (sequenceDb == null) {
            String dbName = storePrefix + SEQUENCE_DB;
            DatabaseConfig dbConfig = new DatabaseConfig();
            dbConfig.setTransactional(storeConfig.getTransactional());
            dbConfig.setAllowCreate(true);
            sequenceDb = env.openDatabase(null, dbName, dbConfig);
        }
        DatabaseEntry entry = new DatabaseEntry();
        StringBinding.stringToEntry(name, entry);
        seq = sequenceDb.openSequence(null, entry, getSequenceConfig(name));
        sequenceMap.put(name, seq);
    }
    return seq;
}
 
开发者ID:nologic,项目名称:nabs,代码行数:26,代码来源:Store.java


示例3: display

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
@Override
protected void display() {
    out.print(" VLSN=" + currentEntryHeader.getVLSN());

    DatabaseEntry key = new DatabaseEntry(targetEntry.getKey());

    LN ln = targetEntry.getLN();
    if (ln.isDeleted()) {
        outStream.print("<deleted>");
    } else {
        DatabaseEntry data = new DatabaseEntry(ln.getData());
        String keyVal = StringBinding.entryToString(key);
        TupleBinding<?> binding = null;
        if (keyVal.equals(RepGroupDB.GROUP_KEY)) {
            outStream.print(" GroupInfo: ");
            binding = new GroupBinding();
        } else {
            outStream.print(" NodeInfo: " + keyVal);
            binding = new NodeBinding();
        }
        outStream.print(binding.entryToObject(data));     
    }
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:24,代码来源:DbStreamVerify.java


示例4: addNewMapEntry

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
private void addNewMapEntry(Transaction txn,
                            DatabaseEntry key,
                            DatabaseEntry data,
                            boolean isDelete) {
    String dataSetName = StringBinding.entryToString(key);

    /* Only do it if it's a CHANGE_SET information. */
    if (DataType.getDataType(dataSetName) == DataType.CHANGE_SET) {
        Map<String, StartInfo> syncStartInfos =
            txnIdToSyncStarts.get(txn.getId());
        if (syncStartInfos == null) {
            syncStartInfos =
                new ConcurrentHashMap<String, StartInfo>();
            txnIdToSyncStarts.put(txn.getId(), syncStartInfos);
        }
        LogChangeSetBinding binding = new LogChangeSetBinding();
        LogChangeSet set = binding.entryToObject(data);
        StartInfo startInfo =
            new StartInfo(set.getNextSyncStart(), isDelete);
        syncStartInfos.put(dataSetName, startInfo);
    }
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:23,代码来源:SyncCleanerBarrier.java


示例5: LabelDatabase

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
/**
 * Creates or connects to a database, whose name and type will be {@link WDatabase.DatabaseType#label}. 
 * This will index label statistics according to their raw, unprocessed texts. 
 * 
 * @param env the WEnvironment surrounding this database
 */
public LabelDatabase(WEnvironment env) {

	super(
			env, 
			DatabaseType.label, 
			new StringBinding(), 
			new RecordBinding<DbLabel>() {
				public DbLabel createRecordInstance() {
					return new DbLabel() ;
				}
			}
	) ;

	textProcessor = null ;
}
 
开发者ID:busk,项目名称:WikipediaMiner,代码行数:22,代码来源:LabelDatabase.java


示例6: getId

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
/**
 * Returns the id of the vector which was assigned the given internal id or null if the internal id does
 * not exist. Accesses the BDB store!
 * 
 * @param iid
 *            The internal id of the vector
 * @return The id mapped to the given internal id or null if the internal id does not exist
 */
public String getId(int iid) {
	if (iid < 0 || iid > loadCounter) {
		System.out.println("Internal id " + iid + " is out of range!");
		return null;
	}
	DatabaseEntry key = new DatabaseEntry();
	IntegerBinding.intToEntry(iid, key);
	DatabaseEntry data = new DatabaseEntry();
	if ((iidToIdDB.get(null, key, data, null) == OperationStatus.SUCCESS)) {
		return StringBinding.entryToString(data);
	} else {
		System.out.println("Internal id " + iid + " is in range but id was not found..");
		System.out.println("Index is probably corrupted");
		System.exit(0);
		return null;
	}
}
 
开发者ID:MKLab-ITI,项目名称:multimedia-indexing,代码行数:26,代码来源:AbstractSearchStructure.java


示例7: buildTitleDatabase

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
public WDatabase<String, Integer> buildTitleDatabase(DatabaseType type) {
	if (type != DatabaseType.articlesByTitle && type != DatabaseType.categoriesByTitle)
		throw new IllegalArgumentException("type must be either DatabaseType.articlesByTitle or DatabaseType.categoriesByTitle") ;

	return new WDatabase<String, Integer>(
			env,
			type,
			new StringBinding(),
			new IntegerBinding()
	);
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:12,代码来源:WDatabaseFactory.java


示例8: createBinding

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
private EntryBinding createBinding(final Type type) throws UnsupportedOperationException {
    if (ReflectionUtils.isString(type)) {
        return new StringBinding();
    }
    if (ReflectionUtils.isInteger(type)) {
        return new IntegerBinding();
    }
    if (ReflectionUtils.isLong(type)) {
        return new LongBinding();
    }
    if (ReflectionUtils.isBoolean(type)) {
        return new BooleanBinding();
    }
    if (ReflectionUtils.isShort(type)) {
        return new ShortBinding();
    }
    if (ReflectionUtils.isByte(type)) {
        return new ByteBinding();
    }
    if (ReflectionUtils.isDouble(type)) {
        return new DoubleBinding();
    }
    if (ReflectionUtils.isFloat(type)) {
        return new FloatBinding();
    }
    if (ReflectionUtils.isCharacter(type)) {
        return new CharacterBinding();
    }
    if (ReflectionUtils.isByteArray(type)) {
        return new ByteArrayBinding();
    }
    throw new UnsupportedOperationException("Cannot provide collection of type " + type);
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:34,代码来源:BerkeleyDbStorageProvider.java


示例9: getSequence

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
public synchronized Sequence getSequence(String name)
    throws DatabaseException {

    checkOpen();

    if (storeConfig.getReadOnly()) {
        throw new IllegalStateException("Store is read-only");
    }

    Sequence seq = sequenceMap.get(name);
    if (seq == null) {
        if (sequenceDb == null) {
            String[] fileAndDbNames =
                parseDbName(storePrefix + SEQUENCE_DB);
            DatabaseConfig dbConfig = new DatabaseConfig();
            dbConfig.setTransactional(storeConfig.getTransactional());
            dbConfig.setAllowCreate(true);
            DbCompat.setTypeBtree(dbConfig);
            try {
                sequenceDb = DbCompat.openDatabase
                    (env, null/*txn*/, fileAndDbNames[0],
                     fileAndDbNames[1], dbConfig);
            } catch (FileNotFoundException e) {
                throw new DatabaseException(e);
            }
        }
        DatabaseEntry entry = new DatabaseEntry();
        StringBinding.stringToEntry(name, entry);
        seq = sequenceDb.openSequence(null, entry, getSequenceConfig(name));
        sequenceMap.put(name, seq);
    }
    return seq;
}
 
开发者ID:nologic,项目名称:nabs,代码行数:34,代码来源:Store.java


示例10: createBinding

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
private EntryBinding createBinding(Type type)
		throws UnsupportedOperationException {
	if (ReflectionUtils.isString(type)) {
		return new StringBinding();
	}
	if (ReflectionUtils.isInteger(type)) {
		return new IntegerBinding();
	}
	if (ReflectionUtils.isLong(type)) {
		return new LongBinding();
	}
	if (ReflectionUtils.isBoolean(type)) {
		return new BooleanBinding();
	}
	if (ReflectionUtils.isShort(type)) {
		return new ShortBinding();
	}
	if (ReflectionUtils.isByte(type)) {
		return new ByteBinding();
	}
	if (ReflectionUtils.isDouble(type)) {
		return new DoubleBinding();
	}
	if (ReflectionUtils.isFloat(type)) {
		return new FloatBinding();
	}
	if (ReflectionUtils.isCharacter(type)) {
		return new CharacterBinding();
	}
	if (ReflectionUtils.isByteArray(type)) {
		return new ByteArrayBinding();
	}
	throw new UnsupportedOperationException(
			"Cannot provide collection of type " + type);
}
 
开发者ID:datacleaner,项目名称:AnalyzerBeans,代码行数:36,代码来源:BerkeleyDbStorageProvider.java


示例11: saveNodeObject

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
private void saveNodeObject(Txn txn,
                            RepNodeImpl node,
                            DatabaseImpl groupDbImpl)
    throws DatabaseException {

    DatabaseEntry nodeNameKey = new DatabaseEntry();
    StringBinding.stringToEntry(node.getName(), nodeNameKey);

    final RepGroupDB.NodeBinding nodeBinding =
        new RepGroupDB.NodeBinding();
    DatabaseEntry memberInfoEntry = new DatabaseEntry();
    nodeBinding.objectToEntry(node, memberInfoEntry);

    Cursor cursor = null;
    try {
        cursor = makeCursor(groupDbImpl, txn, CursorConfig.DEFAULT);

        OperationStatus status =  cursor.put(nodeNameKey, memberInfoEntry);
        if (status != OperationStatus.SUCCESS) {
            throw EnvironmentFailureException.unexpectedState
                ("Group entry save failed");
        }
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:29,代码来源:RepGroupDB.java


示例12: readDataForType

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
public Map<String, DatabaseEntry> readDataForType(DataType dataType,
                                                  Environment env) {
    if (dbImpl == null) {
        return null;
    }

    Locker locker = null;
    boolean operationOK = false;
    Map<String, DatabaseEntry> readData = 
        new HashMap<String, DatabaseEntry>();

    try {
        locker = LockerFactory.getReadableLocker
            (env, null, dbImpl.isTransactional(), false);
        
        Cursor cursor = makeCursor(locker);
        
        DatabaseEntry key = new DatabaseEntry();
        DatabaseEntry data = new DatabaseEntry();

        while (OperationStatus.SUCCESS == 
               cursor.getNext(key, data, null)) {
            String keyName = StringBinding.entryToString(key);
            if (DataType.getDataType(keyName).equals(dataType)) {
                readData.put(keyName, data);
            }
            data = new DatabaseEntry();
        }

        operationOK = true;
    } finally {
        if (locker != null) {
            locker.operationEnd(operationOK);
        }
    }

    return readData;
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:39,代码来源:SyncDB.java


示例13: getInternalId

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
/**
 * Returns the internal id assigned to the vector with the given id or -1 if the id is not found. Accesses
 * the BDB store!
 * 
 * @param id
 *            The id of the vector
 * @return The internal id assigned to this vector or -1 if the id is not found.
 */
public int getInternalId(String id) {
	DatabaseEntry key = new DatabaseEntry();
	StringBinding.stringToEntry(id, key);
	DatabaseEntry data = new DatabaseEntry();
	// check if the id already exists in id to iid database
	if ((idToIidDB.get(null, key, data, null) == OperationStatus.SUCCESS)) {
		return IntegerBinding.entryToInt(data);
	} else {
		return -1;
	}
}
 
开发者ID:MKLab-ITI,项目名称:multimedia-indexing,代码行数:20,代码来源:AbstractSearchStructure.java


示例14: createMapping

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
/**
 * This method is used to create a persistent mapping between the given id and an internal id (equal to
 * the current value of {@link #loadCounter}). Should be called every time that a new vector is indexed.
 * 
 * @param id
 *            The id
 */
protected void createMapping(String id) {
	DatabaseEntry key = new DatabaseEntry();
	DatabaseEntry data = new DatabaseEntry();
	IntegerBinding.intToEntry(loadCounter, key);
	StringBinding.stringToEntry(id, data);
	iidToIdDB.put(null, key, data); // required during name look-up
	idToIidDB.put(null, data, key); // required during indexing
}
 
开发者ID:MKLab-ITI,项目名称:multimedia-indexing,代码行数:16,代码来源:AbstractSearchStructure.java


示例15: dumpiidToIdDB

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
/**
 * This is a utility method that can be used to dump the contents of the iidToIdDB to a txt file.
 * 
 * @param dumpFilename
 *            Full path to the file where the dump will be written.
 * @throws Exception
 */
public void dumpiidToIdDB(String dumpFilename) throws Exception {
	DatabaseEntry foundKey = new DatabaseEntry();
	DatabaseEntry foundData = new DatabaseEntry();

	ForwardCursor cursor = iidToIdDB.openCursor(null, null);
	BufferedWriter out = new BufferedWriter(new FileWriter(new File(dumpFilename)));
	while (cursor.getNext(foundKey, foundData, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
		int iid = IntegerBinding.entryToInt(foundKey);
		String id = StringBinding.entryToString(foundData);
		out.write(iid + " " + id + "\n");
	}
	cursor.close();
	out.close();
}
 
开发者ID:MKLab-ITI,项目名称:multimedia-indexing,代码行数:22,代码来源:AbstractSearchStructure.java


示例16: dumpidToIidDB

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
/**
 * This is a utility method that can be used to dump the contents of the idToIidDB to a txt file.
 * 
 * @param dumpFilename
 *            Full path to the file where the dump will be written.
 * @throws Exception
 */
public void dumpidToIidDB(String dumpFilename) throws Exception {
	DatabaseEntry foundKey = new DatabaseEntry();
	DatabaseEntry foundData = new DatabaseEntry();

	ForwardCursor cursor = idToIidDB.openCursor(null, null);
	BufferedWriter out = new BufferedWriter(new FileWriter(new File(dumpFilename)));
	while (cursor.getNext(foundKey, foundData, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
		int iid = IntegerBinding.entryToInt(foundData);
		String id = StringBinding.entryToString(foundKey);
		out.write(id + " " + iid + "\n");
	}
	cursor.close();
	out.close();
}
 
开发者ID:MKLab-ITI,项目名称:multimedia-indexing,代码行数:22,代码来源:AbstractSearchStructure.java


示例17: recursive

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
private int recursive(
	Transaction txn,
	final String endProt,
	Stack<String> path,
	int bestDepth,
	final int maxDepth
	)
{
DatabaseEntry key=new DatabaseEntry();
DatabaseEntry data=new DatabaseEntry();
StringBinding.stringToEntry(path.lastElement(), key);
if(this.database.get(txn,key,data,null)==OperationStatus.SUCCESS)
	{
	Set<String> partners=this.bindingSet.entryToObject(data);
	for(String prot2:partners)
		{
		int depth=-1;
		if(prot2.equals(endProt))
			{
			depth=path.size()-1;
			}
		else if(path.size()<maxDepth && !path.contains(prot2))
			{
			path.push(prot2);
			depth=recursive(txn,endProt,path,bestDepth,maxDepth);
			path.pop();
			}
		
		if(depth!=-1 && (bestDepth==-1 || bestDepth>depth))
			{
			bestDepth=depth;
			}
		}
	}
return bestDepth;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:37,代码来源:Biostar92368.java


示例18: put

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
private void put(File f,String xml)
  	{
  	LOG.info("insert "+f);
DatabaseEntry key=new DatabaseEntry();
DatabaseEntry data=new DatabaseEntry();
StringBinding.stringToEntry(f.getAbsolutePath(), key);
StringBinding.stringToEntry(xml,data);
this.database.put(this.txn, key, data);
  	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:10,代码来源:NgsFilesScanner.java


示例19: getAuthorByOrcid

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
private Author getAuthorByOrcid(final String orcid) {
final DatabaseEntry key=new DatabaseEntry();
final DatabaseEntry data=new DatabaseEntry();
StringBinding.stringToEntry(orcid, key);
if(this.authorDatabase.get(txn, key, data, LockMode.DEFAULT)==OperationStatus.SUCCESS) 
	{
	return this.authorBinding.entryToObject(data);
	}
else
	{
	return null;
	}
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:14,代码来源:PubmedOrcidGraph.java


示例20: insertAuthor

import com.sleepycat.bind.tuple.StringBinding; //导入依赖的package包/类
private Author insertAuthor(final Author au) {
final DatabaseEntry key=new DatabaseEntry();
final DatabaseEntry data=new DatabaseEntry();
StringBinding.stringToEntry(au.orcid, key);
this.authorBinding.objectToEntry(au, data);
if(this.authorDatabase.put(txn, key, data)!=OperationStatus.SUCCESS) {
	throw new JvarkitException.BerkeleyDbError("Cannot update author");
	}
return au;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:11,代码来源:PubmedOrcidGraph.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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