Example usage for org.apache.commons.collections4 BidiMap size

List of usage examples for org.apache.commons.collections4 BidiMap size

Introduction

In this page you can find the example usage for org.apache.commons.collections4 BidiMap size.

Prototype

int size();

Source Link

Document

Returns the number of key-value mappings in this map.

Usage

From source file:org.jspresso.framework.qooxdoo.rpc.RemoteCallUtils.java

/**
 * Encode string./*  w ww  . j a  v a  2s  . c  om*/
 *
 * @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;
}

From source file:uniol.apt.analysis.isomorphism.AbstractIsomorphismTest.java

@Test
public void testIsomorphicWithItSelf() {
    BidiMap<State, State> isomorphism = testIsomorphism(getTs3A(), getTs3A());
    assertTrue(isomorphism.size() == 3);
    assertThat(isomorphism, allOf(hasEntry(nodeWithID("s0"), nodeWithID("s0")),
            hasEntry(nodeWithID("s1"), nodeWithID("s1")), hasEntry(nodeWithID("s2"), nodeWithID("s2"))));
}

From source file:uniol.apt.analysis.isomorphism.AbstractIsomorphismTest.java

@Test
public void testIsomorphicNets1() {
    BidiMap<State, State> isomorphism = testIsomorphism(getTs3A(), getTs3B());
    assertTrue(isomorphism.size() == 3);
    assertThat(isomorphism, allOf(hasEntry(nodeWithID("s0"), nodeWithID("s0")),
            hasEntry(nodeWithID("s1"), nodeWithID("s1")), hasEntry(nodeWithID("s2"), nodeWithID("s2"))));
}

From source file:uniol.apt.analysis.isomorphism.AbstractIsomorphismTest.java

/**
 * The nets IsoNet1A and IsoNet1B are identically,
 * except that the labels are exchanged.
 *//*from w ww .j  a  va2s .c o  m*/
@Test
public void testIsomorphicNets2() {
    BidiMap<State, State> isomorphism = testIsomorphism(getIsoTs1A(), getIsoTs1B());
    assertTrue(isomorphism.size() == 1);
    assertThat(isomorphism, hasEntry(nodeWithID("s0"), nodeWithID("s0")));
}

From source file:uniol.apt.analysis.isomorphism.AbstractIsomorphismTest.java

@Test
public void testIsomorphicNets3() {
    BidiMap<State, State> isomorphism = testIsomorphism(getIsoTs2A(), getIsoTs2B());
    assertTrue(isomorphism.size() == 1);
    assertThat(isomorphism, hasEntry(nodeWithID("s0"), nodeWithID("s0")));
}

From source file:uniol.apt.analysis.isomorphism.AbstractIsomorphismTest.java

/**
 * Test to check, if the initial nodes are mapped correctly
 * (IsoNet3A and IsoNet4a have isomorphic reachability graphs,
 * but their initial nodes don't map to each other)
 *///from   w  w  w.  j ava2  s  .c o  m
@Test
public void testNonIsomorphicNets3Own() {
    BidiMap<State, State> isomorphism = testWeakIsomorphism(getIsoTs3A(), getIsoTs3B());
    assertTrue(isomorphism.size() == 2);
    assertThat(isomorphism,
            allOf(hasEntry(nodeWithID("s0"), nodeWithID("s0")), hasEntry(nodeWithID("s1"), nodeWithID("s1"))));
}