List of usage examples for java.util SortedMap remove
V remove(Object key);
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamAccountConfigTable.java
public void updateAccountConfig(CFAccAuthorization Authorization, CFAccAccountConfigBuff Buff) { CFAccAccountConfigPKey pkey = schema.getFactoryAccountConfig().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); CFAccAccountConfigBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateAccountConfig", "Existing record not found", "AccountConfig", pkey); }//from www . j a v a 2s . c om if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateAccountConfig", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAccAccountConfigByTenantIdxKey existingKeyTenantIdx = schema.getFactoryAccountConfig().newTenantIdxKey(); existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccAccountConfigByTenantIdxKey newKeyTenantIdx = schema.getFactoryAccountConfig().newTenantIdxKey(); newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); CFAccAccountConfigByDefCcyIdxKey existingKeyDefCcyIdx = schema.getFactoryAccountConfig().newDefCcyIdxKey(); existingKeyDefCcyIdx.setRequiredDefaultCurrencyId(existing.getRequiredDefaultCurrencyId()); CFAccAccountConfigByDefCcyIdxKey newKeyDefCcyIdx = schema.getFactoryAccountConfig().newDefCcyIdxKey(); newKeyDefCcyIdx.setRequiredDefaultCurrencyId(Buff.getRequiredDefaultCurrencyId()); CFAccAccountConfigByCustCtcLstIdxKey existingKeyCustCtcLstIdx = schema.getFactoryAccountConfig() .newCustCtcLstIdxKey(); existingKeyCustCtcLstIdx.setOptionalCustContactListTenantId(existing.getOptionalCustContactListTenantId()); existingKeyCustCtcLstIdx.setOptionalCustContactListId(existing.getOptionalCustContactListId()); CFAccAccountConfigByCustCtcLstIdxKey newKeyCustCtcLstIdx = schema.getFactoryAccountConfig() .newCustCtcLstIdxKey(); newKeyCustCtcLstIdx.setOptionalCustContactListTenantId(Buff.getOptionalCustContactListTenantId()); newKeyCustCtcLstIdx.setOptionalCustContactListId(Buff.getOptionalCustContactListId()); CFAccAccountConfigByEmpCtcLstIdxKey existingKeyEmpCtcLstIdx = schema.getFactoryAccountConfig() .newEmpCtcLstIdxKey(); existingKeyEmpCtcLstIdx.setOptionalEmpContactListTenantId(existing.getOptionalEmpContactListTenantId()); existingKeyEmpCtcLstIdx.setOptionalEmpContactListId(existing.getOptionalEmpContactListId()); CFAccAccountConfigByEmpCtcLstIdxKey newKeyEmpCtcLstIdx = schema.getFactoryAccountConfig() .newEmpCtcLstIdxKey(); newKeyEmpCtcLstIdx.setOptionalEmpContactListTenantId(Buff.getOptionalEmpContactListTenantId()); newKeyEmpCtcLstIdx.setOptionalEmpContactListId(Buff.getOptionalEmpContactListId()); CFAccAccountConfigByVendCtcLstIdxKey existingKeyVendCtcLstIdx = schema.getFactoryAccountConfig() .newVendCtcLstIdxKey(); existingKeyVendCtcLstIdx.setOptionalVendContactListTenantId(existing.getOptionalVendContactListTenantId()); existingKeyVendCtcLstIdx.setOptionalVendContactListId(existing.getOptionalVendContactListId()); CFAccAccountConfigByVendCtcLstIdxKey newKeyVendCtcLstIdx = schema.getFactoryAccountConfig() .newVendCtcLstIdxKey(); newKeyVendCtcLstIdx.setOptionalVendContactListTenantId(Buff.getOptionalVendContactListTenantId()); newKeyVendCtcLstIdx.setOptionalVendContactListId(Buff.getOptionalVendContactListId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableTenant().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAccountConfig", "Container", "Tenant", "Tenant", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableISOCurrency().readDerivedByIdIdx(Authorization, Buff.getRequiredDefaultCurrencyId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAccountConfig", "Lookup", "DefaultCurrency", "ISOCurrency", null); } } } // Update is valid SortedMap<CFAccAccountConfigPKey, CFAccAccountConfigBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByTenantIdx.get(existingKeyTenantIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTenantIdx.containsKey(newKeyTenantIdx)) { subdict = dictByTenantIdx.get(newKeyTenantIdx); } else { subdict = new TreeMap<CFAccAccountConfigPKey, CFAccAccountConfigBuff>(); dictByTenantIdx.put(newKeyTenantIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByDefCcyIdx.get(existingKeyDefCcyIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByDefCcyIdx.containsKey(newKeyDefCcyIdx)) { subdict = dictByDefCcyIdx.get(newKeyDefCcyIdx); } else { subdict = new TreeMap<CFAccAccountConfigPKey, CFAccAccountConfigBuff>(); dictByDefCcyIdx.put(newKeyDefCcyIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByCustCtcLstIdx.get(existingKeyCustCtcLstIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByCustCtcLstIdx.containsKey(newKeyCustCtcLstIdx)) { subdict = dictByCustCtcLstIdx.get(newKeyCustCtcLstIdx); } else { subdict = new TreeMap<CFAccAccountConfigPKey, CFAccAccountConfigBuff>(); dictByCustCtcLstIdx.put(newKeyCustCtcLstIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByEmpCtcLstIdx.get(existingKeyEmpCtcLstIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByEmpCtcLstIdx.containsKey(newKeyEmpCtcLstIdx)) { subdict = dictByEmpCtcLstIdx.get(newKeyEmpCtcLstIdx); } else { subdict = new TreeMap<CFAccAccountConfigPKey, CFAccAccountConfigBuff>(); dictByEmpCtcLstIdx.put(newKeyEmpCtcLstIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByVendCtcLstIdx.get(existingKeyVendCtcLstIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByVendCtcLstIdx.containsKey(newKeyVendCtcLstIdx)) { subdict = dictByVendCtcLstIdx.get(newKeyVendCtcLstIdx); } else { subdict = new TreeMap<CFAccAccountConfigPKey, CFAccAccountConfigBuff>(); dictByVendCtcLstIdx.put(newKeyVendCtcLstIdx, subdict); } subdict.put(pkey, Buff); }
From source file:com.alkacon.opencms.counter.CmsCounterDialog.java
/** * This function compares the list from the dialog with the list from the database and * update the list from the database with the values from the dialog.<p> * // w w w . ja v a2 s .c om * @param counterList the list from the dialog * * @throws Exception if an Exception occurred. */ private void updateCounterValues(SortedMap counterList) throws Exception { if (m_manager == null) { m_manager = getCounterManager(); } // get the counters from the database TreeMap map = m_manager.getCounters(); Iterator iteratork = map.keySet().iterator(); Iterator iterator = map.values().iterator(); // for each entry check if its changed or deleted int o_value; int new_value; String o_key; while (iterator.hasNext() && iteratork.hasNext()) { o_value = getIntValue(iterator.next()); o_key = (String) iteratork.next(); if (counterList.containsKey(o_key)) { // the value exits new_value = getIntValue(counterList.get(o_key)); if (o_value != new_value) { if ((o_value < new_value) || (o_value > new_value && m_overwrite)) { m_manager.setCounter(o_key, new_value); } counterList.remove(o_key); } else { counterList.remove(o_key); } } else { // the value is deleted m_manager.deleteCounter(o_key); } } // now the new values is adding to the database if (!counterList.isEmpty()) { iteratork = counterList.keySet().iterator(); iterator = counterList.values().iterator(); while (iterator.hasNext() && iteratork.hasNext()) { o_value = getIntValue(iterator.next()); o_key = (String) iteratork.next(); m_manager.setCounter(o_key, o_value); } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamAccountEntryTable.java
public void deleteAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { final String S_ProcName = "CFAccRamAccountEntryTable.deleteAccountEntry() "; CFAccAccountEntryPKey pkey = schema.getFactoryAccountEntry().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredAccountId(Buff.getRequiredAccountId()); pkey.setRequiredEntryId(Buff.getRequiredEntryId()); CFAccAccountEntryBuff existing = dictByPKey.get(pkey); if (existing == null) { return;//from w w w .j a v a 2 s .co m } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteAccountEntry", pkey); } CFAccAccountEntryByUEntryIdxKey keyUEntryIdx = schema.getFactoryAccountEntry().newUEntryIdxKey(); keyUEntryIdx.setRequiredEntryId(existing.getRequiredEntryId()); CFAccAccountEntryByAccTsIdxKey keyAccTsIdx = schema.getFactoryAccountEntry().newAccTsIdxKey(); keyAccTsIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyAccTsIdx.setRequiredAccountId(existing.getRequiredAccountId()); keyAccTsIdx.setRequiredEntryStamp(existing.getRequiredEntryStamp()); CFAccAccountEntryByEStampIdxKey keyEStampIdx = schema.getFactoryAccountEntry().newEStampIdxKey(); keyEStampIdx.setRequiredEntryStamp(existing.getRequiredEntryStamp()); CFAccAccountEntryBySplitIdxKey keySplitIdx = schema.getFactoryAccountEntry().newSplitIdxKey(); keySplitIdx.setOptionalSplitEntryId(existing.getOptionalSplitEntryId()); CFAccAccountEntryByTenantIdxKey keyTenantIdx = schema.getFactoryAccountEntry().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccAccountEntryByAcctIdxKey keyAcctIdx = schema.getFactoryAccountEntry().newAcctIdxKey(); keyAcctIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyAcctIdx.setRequiredAccountId(existing.getRequiredAccountId()); CFAccAccountEntryByXfrAcctIdxKey keyXfrAcctIdx = schema.getFactoryAccountEntry().newXfrAcctIdxKey(); keyXfrAcctIdx.setOptionalTransferTenantId(existing.getOptionalTransferTenantId()); keyXfrAcctIdx.setOptionalTransferAccountId(existing.getOptionalTransferAccountId()); CFAccAccountEntryByDrCcyIdxKey keyDrCcyIdx = schema.getFactoryAccountEntry().newDrCcyIdxKey(); keyDrCcyIdx.setOptionalDebitCurrencyId(existing.getOptionalDebitCurrencyId()); CFAccAccountEntryByCrCcyIdxKey keyCrCcyIdx = schema.getFactoryAccountEntry().newCrCcyIdxKey(); keyCrCcyIdx.setOptionalCreditCurrencyId(existing.getOptionalCreditCurrencyId()); CFAccAccountEntryByCvtCcyIdxKey keyCvtCcyIdx = schema.getFactoryAccountEntry().newCvtCcyIdxKey(); keyCvtCcyIdx.setRequiredConvertedCurrencyId(existing.getRequiredConvertedCurrencyId()); CFAccAccountEntryByBalCcyIdxKey keyBalCcyIdx = schema.getFactoryAccountEntry().newBalCcyIdxKey(); keyBalCcyIdx.setRequiredBalanceCurrencyId(existing.getRequiredBalanceCurrencyId()); // Validate reverse foreign keys // Delete is valid SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdict; dictByPKey.remove(pkey); dictByUEntryIdx.remove(keyUEntryIdx); subdict = dictByAccTsIdx.get(keyAccTsIdx); subdict.remove(pkey); subdict = dictByEStampIdx.get(keyEStampIdx); subdict.remove(pkey); subdict = dictBySplitIdx.get(keySplitIdx); subdict.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); subdict = dictByAcctIdx.get(keyAcctIdx); subdict.remove(pkey); subdict = dictByXfrAcctIdx.get(keyXfrAcctIdx); subdict.remove(pkey); subdict = dictByDrCcyIdx.get(keyDrCcyIdx); subdict.remove(pkey); subdict = dictByCrCcyIdx.get(keyCrCcyIdx); subdict.remove(pkey); subdict = dictByCvtCcyIdx.get(keyCvtCcyIdx); subdict.remove(pkey); subdict = dictByBalCcyIdx.get(keyBalCcyIdx); subdict.remove(pkey); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamAccountEntryTable.java
public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) { CFAccAccountEntryPKey pkey = schema.getFactoryAccountEntry().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredAccountId(Buff.getRequiredAccountId()); pkey.setRequiredEntryId(Buff.getRequiredEntryId()); CFAccAccountEntryBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateAccountEntry", "Existing record not found", "AccountEntry", pkey); }/*from w w w .j a v a 2 s .com*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateAccountEntry", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAccAccountEntryByUEntryIdxKey existingKeyUEntryIdx = schema.getFactoryAccountEntry().newUEntryIdxKey(); existingKeyUEntryIdx.setRequiredEntryId(existing.getRequiredEntryId()); CFAccAccountEntryByUEntryIdxKey newKeyUEntryIdx = schema.getFactoryAccountEntry().newUEntryIdxKey(); newKeyUEntryIdx.setRequiredEntryId(Buff.getRequiredEntryId()); CFAccAccountEntryByAccTsIdxKey existingKeyAccTsIdx = schema.getFactoryAccountEntry().newAccTsIdxKey(); existingKeyAccTsIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyAccTsIdx.setRequiredAccountId(existing.getRequiredAccountId()); existingKeyAccTsIdx.setRequiredEntryStamp(existing.getRequiredEntryStamp()); CFAccAccountEntryByAccTsIdxKey newKeyAccTsIdx = schema.getFactoryAccountEntry().newAccTsIdxKey(); newKeyAccTsIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyAccTsIdx.setRequiredAccountId(Buff.getRequiredAccountId()); newKeyAccTsIdx.setRequiredEntryStamp(Buff.getRequiredEntryStamp()); CFAccAccountEntryByEStampIdxKey existingKeyEStampIdx = schema.getFactoryAccountEntry().newEStampIdxKey(); existingKeyEStampIdx.setRequiredEntryStamp(existing.getRequiredEntryStamp()); CFAccAccountEntryByEStampIdxKey newKeyEStampIdx = schema.getFactoryAccountEntry().newEStampIdxKey(); newKeyEStampIdx.setRequiredEntryStamp(Buff.getRequiredEntryStamp()); CFAccAccountEntryBySplitIdxKey existingKeySplitIdx = schema.getFactoryAccountEntry().newSplitIdxKey(); existingKeySplitIdx.setOptionalSplitEntryId(existing.getOptionalSplitEntryId()); CFAccAccountEntryBySplitIdxKey newKeySplitIdx = schema.getFactoryAccountEntry().newSplitIdxKey(); newKeySplitIdx.setOptionalSplitEntryId(Buff.getOptionalSplitEntryId()); CFAccAccountEntryByTenantIdxKey existingKeyTenantIdx = schema.getFactoryAccountEntry().newTenantIdxKey(); existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccAccountEntryByTenantIdxKey newKeyTenantIdx = schema.getFactoryAccountEntry().newTenantIdxKey(); newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); CFAccAccountEntryByAcctIdxKey existingKeyAcctIdx = schema.getFactoryAccountEntry().newAcctIdxKey(); existingKeyAcctIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyAcctIdx.setRequiredAccountId(existing.getRequiredAccountId()); CFAccAccountEntryByAcctIdxKey newKeyAcctIdx = schema.getFactoryAccountEntry().newAcctIdxKey(); newKeyAcctIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyAcctIdx.setRequiredAccountId(Buff.getRequiredAccountId()); CFAccAccountEntryByXfrAcctIdxKey existingKeyXfrAcctIdx = schema.getFactoryAccountEntry().newXfrAcctIdxKey(); existingKeyXfrAcctIdx.setOptionalTransferTenantId(existing.getOptionalTransferTenantId()); existingKeyXfrAcctIdx.setOptionalTransferAccountId(existing.getOptionalTransferAccountId()); CFAccAccountEntryByXfrAcctIdxKey newKeyXfrAcctIdx = schema.getFactoryAccountEntry().newXfrAcctIdxKey(); newKeyXfrAcctIdx.setOptionalTransferTenantId(Buff.getOptionalTransferTenantId()); newKeyXfrAcctIdx.setOptionalTransferAccountId(Buff.getOptionalTransferAccountId()); CFAccAccountEntryByDrCcyIdxKey existingKeyDrCcyIdx = schema.getFactoryAccountEntry().newDrCcyIdxKey(); existingKeyDrCcyIdx.setOptionalDebitCurrencyId(existing.getOptionalDebitCurrencyId()); CFAccAccountEntryByDrCcyIdxKey newKeyDrCcyIdx = schema.getFactoryAccountEntry().newDrCcyIdxKey(); newKeyDrCcyIdx.setOptionalDebitCurrencyId(Buff.getOptionalDebitCurrencyId()); CFAccAccountEntryByCrCcyIdxKey existingKeyCrCcyIdx = schema.getFactoryAccountEntry().newCrCcyIdxKey(); existingKeyCrCcyIdx.setOptionalCreditCurrencyId(existing.getOptionalCreditCurrencyId()); CFAccAccountEntryByCrCcyIdxKey newKeyCrCcyIdx = schema.getFactoryAccountEntry().newCrCcyIdxKey(); newKeyCrCcyIdx.setOptionalCreditCurrencyId(Buff.getOptionalCreditCurrencyId()); CFAccAccountEntryByCvtCcyIdxKey existingKeyCvtCcyIdx = schema.getFactoryAccountEntry().newCvtCcyIdxKey(); existingKeyCvtCcyIdx.setRequiredConvertedCurrencyId(existing.getRequiredConvertedCurrencyId()); CFAccAccountEntryByCvtCcyIdxKey newKeyCvtCcyIdx = schema.getFactoryAccountEntry().newCvtCcyIdxKey(); newKeyCvtCcyIdx.setRequiredConvertedCurrencyId(Buff.getRequiredConvertedCurrencyId()); CFAccAccountEntryByBalCcyIdxKey existingKeyBalCcyIdx = schema.getFactoryAccountEntry().newBalCcyIdxKey(); existingKeyBalCcyIdx.setRequiredBalanceCurrencyId(existing.getRequiredBalanceCurrencyId()); CFAccAccountEntryByBalCcyIdxKey newKeyBalCcyIdx = schema.getFactoryAccountEntry().newBalCcyIdxKey(); newKeyBalCcyIdx.setRequiredBalanceCurrencyId(Buff.getRequiredBalanceCurrencyId()); // Check unique indexes if (!existingKeyUEntryIdx.equals(newKeyUEntryIdx)) { if (dictByUEntryIdx.containsKey(newKeyUEntryIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateAccountEntry", "AccountEntryUEntryIdx", newKeyUEntryIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableAccount().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredAccountId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAccountEntry", "Container", "Account", "Account", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableTenant().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAccountEntry", "Owner", "Tenant", "Tenant", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableISOCurrency().readDerivedByIdIdx(Authorization, Buff.getRequiredConvertedCurrencyId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAccountEntry", "Lookup", "ConvertedCurrency", "ISOCurrency", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableISOCurrency().readDerivedByIdIdx(Authorization, Buff.getRequiredBalanceCurrencyId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAccountEntry", "Lookup", "BalanceCurrency", "ISOCurrency", null); } } } // Update is valid SortedMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByUEntryIdx.remove(existingKeyUEntryIdx); dictByUEntryIdx.put(newKeyUEntryIdx, Buff); subdict = dictByAccTsIdx.get(existingKeyAccTsIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByAccTsIdx.containsKey(newKeyAccTsIdx)) { subdict = dictByAccTsIdx.get(newKeyAccTsIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByAccTsIdx.put(newKeyAccTsIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByEStampIdx.get(existingKeyEStampIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByEStampIdx.containsKey(newKeyEStampIdx)) { subdict = dictByEStampIdx.get(newKeyEStampIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByEStampIdx.put(newKeyEStampIdx, subdict); } subdict.put(pkey, Buff); subdict = dictBySplitIdx.get(existingKeySplitIdx); if (subdict != null) { subdict.remove(pkey); } if (dictBySplitIdx.containsKey(newKeySplitIdx)) { subdict = dictBySplitIdx.get(newKeySplitIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictBySplitIdx.put(newKeySplitIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByTenantIdx.get(existingKeyTenantIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTenantIdx.containsKey(newKeyTenantIdx)) { subdict = dictByTenantIdx.get(newKeyTenantIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByTenantIdx.put(newKeyTenantIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByAcctIdx.get(existingKeyAcctIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByAcctIdx.containsKey(newKeyAcctIdx)) { subdict = dictByAcctIdx.get(newKeyAcctIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByAcctIdx.put(newKeyAcctIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByXfrAcctIdx.get(existingKeyXfrAcctIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByXfrAcctIdx.containsKey(newKeyXfrAcctIdx)) { subdict = dictByXfrAcctIdx.get(newKeyXfrAcctIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByXfrAcctIdx.put(newKeyXfrAcctIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByDrCcyIdx.get(existingKeyDrCcyIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByDrCcyIdx.containsKey(newKeyDrCcyIdx)) { subdict = dictByDrCcyIdx.get(newKeyDrCcyIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByDrCcyIdx.put(newKeyDrCcyIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByCrCcyIdx.get(existingKeyCrCcyIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByCrCcyIdx.containsKey(newKeyCrCcyIdx)) { subdict = dictByCrCcyIdx.get(newKeyCrCcyIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByCrCcyIdx.put(newKeyCrCcyIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByCvtCcyIdx.get(existingKeyCvtCcyIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByCvtCcyIdx.containsKey(newKeyCvtCcyIdx)) { subdict = dictByCvtCcyIdx.get(newKeyCvtCcyIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByCvtCcyIdx.put(newKeyCvtCcyIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByBalCcyIdx.get(existingKeyBalCcyIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByBalCcyIdx.containsKey(newKeyBalCcyIdx)) { subdict = dictByBalCcyIdx.get(newKeyBalCcyIdx); } else { subdict = new TreeMap<CFAccAccountEntryPKey, CFAccAccountEntryBuff>(); dictByBalCcyIdx.put(newKeyBalCcyIdx, subdict); } subdict.put(pkey, Buff); }
From source file:de.uni_potsdam.hpi.asg.logictool.mapping.SequenceBasedAndGateDecomposer.java
private Map<Integer, List<Partition>> getPartitions(Set<Signal> signals, int startgatesize) { // cost function SortedMap<Integer, List<Partition>> retVal = new TreeMap<>(Collections.reverseOrder()); Set<Set<Set<Signal>>> parts = getTailCombinations(signals); if (parts == null) { return null; }/*from w w w.ja v a 2 s .co m*/ for (Set<Set<Signal>> partition : parts) { int cost = 0; Set<PartitionPart> parts2 = new HashSet<>(); for (Set<Signal> partpart : partition) { parts2.add(new PartitionPart(partpart)); if (partpart.size() != 1) { cost += partpart.size(); } } if (partition.size() != 1) { cost += partition.size(); } if (!retVal.containsKey(cost)) { retVal.put(cost, new ArrayList<Partition>()); } retVal.get(cost).add(new Partition(parts2, cost)); } // System.out.println("Startgatesize: " + startgatesize); // filter too large List<Partition> rmPart = new ArrayList<>(); List<Integer> rmKey = new ArrayList<>(); for (Entry<Integer, List<Partition>> entry : retVal.entrySet()) { // System.out.println(entry.getKey()); rmPart.clear(); for (Partition p : entry.getValue()) { // System.out.println("\t" + p.toString()); if (p.getPartition().size() >= startgatesize) { // System.out.println("Rm: " + p); rmPart.add(p); continue; } for (PartitionPart p2 : p.getPartition()) { if (p2.getPart().size() >= startgatesize) { // System.out.println("Rm: " + p); rmPart.add(p); continue; } } } entry.getValue().removeAll(rmPart); if (entry.getValue().isEmpty()) { rmKey.add(entry.getKey()); } } for (int i : rmKey) { retVal.remove(i); } return retVal; }
From source file:com.google.gwt.emultest.java.util.TreeMapTest.java
public void testHeadMapLjava_lang_ObjectZL() { K[] keys = getSortedKeys();//from ww w . ja v a 2s . co m V[] values = getSortedValues(); NavigableMap<K, V> map = createNavigableMap(); for (int i = 0; i < keys.length; i++) { map.put(keys[i], values[i]); } // normal case SortedMap<K, V> subMap = map.headMap(keys[2], true); assertEquals(3, subMap.size()); subMap = map.headMap(keys[3], true); assertEquals(4, subMap.size()); for (int i = 0; i < 4; i++) { assertEquals(values[i], subMap.get(keys[i])); } subMap = map.headMap(keys[2], false); assertEquals(2, subMap.size()); assertNull(subMap.get(keys[3])); // Exceptions assertEquals(0, map.headMap(keys[0], false).size()); try { map.headMap(null, true); assertTrue("expected exception", useNullKey()); } catch (NullPointerException e) { assertFalse("unexpected NPE", useNullKey()); } try { map.headMap(null, false); assertTrue("expected exception", useNullKey()); } catch (NullPointerException e) { assertFalse("unexpected NPE", useNullKey()); } subMap = map.headMap(keys[2]); assertEquals(2, subMap.size()); try { subMap.put(keys[2], values[2]); fail("should throw IllegalArgumentException"); } catch (IllegalArgumentException expected) { } assertEquals(keys.length, map.size()); subMap = map.headMap(keys[2], true); assertEquals(3, subMap.size()); subMap.remove(keys[1]); assertFalse(subMap.containsKey(keys[1])); assertFalse(subMap.containsValue(values[1])); assertFalse(map.containsKey(keys[1])); assertFalse(map.containsValue(values[1])); assertEquals(2, subMap.size()); assertEquals(keys.length - 1, map.size()); subMap.put(keys[1], values[1]); try { subMap.subMap(keys[1], keys[3]); fail("should throw IllegalArgumentException"); } catch (IllegalArgumentException expected) { } try { subMap.subMap(keys[3], keys[1]); fail("should throw IllegalArgumentException"); } catch (IllegalArgumentException expected) { } if (useNullKey() && useNullValue()) { map.put(null, null); subMap = map.headMap(null, true); assertEquals(1, subMap.size()); assertTrue(subMap.containsValue(null)); assertNull(subMap.get(null)); subMap = map.subMap(null, false, keys[2], true); assertEquals(3, subMap.size()); Set<K> keySet = subMap.keySet(); assertEquals(3, keySet.size()); Set<Map.Entry<K, V>> entrySet = subMap.entrySet(); assertEquals(3, entrySet.size()); Collection<V> valueCollection = subMap.values(); assertEquals(3, valueCollection.size()); map.remove(null); } // head map of head map NavigableMap<K, V> headMap = map.headMap(keys[3], true); assertEquals(4, headMap.size()); headMap = headMap.headMap(keys[3], false); assertEquals(3, headMap.size()); headMap = headMap.headMap(keys[2], false); assertEquals(2, headMap.size()); headMap = headMap.tailMap(keys[0], false); assertEquals(1, headMap.size()); headMap = headMap.tailMap(keys[1], false); assertEquals(0, headMap.size()); }
From source file:com.google.gwt.emultest.java.util.TreeMapTest.java
/** * Test method for 'java.util.Map.put(Object, Object)'. This test shows some * bad behavior of the TreeMap class before JDK 7. A mapping with null key can * be put in but several methods are are unusable afterward. * * A SortedMap with natural ordering (no comparator) is supposed to throw a * null pointer exception if a null keys are "not supported". For a natural * ordered TreeMap before JDK 7, a null pointer exception is not thrown. But, * the map is left in a state where any other key based methods result in a * null pointer exception.// w ww .j ava 2 s. co m * * @see java.util.Map#put(Object, Object) */ public void testPut_nullKey() { K[] keys = getSortedKeys(); V[] values = getSortedValues(); SortedMap<K, V> sortedMap = createNavigableMap(); if (useNullKey()) { assertNull(sortedMap.put(null, values[0])); assertTrue(sortedMap.containsValue(values[0])); // the map methods the continue to function sortedMap.containsValue(null); sortedMap.containsValue(values[0]); sortedMap.entrySet(); sortedMap.equals(createMap()); sortedMap.hashCode(); sortedMap.isEmpty(); sortedMap.keySet(); sortedMap.putAll(createMap()); sortedMap.size(); sortedMap.values(); // all of the sorted map methods still function sortedMap.comparator(); sortedMap.firstKey(); sortedMap.lastKey(); sortedMap.subMap(getLessThanMinimumKey(), getGreaterThanMaximumKey()); sortedMap.headMap(getLessThanMinimumKey()); sortedMap.tailMap(getLessThanMinimumKey()); } else if (TestUtils.getJdkVersion() > 6) { // nulls are rejected immediately and don't poison the map anymore try { assertNull(sortedMap.put(null, values[0])); fail("should have thrown"); } catch (NullPointerException e) { // expected outcome } try { assertNull(sortedMap.put(null, values[1])); fail("expected exception adding second null"); } catch (NullPointerException e) { // expected outcome } try { sortedMap.containsKey(null); fail("expected exception on containsKey(null)"); } catch (NullPointerException e) { // expected outcome } sortedMap.containsKey(keys[0]); try { sortedMap.get(null); fail("expected exception on get(null)"); } catch (NullPointerException e) { // expected outcome } sortedMap.get(keys[0]); try { sortedMap.remove(null); } catch (NullPointerException e) { // expected } sortedMap.remove(keys[0]); } else { // before JDK 7, nulls poisoned the map try { assertNull(sortedMap.put(null, values[0])); // note: first null added is not required to throw NPE since no // comparisons are needed } catch (NullPointerException e) { // expected outcome } try { assertNull(sortedMap.put(null, values[1])); fail("expected exception adding second null"); } catch (NullPointerException e) { // expected outcome } try { sortedMap.containsKey(null); fail("expected exception on containsKey(null)"); } catch (NullPointerException e) { // expected outcome } try { sortedMap.containsKey(keys[0]); fail("expected exception on contains(key)"); } catch (NullPointerException e) { // expected outcome } try { sortedMap.get(null); fail("expected exception on get(null)"); } catch (NullPointerException e) { // expected outcome } try { sortedMap.get(keys[0]); fail("expected exception on get(key)"); } catch (NullPointerException e) { // expected outcome } try { sortedMap.remove(null); fail("expected exception on remove(null)"); } catch (NullPointerException e) { // expected outcome } try { sortedMap.remove(keys[0]); fail("expected exception on remove(key)"); } catch (NullPointerException e) { // expected outcome } } }
From source file:net.sourceforge.msscodefactory.cfcore.v1_11.GenKbRam.GenKbRamContactURLTable.java
public void updateContactURL(GenKbAuthorization Authorization, GenKbContactURLBuff Buff) { GenKbContactURLPKey pkey = schema.getFactoryContactURL().newPKey(); pkey.setRequiredContactURLId(Buff.getRequiredContactURLId()); GenKbContactURLBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateContactURL", "Existing record not found", "ContactURL", pkey); }// w w w .j ava 2 s . co m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateContactURL", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); GenKbContactURLByContactIdxKey existingKeyContactIdx = schema.getFactoryContactURL().newContactIdxKey(); existingKeyContactIdx.setRequiredContactId(existing.getRequiredContactId()); GenKbContactURLByContactIdxKey newKeyContactIdx = schema.getFactoryContactURL().newContactIdxKey(); newKeyContactIdx.setRequiredContactId(Buff.getRequiredContactId()); GenKbContactURLByProtocolIdxKey existingKeyProtocolIdx = schema.getFactoryContactURL().newProtocolIdxKey(); existingKeyProtocolIdx.setOptionalURLProtocolId(existing.getOptionalURLProtocolId()); GenKbContactURLByProtocolIdxKey newKeyProtocolIdx = schema.getFactoryContactURL().newProtocolIdxKey(); newKeyProtocolIdx.setOptionalURLProtocolId(Buff.getOptionalURLProtocolId()); GenKbContactURLByUNameIdxKey existingKeyUNameIdx = schema.getFactoryContactURL().newUNameIdxKey(); existingKeyUNameIdx.setRequiredContactId(existing.getRequiredContactId()); existingKeyUNameIdx.setRequiredName(existing.getRequiredName()); GenKbContactURLByUNameIdxKey newKeyUNameIdx = schema.getFactoryContactURL().newUNameIdxKey(); newKeyUNameIdx.setRequiredContactId(Buff.getRequiredContactId()); newKeyUNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) { if (dictByUNameIdx.containsKey(newKeyUNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateContactURL", "ContactURLUNameIdx", newKeyUNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableContact().readDerivedByPIdx(Authorization, Buff.getRequiredContactId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateContactURL", "Container", "Contact", "Contact", null); } } } { boolean allNull = true; if (Buff.getOptionalURLProtocolId() != null) { allNull = false; } if (allNull) { if (null == schema.getTableURLProtocol().readDerivedByPIdx(Authorization, Buff.getOptionalURLProtocolId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateContactURL", "Lookup", "URLProtocol", "URLProtocol", null); } } } // Update is valid SortedMap<GenKbContactURLPKey, GenKbContactURLBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByContactIdx.get(existingKeyContactIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByContactIdx.containsKey(newKeyContactIdx)) { subdict = dictByContactIdx.get(newKeyContactIdx); } else { subdict = new TreeMap<GenKbContactURLPKey, GenKbContactURLBuff>(); dictByContactIdx.put(newKeyContactIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByProtocolIdx.get(existingKeyProtocolIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByProtocolIdx.containsKey(newKeyProtocolIdx)) { subdict = dictByProtocolIdx.get(newKeyProtocolIdx); } else { subdict = new TreeMap<GenKbContactURLPKey, GenKbContactURLBuff>(); dictByProtocolIdx.put(newKeyProtocolIdx, subdict); } subdict.put(pkey, Buff); dictByUNameIdx.remove(existingKeyUNameIdx); dictByUNameIdx.put(newKeyUNameIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfcore.v1_11.GenKbRam.GenKbRamContactURLTable.java
public void deleteContactURL(GenKbAuthorization Authorization, GenKbContactURLBuff Buff) { final String S_ProcName = "GenKbRamContactURLTable.deleteContactURL() "; GenKbContactURLPKey pkey = schema.getFactoryContactURL().newPKey(); pkey.setRequiredContactURLId(schema.nextContactURLIdGen()); GenKbContactURLBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteContactURL", "Existing record not found", "ContactURL", pkey); }/*from w ww . ja va 2 s.c om*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteContactURL", pkey); } GenKbContactURLByContactIdxKey keyContactIdx = schema.getFactoryContactURL().newContactIdxKey(); keyContactIdx.setRequiredContactId(existing.getRequiredContactId()); GenKbContactURLByProtocolIdxKey keyProtocolIdx = schema.getFactoryContactURL().newProtocolIdxKey(); keyProtocolIdx.setOptionalURLProtocolId(existing.getOptionalURLProtocolId()); GenKbContactURLByUNameIdxKey keyUNameIdx = schema.getFactoryContactURL().newUNameIdxKey(); keyUNameIdx.setRequiredContactId(existing.getRequiredContactId()); keyUNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys // Delete is valid SortedMap<GenKbContactURLPKey, GenKbContactURLBuff> subdict; dictByPKey.remove(pkey); subdict = dictByContactIdx.get(keyContactIdx); subdict.remove(pkey); subdict = dictByProtocolIdx.get(keyProtocolIdx); subdict.remove(pkey); dictByUNameIdx.remove(keyUNameIdx); }
From source file:net.sourceforge.msscodefactory.cfcore.v1_11.GenKbRam.GenKbRamGelInstructionTable.java
public void updateGelInstruction(GenKbAuthorization Authorization, GenKbGelInstructionBuff Buff) { GenKbGelInstructionPKey pkey = schema.getFactoryGelInstruction().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredCartridgeId(Buff.getRequiredCartridgeId()); pkey.setRequiredGelInstId(Buff.getRequiredGelInstId()); GenKbGelInstructionBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateGelInstruction", "Existing record not found", "GelInstruction", pkey); }//w w w . j a va 2s. com if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateGelInstruction", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); GenKbGelInstructionByCartridgeIdxKey existingKeyCartridgeIdx = schema.getFactoryGelInstruction() .newCartridgeIdxKey(); existingKeyCartridgeIdx.setRequiredCartridgeId(existing.getRequiredCartridgeId()); GenKbGelInstructionByCartridgeIdxKey newKeyCartridgeIdx = schema.getFactoryGelInstruction() .newCartridgeIdxKey(); newKeyCartridgeIdx.setRequiredCartridgeId(Buff.getRequiredCartridgeId()); GenKbGelInstructionByCallerIdxKey existingKeyCallerIdx = schema.getFactoryGelInstruction() .newCallerIdxKey(); existingKeyCallerIdx.setRequiredCartridgeId(existing.getRequiredCartridgeId()); existingKeyCallerIdx.setOptionalCallerId(existing.getOptionalCallerId()); GenKbGelInstructionByCallerIdxKey newKeyCallerIdx = schema.getFactoryGelInstruction().newCallerIdxKey(); newKeyCallerIdx.setRequiredCartridgeId(Buff.getRequiredCartridgeId()); newKeyCallerIdx.setOptionalCallerId(Buff.getOptionalCallerId()); GenKbGelInstructionByPrevIdxKey existingKeyPrevIdx = schema.getFactoryGelInstruction().newPrevIdxKey(); existingKeyPrevIdx.setRequiredCartridgeId(existing.getRequiredCartridgeId()); existingKeyPrevIdx.setOptionalPrevId(existing.getOptionalPrevId()); GenKbGelInstructionByPrevIdxKey newKeyPrevIdx = schema.getFactoryGelInstruction().newPrevIdxKey(); newKeyPrevIdx.setRequiredCartridgeId(Buff.getRequiredCartridgeId()); newKeyPrevIdx.setOptionalPrevId(Buff.getOptionalPrevId()); GenKbGelInstructionByNextIdxKey existingKeyNextIdx = schema.getFactoryGelInstruction().newNextIdxKey(); existingKeyNextIdx.setRequiredCartridgeId(existing.getRequiredCartridgeId()); existingKeyNextIdx.setOptionalNextId(existing.getOptionalNextId()); GenKbGelInstructionByNextIdxKey newKeyNextIdx = schema.getFactoryGelInstruction().newNextIdxKey(); newKeyNextIdx.setRequiredCartridgeId(Buff.getRequiredCartridgeId()); newKeyNextIdx.setOptionalNextId(Buff.getOptionalNextId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableRuleCart().readDerivedByIdIdx(Authorization, Buff.getRequiredCartridgeId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateGelInstruction", "Master", "Cartridge", "RuleCart", null); } } } // Update is valid SortedMap<GenKbGelInstructionPKey, GenKbGelInstructionBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByCartridgeIdx.get(existingKeyCartridgeIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByCartridgeIdx.containsKey(newKeyCartridgeIdx)) { subdict = dictByCartridgeIdx.get(newKeyCartridgeIdx); } else { subdict = new TreeMap<GenKbGelInstructionPKey, GenKbGelInstructionBuff>(); dictByCartridgeIdx.put(newKeyCartridgeIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByCallerIdx.get(existingKeyCallerIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByCallerIdx.containsKey(newKeyCallerIdx)) { subdict = dictByCallerIdx.get(newKeyCallerIdx); } else { subdict = new TreeMap<GenKbGelInstructionPKey, GenKbGelInstructionBuff>(); dictByCallerIdx.put(newKeyCallerIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByPrevIdx.get(existingKeyPrevIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByPrevIdx.containsKey(newKeyPrevIdx)) { subdict = dictByPrevIdx.get(newKeyPrevIdx); } else { subdict = new TreeMap<GenKbGelInstructionPKey, GenKbGelInstructionBuff>(); dictByPrevIdx.put(newKeyPrevIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByNextIdx.get(existingKeyNextIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByNextIdx.containsKey(newKeyNextIdx)) { subdict = dictByNextIdx.get(newKeyNextIdx); } else { subdict = new TreeMap<GenKbGelInstructionPKey, GenKbGelInstructionBuff>(); dictByNextIdx.put(newKeyNextIdx, subdict); } subdict.put(pkey, Buff); }