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


Java BidiMap类代码示例

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


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

示例1: testBidiClear

import org.apache.commons.collections4.BidiMap; //导入依赖的package包/类
@Test(timeout = 1000)
public void testBidiClear() {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testBidiClear");
    if (!(isRemoveSupported())) {
        try {
            makeFullMap().clear();
            makeFullMap().clear();
        } catch (final UnsupportedOperationException ex) {
        }
        return ;
    } 
    BidiMap<?, ?> map = makeFullMap();
    map.clear();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4857,map,4856,map.isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4859,map.inverseBidiMap(),4858,map.inverseBidiMap().isEmpty());
    map = makeFullMap().inverseBidiMap();
    map.clear();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4861,map,4860,map.isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4863,map.inverseBidiMap(),4862,map.inverseBidiMap().isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:22,代码来源:AbstractBidiMapTest.java

示例2: testBidiClear_add1568

import org.apache.commons.collections4.BidiMap; //导入依赖的package包/类
@Test(timeout = 1000)
public void testBidiClear_add1568() {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testBidiClear_add1568");
    if (!(isRemoveSupported())) {
        try {
            makeFullMap().clear();
        } catch (final UnsupportedOperationException ex) {
        }
        return ;
    } 
    BidiMap<?, ?> map = makeFullMap();
    map.clear();
    map.clear();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4857,map,4856,map.isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4859,map.inverseBidiMap(),4858,map.inverseBidiMap().isEmpty());
    map = makeFullMap().inverseBidiMap();
    map.clear();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4861,map,4860,map.isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4863,map.inverseBidiMap(),4862,map.inverseBidiMap().isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:22,代码来源:AbstractBidiMapTest.java

示例3: testBidiClear_add1569

import org.apache.commons.collections4.BidiMap; //导入依赖的package包/类
@Test(timeout = 1000)
public void testBidiClear_add1569() {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testBidiClear_add1569");
    if (!(isRemoveSupported())) {
        try {
            makeFullMap().clear();
        } catch (final UnsupportedOperationException ex) {
        }
        return ;
    } 
    BidiMap<?, ?> map = makeFullMap();
    map.clear();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4857,map,4856,map.isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4859,map.inverseBidiMap(),4858,map.inverseBidiMap().isEmpty());
    map = makeFullMap().inverseBidiMap();
    map.clear();
    map.clear();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4861,map,4860,map.isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4863,map.inverseBidiMap(),4862,map.inverseBidiMap().isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:22,代码来源:AbstractBidiMapTest.java

示例4: testBidiClear_remove1189

import org.apache.commons.collections4.BidiMap; //导入依赖的package包/类
@Test(timeout = 1000)
public void testBidiClear_remove1189() {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testBidiClear_remove1189");
    if (!(isRemoveSupported())) {
        try {
            makeFullMap().clear();
        } catch (final UnsupportedOperationException ex) {
        }
        return ;
    } 
    BidiMap<?, ?> map = makeFullMap();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4857,map,4856,map.isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4859,map.inverseBidiMap(),4858,map.inverseBidiMap().isEmpty());
    map = makeFullMap().inverseBidiMap();
    map.clear();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4861,map,4860,map.isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4863,map.inverseBidiMap(),4862,map.inverseBidiMap().isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:20,代码来源:AbstractBidiMapTest.java

示例5: testBidiClear_remove1190

import org.apache.commons.collections4.BidiMap; //导入依赖的package包/类
@Test(timeout = 1000)
public void testBidiClear_remove1190() {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testBidiClear_remove1190");
    if (!(isRemoveSupported())) {
        try {
            makeFullMap().clear();
        } catch (final UnsupportedOperationException ex) {
        }
        return ;
    } 
    BidiMap<?, ?> map = makeFullMap();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4857,map,4856,map.isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4859,map.inverseBidiMap(),4858,map.inverseBidiMap().isEmpty());
    map = makeFullMap().inverseBidiMap();
    map.clear();
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4861,map,4860,map.isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),4863,map.inverseBidiMap(),4862,map.inverseBidiMap().isEmpty());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:20,代码来源:AbstractBidiMapTest.java

示例6: startFollowingActually

import org.apache.commons.collections4.BidiMap; //导入依赖的package包/类
private synchronized Map.Entry<Follower, Future<Message>> startFollowingActually(
        final MidDeliveryMessageCondition<LogWatch> condition) {
    if (this.isStopped()) {
        throw new IllegalStateException("Cannot start following on an already terminated LogWatch.");
    }
    // assemble list of consumers to be handing down and then the follower
    final List<Pair<String, MessageMeasure<? extends Number, Follower>>> pairs = new ArrayList<>();
    for (final BidiMap.Entry<String, MessageMeasure<? extends Number, Follower>> entry : this.handingDown
            .entrySet()) {
        pairs.add(ImmutablePair.of(entry.getKey(),
                entry.getValue()));
    }
    // register the follower
    final Follower follower = new DefaultFollower(this, pairs);
    final Future<Message> expectation = condition == null ? null : follower.expect(condition);
    this.consumers.registerConsumer(follower);
    this.storage.followerStarted(follower);
    DefaultLogWatch.LOGGER.info("Registered {} for {}.", follower, this);
    return ImmutablePair.of(follower, expectation);
}
 
开发者ID:triceo,项目名称:splitlog,代码行数:21,代码来源:DefaultLogWatch.java

示例7: construct

import org.apache.commons.collections4.BidiMap; //导入依赖的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: inverseBidiMap

import org.apache.commons.collections4.BidiMap; //导入依赖的package包/类
@Override
public synchronized BidiMap<V, K> inverseBidiMap() {
    if (inverse == null) {
        inverse = new UnmodifiableBidiMap<V, K>(decorated().inverseBidiMap());
        inverse.inverse = this;
    }
    return inverse;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:UnmodifiableBidiMap.java

示例9: inverseBidiMap

import org.apache.commons.collections4.BidiMap; //导入依赖的package包/类
@Override
public BidiMap<V, K> inverseBidiMap() {
    if (inverseBidiMap == null) {
        inverseBidiMap = createBidiMap(reverseMap, normalMap, this);
    }
    return inverseBidiMap;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:8,代码来源:AbstractDualBidiMap.java

示例10: encodeInternal

import org.apache.commons.collections4.BidiMap; //导入依赖的package包/类
private String encodeInternal(String message, BidiMap<Character, Character> substitutionAlphabet) {
    StringBuilder result = new StringBuilder();
    for (char c : message.toCharArray()) {
        Character res = substitutionAlphabet.get(c);
        if (res == null)
            result.append(c);
        else {
            result.append(res);
        }
    }
    return result.toString();
}
 
开发者ID:xSAVIKx,项目名称:ciphers,代码行数:13,代码来源:SimpleSubstitutionCipher.java

示例11: generateSubstitutionAlphabet

import org.apache.commons.collections4.BidiMap; //导入依赖的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: main

import org.apache.commons.collections4.BidiMap; //导入依赖的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

示例13: main

import org.apache.commons.collections4.BidiMap; //导入依赖的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

示例14: encode

import org.apache.commons.collections4.BidiMap; //导入依赖的package包/类
/**
 * Encode string.
 *
 * @param original
 *     the original
 * @return the string
 */
protected String encode(String original) {
  BidiMap<String, String> codec = CODEC.get();
  String key = codec.getKey(original);
  if (key == null) {
    key = Integer.toHexString(codec.size());
    codec.put(key, original);
  }
  return key;
}
 
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:17,代码来源:RemoteCallUtils.java

示例15: getGUILanguageStrings

import org.apache.commons.collections4.BidiMap; //导入依赖的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


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