@Override public boolean containsKey(@NullableDecl Object key) { return forward.containsValue(key); }
public static String shortenCfName(String longName) throws PermanentBackendException { final String s; if (SHORT_CF_NAME_MAP.containsKey(longName)) { s = SHORT_CF_NAME_MAP.get(longName); Preconditions.checkNotNull(s); logger.debug("Substituted default CF name \"{}\" with short form \"{}\" to reduce HBase KeyValue size", longName, s); } else { if (SHORT_CF_NAME_MAP.containsValue(longName)) { String fmt = "Must use CF long-form name \"%s\" instead of the short-form name \"%s\" when configured with %s=true"; String msg = String.format(fmt, SHORT_CF_NAME_MAP.inverse().get(longName), longName, SHORT_CF_NAMES.getName()); throw new PermanentBackendException(msg); } s = longName; logger.debug("Kept default CF name \"{}\" because it has no associated short form", s); } return s; }
@Override public void registerBiome(Biome biome) { String fullId = biome.getId(); if (biomeShortIdMap.containsValue(biome)) { throw new IllegalArgumentException("The biome " + fullId + " is already registered."); } if (biomeIdMap.containsKey(fullId)) { throw new IllegalArgumentException("A biome with id " + fullId + " is already registered!"); } short biomeShortId = getFreeBiomeId(); logger.info("Registering biome {} with short id {}.", biome, biomeShortId); biomeShortIdMap.put(biomeShortId, biome); biomeIdMap.put(fullId, biome); }
@Override protected void expectMissing(Entry<K, V>... entries) { super.expectMissing(entries); for (Entry<K, V> entry : entries) { Entry<V, K> reversed = reverseEntry(entry); BiMap<V, K> inv = getMap().inverse(); assertFalse( "Inverse should not contain entry " + reversed, inv.entrySet().contains(reversed)); assertFalse( "Inverse should not contain key " + reversed.getKey(), inv.containsKey(reversed.getKey())); assertFalse( "Inverse should not contain value " + reversed.getValue(), inv.containsValue(reversed.getValue())); /* * TODO(cpovirk): This is a bit stronger than super.expectMissing(), which permits a <key, * someOtherValue> pair. */ assertNull( "Inverse should not return a mapping for key " + reversed.getKey(), inv.get(reversed.getKey())); } } }
field.setInt(null, value); resourceIdGenerator.record(field.getInt(null), resourceType, field.getName()); } else if (resIds.containsValue(field.getInt(null))) { int remappedValue = resourceIdGenerator.generate(resourceType, field.getName()); field.setInt(null, remappedValue);
if (!matching.containsValue(rhs)) {
continue; if (map.containsValue(value)) { final Integer prevKey = map.inverse().get(value); reportDuplicateEntry(
if (!matching.containsValue(rhs)) {
@SuppressWarnings("unchecked") @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS}) @CollectionSize.Require(ONE) public void testForcePutNullKeyPresent() { initMapWithNullKey(); getMap().forcePut(null, v1()); expectContents(Helpers.mapEntry((K) null, v1())); assertFalse(getMap().containsValue(v0())); assertTrue(getMap().containsValue(v1())); assertTrue(getMap().inverse().containsKey(v1())); assertNull(getMap().inverse().get(v1())); assertEquals(v1(), getMap().get(null)); assertEquals(1, getMap().size()); }
pairs.put(pair, adaptPair(ticker, pairs.get(pair))); if (!BitmexUtils.bitmexCurrencies.containsKey(baseCurrencyCode) && !BitmexUtils.bitmexCurrencies.containsValue(base)) BitmexUtils.bitmexCurrencies.put(baseCurrencyCode, base); if (!BitmexUtils.bitmexCurrencies.containsKey(quoteCurrencyCode) && !BitmexUtils.bitmexCurrencies.containsValue(quote)) BitmexUtils.bitmexCurrencies.put(quoteCurrencyCode, quote); && !BitmexUtils.bitmexContracts.containsValue(contract)) BitmexUtils.bitmexContracts.put(ticker.getSymbol(), contract);
@Override public List<OrganizationInfo> getOrganizations( UUID startResult, int count ) throws Exception { // still need the bimap to search for existing BiMap<UUID, String> organizations = HashBiMap.create(); EntityManager em = emf.getEntityManager(smf.getManagementAppId()); Results results = em.getCollection(em.getApplicationRef(), Schema.COLLECTION_GROUPS, startResult, count, Level.ALL_PROPERTIES, false); List<OrganizationInfo> orgs = new ArrayList<>( results.size() ); OrganizationInfo orgInfo; for ( Entity entity : results.getEntities() ) { String path = ( String ) entity.getProperty( PROPERTY_PATH ); if ( organizations.containsValue( path ) ) { path += "DUPLICATE"; } orgInfo = new OrganizationInfo( entity.getUuid(), path ); orgs.add( orgInfo ); organizations.put( entity.getUuid(), path ); } return orgs; }
@SuppressWarnings("unchecked") @MapFeature.Require(SUPPORTS_PUT) @CollectionSize.Require(ONE) public void testForcePutKeyPresent() { getMap().forcePut(k0(), v1()); expectContents(Helpers.mapEntry(k0(), v1())); assertFalse(getMap().containsValue(v0())); assertNull(getMap().inverse().get(v0())); assertEquals(1, getMap().size()); assertTrue(getMap().containsKey(k0())); }
if ( !getApplicationsForOrganization( organization.getUuid() ).containsValue( test_app_name ) ) { try { createApplication( organization.getUuid(), test_app_name );
public boolean contains(IdEObject eObject) { return objects.containsValue(eObject); }
public boolean containsOid(long oid) { return objectsToCommitFirst.containsValue(oid) || objectsToCommitSecond.containsValue(oid); }
@SuppressWarnings("unchecked") @MapFeature.Require(SUPPORTS_PUT) @CollectionSize.Require(SEVERAL) public void testForcePutKeyAndValuePresent() { getMap().forcePut(k0(), v1()); expectContents(Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k2(), v2())); assertEquals(2, getMap().size()); assertFalse(getMap().containsKey(k1())); assertFalse(getMap().containsValue(v0())); }
public void put(long oid, IdEObject object) { if (!oidCache.containsValue(object)) { oidCache.put(oid, (IdEObjectImpl) object); } }
private TableReference getFullTableName(TableReference shortTableName) { if (tableMap.get().containsValue(shortTableName)) { return tableMap.get().inverse().get(shortTableName); } else { updateTableMap(); Validate.isTrue(tableMap.get().containsValue(shortTableName), "Unable to resolve full name for table %s", shortTableName); return tableMap.get().inverse().get(shortTableName); } }
private void fixOidsFlat(IdEObject idEObject, OidProvider oidProvider, BiMap<Long, IdEObject> temp) { if (idEObject == null) { return; } if (temp.containsValue(idEObject)) { return; } ((IdEObjectImpl) idEObject).setOid(oidProvider.newOid(idEObject.eClass())); if (objects.containsValue(idEObject)) { temp.put(idEObject.getOid(), idEObject); } }
@SuppressWarnings("rawtypes") private void fixOids(IdEObject idEObject, OidProvider oidProvider, BiMap<Long, IdEObject> temp) { if (idEObject == null) { return; } if (temp.containsValue(idEObject)) { return; } ((IdEObjectImpl) idEObject).setOid(oidProvider.newOid(idEObject.eClass())); if (objects.containsValue(idEObject)) { temp.put(idEObject.getOid(), idEObject); } for (EReference eReference : idEObject.eClass().getEAllReferences()) { Object val = idEObject.eGet(eReference); if (eReference.isMany()) { List list = (List) val; for (Object o : list) { fixOids((IdEObject) o, oidProvider, temp); } } else { fixOids((IdEObject) val, oidProvider, temp); } } }