本文整理汇总了Java中org.apache.commons.collections4.bidimap.DualHashBidiMap类的典型用法代码示例。如果您正苦于以下问题:Java DualHashBidiMap类的具体用法?Java DualHashBidiMap怎么用?Java DualHashBidiMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DualHashBidiMap类属于org.apache.commons.collections4.bidimap包,在下文中一共展示了DualHashBidiMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: updateDependenciesUnderCoveredNode
import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
private void updateDependenciesUnderCoveredNode(ElementaryStringTree tree, DualHashBidiMap<Integer, Integer> coveredNodes,
DualHashBidiMap<Short, Short> offsetNodeIdsOfShadowTree, int timestamp, DepNode anchorNode, DependencyArc arc,
Iterator<DependencyArc> iterator, String[] words, String[] origPosTags)
{
boolean removedArcInfinitiveMarker = false;
if(tree.isRelation())
{
if(arc.isRelationIncomplete()) // avoid filling in an already complete relation entry)
{
setRelation(arc, anchorNode, iterator, words, origPosTags, "V", true, false);
}
if(arc.isArgumentIncomplete()) // fill in the arg by re-using the argument of the integration point's child verified above
{
if(!fillArgumentFromChildNode(arc, coveredNodes, offsetNodeIdsOfShadowTree, tree, words, origPosTags, timestamp))
{
// as a last resort fill in the anchor (relation) of the verifying tree as an argument.
// Apply infinitive marker heuristic, if necessary
removedArcInfinitiveMarker = applyInfinitiveMarkerHeuristic(arc, anchorNode, iterator, words, origPosTags, "V", true, false);
// setArgument(arc, anchorNode);
}
}
}
else if(arc.isArgumentIncomplete()) // avoid filling in an argument with a relation as well as replacing a complete entry
{
setArgument(arc, anchorNode, iterator, words, origPosTags, "V", true, false);
}
// possibly created a complete arc, so we can identify and disambiguate role labels discriminatively
if(!removedArcInfinitiveMarker)
{
boolean keepArc = identifyArcAndDisambiguateRoles(model, arc, words, origPosTags);
if(!keepArc)
{
removeArcSafe(arc, arc.getIntegrationPoint(), iterator);
}
}
}
开发者ID:sinantie,项目名称:PLTAG,代码行数:37,代码来源:DepTreeState.java
示例17: addNpSubstBelowSInFringe
import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
private boolean addNpSubstBelowSInFringe(List<Fringe> fringes, Node prefixNode, boolean verification, DualHashBidiMap<Short, Short> offsetNodeIdsOfShadowTree)
{
boolean updated = false;
int i = 0;
for(Fringe f : fringes)
if(addNpSubstBelowSInFringe(f, i++, prefixNode, false, verification, offsetNodeIdsOfShadowTree))
updated = true;
return updated;
}
开发者ID:sinantie,项目名称:PLTAG,代码行数:10,代码来源:DepTreeState.java
示例18: getGUILanguageStrings
import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
*
*
* @return
*/
public BidiMap<String, String> getGUILanguageStrings() {
final BidiMap<String, String> langs = new DualHashBidiMap<String, String>();
final String[] langsFromProp = getProp(AVAILABLE_LOCALES).split(";");
for (String st : langsFromProp) {
final String[] parts = st.split("-");
langs.put(parts[0], parts[1]);
}
return langs;
}
开发者ID:kolbasa,项目名称:OCRaptor,代码行数:15,代码来源:Config.java
示例19: getMap
import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
@Override
@SuppressWarnings(value = "unchecked")
public IterableMap<K, V> getMap() {
final IterableMap<K, V> testMap = new DualHashBidiMap<K, V>();
testMap.put(((K)("A")), ((V)("a")));
testMap.put(((K)("B")), ((V)("b")));
testMap.put(((K)("C")), ((V)("c")));
return testMap;
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:10,代码来源:UnmodifiableMapIteratorTest.java
示例20: checkViaDepthSearch
import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入依赖的package包/类
private static BidiMap<State, State> checkViaDepthSearch(TransitionSystem lts1, TransitionSystem lts2) {
BidiMap<State, State> result = new DualHashBidiMap<>();
Set<String> alphabet = lts1.getAlphabet();
if (!alphabet.equals(lts2.getAlphabet()))
// Not isomorphic, there is an arc with a label not occurring in the other lts
return result;
Queue<Pair<State, State>> unhandled = new ArrayDeque<>();
visit(result, unhandled, lts1.getInitialState(), lts2.getInitialState());
while (!unhandled.isEmpty()) {
InterrupterRegistry.throwIfInterruptRequestedForCurrentThread();
Pair<State, State> pair = unhandled.remove();
State state1 = pair.getFirst();
State state2 = pair.getSecond();
for (String label : alphabet) {
State follow1 = follow(state1, label);
State follow2 = follow(state2, label);
if (!visit(result, unhandled, follow1, follow2))
// Not isomorphic
return new DualHashBidiMap<>();
}
}
return result;
}
开发者ID:CvO-Theory,项目名称:apt,代码行数:30,代码来源:IsomorphismLogic.java
注:本文中的org.apache.commons.collections4.bidimap.DualHashBidiMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论