当前位置: 首页>>代码示例>>Java>>正文


Java DualHashBidiMap类代码示例

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


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

示例1: unbind

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * 解除绑定
 *
 * @param channelContext the channel context
 */
public void unbind(ChannelContext<SessionContext, P, R> channelContext)
{
	Lock lock = map.getLock().writeLock();
	DualHashBidiMap<String, ChannelContext<SessionContext, P, R>> m = map.getObj();
	try
	{
		lock.lock();
		m.removeValue(channelContext);
	} catch (Exception e)
	{
		throw e;
	} finally
	{
		lock.unlock();
	}
}
 
开发者ID:tywo45,项目名称:talent-aio,代码行数:22,代码来源:Users.java

示例2: bind

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * 绑定userid.
 *
 * @param userid the userid
 * @param channelContext the channel context
 * @author: tanyaowu
 * @创建时间: 2016年11月17日 下午2:25:46
 */
public void bind(String userid, ChannelContext<SessionContext, P, R> channelContext)
{
	String key = userid;
	Lock lock = map.getLock().writeLock();
	DualHashBidiMap<String, ChannelContext<SessionContext, P, R>> m = map.getObj();

	try
	{
		lock.lock();
		m.put(key, channelContext);
		channelContext.setUserid(userid);
	} catch (Exception e)
	{
		throw e;
	} finally
	{
		lock.unlock();
	}
}
 
开发者ID:tywo45,项目名称:talent-aio,代码行数:28,代码来源:Users.java

示例3: find

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * Find.
 *
 * @param userid the userid
 * @return the channel context
 */
public ChannelContext<SessionContext, P, R> find(String userid)
{
	String key = userid;
	Lock lock = map.getLock().readLock();
	DualHashBidiMap<String, ChannelContext<SessionContext, P, R>> m = map.getObj();

	try
	{
		lock.lock();
		return (ChannelContext<SessionContext, P, R>) m.get(key);
	} catch (Exception e)
	{
		throw e;
	} finally
	{
		lock.unlock();
	}
}
 
开发者ID:tywo45,项目名称:talent-aio,代码行数:25,代码来源:Users.java

示例4: remove

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * Removes映射
 *
 * @param <Ext> the generic type
 * @param <P> the generic type
 * @param <R> the generic type
 * @param channelContext the channel context
 */
public void remove(ChannelContext<SessionContext, P, R> channelContext)
{
	Lock lock = map.getLock().writeLock();
	DualHashBidiMap<String, ChannelContext<SessionContext, P, R>> m = map.getObj();
	try
	{
		lock.lock();
		m.removeValue(channelContext);
	} catch (Exception e)
	{
		throw e;
	} finally
	{
		lock.unlock();
	}
}
 
开发者ID:tywo45,项目名称:talent-aio,代码行数:25,代码来源:ClientNodes.java

示例5: put

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * 添加映射.
 *
 * @param <Ext> the generic type
 * @param <P> the generic type
 * @param <R> the generic type
 * @param channelContext the channel context
 * @author: tanyaowu
 * @创建时间: 2016年11月17日 下午2:25:46
 */
public void put(ChannelContext<SessionContext, P, R> channelContext)
{
	String key = getKey(channelContext);
	Lock lock = map.getLock().writeLock();
	DualHashBidiMap<String, ChannelContext<SessionContext, P, R>> m = map.getObj();

	try
	{
		lock.lock();
		m.put(key, channelContext);
	} catch (Exception e)
	{
		throw e;
	} finally
	{
		lock.unlock();
	}
}
 
开发者ID:tywo45,项目名称:talent-aio,代码行数:29,代码来源:ClientNodes.java

示例6: find

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
public ChannelContext<SessionContext, P, R> find(String key)
{
	Lock lock = map.getLock().readLock();
	DualHashBidiMap<String, ChannelContext<SessionContext, P, R>> m = map.getObj();

	try
	{
		lock.lock();
		return (ChannelContext<SessionContext, P, R>) m.get(key);
	} catch (Exception e)
	{
		throw e;
	} finally
	{
		lock.unlock();
	}
}
 
开发者ID:tywo45,项目名称:talent-aio,代码行数:18,代码来源:ClientNodes.java

示例7: construct

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
private static BidiMap<State, State> construct(TransitionSystem lts1, TransitionSystem lts2, boolean checkLabels) {
	// Check trivial case
	if (lts1.getNodes().size() != lts2.getNodes().size()) {
		return new DualHashBidiMap<>();
	}

	if (checkLabels) {
		boolean precond1 = checkPreconditions(lts1);
		boolean precond2 = checkPreconditions(lts2);
		if (precond1 != precond2)
			// Not isomorphic
			return new DualHashBidiMap<>();

		if (precond1 && precond2)
			// Both lts are totally reachable and deterministic. We can apply a special algorithm.
			return checkViaDepthSearch(lts1, lts2);
	}

	return new IsomorphismLogicComplex(lts1, lts2, checkLabels).getIsomorphism();
}
 
开发者ID:CvO-Theory,项目名称:apt,代码行数:21,代码来源:IsomorphismLogic.java

示例8: main

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * The main method.
 *
 * @param args the arguments
 * @author: tanyaowu
 * @创建时间: 2016年11月17日 下午1:12:56
 */
public static void main(String[] args)
{
	DualHashBidiMap<String, String> dualHashBidiMap = new DualHashBidiMap<>();
	dualHashBidiMap.put("111", "111111");
	dualHashBidiMap.put("222", "111111");
	System.out.println(dualHashBidiMap.getKey("111111"));
}
 
开发者ID:tywo45,项目名称:talent-aio,代码行数:15,代码来源:Users.java

示例9: InteractionClassModelManager

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
public InteractionClassModelManager() {
	this.published = new HashMap<String, InteractionClassModel>();
	this.mapInstanceNameInteractionClassEntity = new HashMap<String, InteractionClassEntity>();
	
	this.subscribed = new HashMap<String, InteractionClassModel>();
	this.mapInteractionClassHandleClass = new DualHashBidiMap<InteractionClassHandle, Class>();
}
 
开发者ID:SMASH-Lab,项目名称:SEE-HLA-Starter-Kit,代码行数:8,代码来源:InteractionClassModelManager.java

示例10: WordLexicon

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
public WordLexicon(final int size, final int nnz,
                   final Function<CharSequence, RIV> rivMaker,
                   final RIVTopicHeirarchy topics,
                   final DualHashBidiMap<String, RIV> lexicon) {
  super();
  this.size = size;
  this.nnz = nnz;
  this.topics = topics;
  this.lexicon = lexicon;
  permutations = Permutations.generate(size);
  this.rivMaker = rivMaker;
}
 
开发者ID:DruidGreeneyes,项目名称:rivet-core.java,代码行数:13,代码来源:WordLexicon.java

示例11: generateSubstitutionAlphabet

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * Generates map of substitution symbols for given language and substitution array
 *
 * @param language      language to generate substitution for
 * @param substitutions array of substitution characters
 * @return bi-directional map with 1:1 alphabets for given language
 */
public static BidiMap<Character, Character> generateSubstitutionAlphabet(Language language, char[] substitutions) {
    char[] languageAlphabet = getAlphabet(language);
    if (!ArrayUtils.isSameLength(substitutions, languageAlphabet))
        throw new IllegalArgumentException("Substitution array should have same alphabets as given language has");
    BidiMap<Character, Character> substitutionAlphabet = new DualHashBidiMap<>();
    for (int i = 0; i < languageAlphabet.length; i++) {
        char key = languageAlphabet[i];
        char value = substitutions[i];
        substitutionAlphabet.put(key, value);
    }
    return substitutionAlphabet;
}
 
开发者ID:xSAVIKx,项目名称:ciphers,代码行数:20,代码来源:Alphabet.java

示例12: ObjectClassModelManager

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
public ObjectClassModelManager() {
	this.published = new HashMap<String, ObjectClassModel>();
	this.mapInstanceNameObjectClassEntity = new DualHashBidiMap<String, ObjectClassEntity>();

	this.subscribed = new HashMap<String, ObjectClassModel>();
	this.mapHandleClassObjectClass = new HashMap<ObjectClassHandle, Class>();
	this.objectInstanceHandleObjectClassHandle = new HashMap<ObjectInstanceHandle, ObjectClassHandleEntity>();
}
 
开发者ID:SMASH-Lab,项目名称:HLA-Development-Kit,代码行数:9,代码来源:ObjectClassModelManager.java

示例13: main

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
public static void main(String[] args) {
    String[] englishWords = {"one", "two", "three","ball","snow"};
    String[] russianWords = {"jeden", "dwa", "trzy", "kula", "snieg"};

    // Create Multiset
    BidiMap<String, String> biMap = new DualHashBidiMap();
    // Create Polish-English dictionary
    int i = 0;
    for(String englishWord: englishWords) {
        biMap.put(englishWord, russianWords[i]);
        i++;
    }

    // Print count words
    System.out.println(biMap); // Print "{ball=kula, snow=snieg, one=jeden, two=dwa, three=trzy}" - in random orders
    // Print unique words
    System.out.println(biMap.keySet());    // print "[ball, snow, one, two, three]"- in random orders
    System.out.println(biMap.values());    // print "[kula, snieg, jeden, dwa, trzy]" - in random orders

    // Print translate by words
    System.out.println("one = " + biMap.get("one"));    // print one = jeden
    System.out.println("two = " + biMap.get("two"));    // print two = dwa
    System.out.println("kula = " + biMap.getKey("kula"));    // print kula = ball
    System.out.println("snieg = " + biMap.getKey("snieg"));    // print snieg = snow
    System.out.println("empty = " + biMap.get("empty"));    // print empty = null

    // Print count word's pair
    System.out.println(biMap.size());    //print 5

}
 
开发者ID:Vedenin,项目名称:java_in_examples,代码行数:31,代码来源:ApacheBidiMapTest.java

示例14: main

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
public static void main(String[] args) {
    String[] englishWords = {"one", "two", "three","ball","snow"};
    String[] russianWords = {"jeden", "dwa", "trzy", "kula", "snieg"};

    // Создаем Multiset
    BidiMap<String, String> biMap = new DualHashBidiMap();
    // создаем англо-польский словарь
    int i = 0;
    for(String englishWord: englishWords) {
        biMap.put(englishWord, russianWords[i]);
        i++;
    }

    // Выводим кол-вом вхождений слов
    System.out.println(biMap); // напечатает {ball=kula, snow=snieg, one=jeden, two=dwa, three=trzy}- в произвольном порядке
    // Выводим все уникальные слова
    System.out.println(biMap.keySet());    // напечатает [ball, snow, one, two, three]- в произвольном порядке
    System.out.println(biMap.values());    // напечатает [kula, snieg, jeden, dwa, trzy]- в произвольном порядке

    // Выводим перевод по каждому слову
    System.out.println("one = " + biMap.get("one"));    // напечатает one = jeden
    System.out.println("two = " + biMap.get("two"));    // напечатает two = dwa
    System.out.println("kula = " + biMap.getKey("kula"));    // напечатает kula = ball
    System.out.println("snieg = " + biMap.getKey("snieg"));    // напечатает snieg = snow
    System.out.println("empty = " + biMap.get("empty"));    // напечатает empty = null

    // Выводим общее количество переводов в словаре
    System.out.println(biMap.size());    //напечатает 5

}
 
开发者ID:Vedenin,项目名称:java_in_examples,代码行数:31,代码来源:ApacheBidiMapTest.java

示例15: getOffsetNodeIds

import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
public Map<Short, Short> getOffsetNodeIds()
{
    DualHashBidiMap<Short, Short> map = new DualHashBidiMap<Short, Short>();
    for(Integer id : tree.getNodes())
    {
        map.put(id.shortValue(), id == elemIpiNode ? prefixIpiNode : (short)(id + absolutePosOfRootInPrefixTree));
    }
    return map;
}
 
开发者ID:sinantie,项目名称:PLTAG,代码行数:10,代码来源:ShadowStringTree.java


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