List of usage examples for java.util TreeMap put
public V put(K key, V value)
From source file:io.fabric8.maven.enricher.standard.DefaultServiceEnricherTest.java
private void setupExpectations(final boolean withPorts, String... configParams) { // Setup mock behaviour final TreeMap config = new TreeMap(); for (int i = 0; i < configParams.length; i += 2) { config.put(configParams[i], configParams[i + 1]); }/*from w ww . j a v a 2 s . c o m*/ new Expectations() { { context.getConfig(); result = new ProcessorConfig(null, null, Collections.singletonMap("fmp-service", config)); imageConfiguration.getBuildConfiguration(); result = getBuildConfig(withPorts); context.getImages(); result = Arrays.asList(imageConfiguration); } }; }
From source file:com.opengamma.analytics.financial.provider.sensitivity.inflation.MultipleCurrencyInflationSensitivity.java
/** * Create a new multiple currency sensitivity by multiplying all the sensitivities in a multiple currency sensitivity by a common factor. * @param factor The multiplicative factor. * @return The new multiple currency sensitivity. *///www. ja va 2 s.c o m public MultipleCurrencyInflationSensitivity multipliedBy(final double factor) { final TreeMap<Currency, InflationSensitivity> map = new TreeMap<>(); for (final Currency loopccy : _sensitivity.keySet()) { map.put(loopccy, _sensitivity.get(loopccy).multipliedBy(factor)); } return new MultipleCurrencyInflationSensitivity(map); }
From source file:com.tripit.auth.OAuthCredential.java
@SuppressWarnings("unchecked") private SortedMap<String, String> generateOAuthParameters(String url, SortedMap<String, String> params) throws UnsupportedEncodingException, InvalidKeyException, NoSuchAlgorithmException { TreeMap<String, String> oauthParameters = new TreeMap<String, String>(); oauthParameters.put("oauth_consumer_key", consumerKey); oauthParameters.put("oauth_nonce", generateNonce()); oauthParameters.put("oauth_timestamp", generateTimestamp()); oauthParameters.put("oauth_signature_method", OAUTH_SIGNATURE_METHOD); oauthParameters.put("oauth_version", OAUTH_VERSION); if (userKey != null) { oauthParameters.put("oauth_token", userKey); }// w w w . jav a 2 s .c om if (requestorId != null) { oauthParameters.put("xoauth_requestor_id", requestorId); } SortedMap<String, String> oauthParametersForBaseString = (SortedMap<String, String>) oauthParameters .clone(); if (params != null) { for (Map.Entry<String, String> param : params.entrySet()) { oauthParametersForBaseString.put(param.getKey(), param.getValue()); } } oauthParameters.put("oauth_signature", generateSignature(url, oauthParametersForBaseString)); return oauthParameters; }
From source file:com.opengamma.analytics.financial.provider.sensitivity.inflation.MultipleCurrencyInflationSensitivity.java
/** * Returns a new multiple currency sensitivity by creating clean sensitivity for each currency (see {@link InterestRateCurveSensitivity} clean() method). * @return The cleaned sensitivity./*from ww w . j a v a2 s .c o m*/ */ public MultipleCurrencyInflationSensitivity cleaned() { final TreeMap<Currency, InflationSensitivity> map = new TreeMap<>(); for (final Currency loopccy : _sensitivity.keySet()) { map.put(loopccy, _sensitivity.get(loopccy).cleaned()); } final MultipleCurrencyInflationSensitivity result = new MultipleCurrencyInflationSensitivity(map); return result; }
From source file:org.powertac.producer.ProducerServiceTest.java
@Test public void testConfigure() { List<String> inits = new ArrayList<String>(); inits.add("DefaultBroker"); TariffSubscription sub = mock(TariffSubscription.class); List<TariffSubscription> l = new ArrayList<TariffSubscription>(); l.add(sub);/*w w w . j av a 2 s. c om*/ Configurator conf = new Configurator(); TreeMap<String, String> map = new TreeMap<String, String>(); map.put("producer.producerService.producerFileFolder", "bla"); Configuration mapConfig = new MapConfiguration(map); conf.setConfiguration(mapConfig); conf.configureSingleton(producerService); assertTrue(producerService.getProducerFileFolder() != null); when(mockTariffSubscriptionRepo.findActiveSubscriptionsForCustomer(any(CustomerInfo.class))).thenReturn(l); }
From source file:ark.util.CounterTable.java
public TreeMap<Integer, List<T>> getSortedCounts() { TreeMap<Integer, List<T>> sortedCounts = new TreeMap<Integer, List<T>>(); for (Entry<T, Integer> entry : this.counts.entrySet()) { if (!sortedCounts.containsKey(entry.getValue())) sortedCounts.put(entry.getValue(), new ArrayList<T>()); sortedCounts.get(entry.getValue()).add(entry.getKey()); }// w w w . j av a 2s . co m return sortedCounts; }
From source file:com.opengamma.analytics.financial.forex.method.MultipleCurrencyInterestRateCurveSensitivity.java
/** * Create a new multiple currency sensitivity by multiplying all the sensitivities in a multiple currency sensitivity by a common factor. * @param factor The multiplicative factor. * @return The new multiple currency sensitivity. *///from ww w .jav a 2 s . co m public MultipleCurrencyInterestRateCurveSensitivity multipliedBy(final double factor) { final TreeMap<Currency, InterestRateCurveSensitivity> map = new TreeMap<>(); for (final Currency loopccy : _sensitivity.keySet()) { map.put(loopccy, _sensitivity.get(loopccy).multipliedBy(factor)); } return new MultipleCurrencyInterestRateCurveSensitivity(map); }
From source file:com.acc.storefront.interceptors.beforeview.DebugInfoBeforeViewHandler.java
@Override public void beforeView(final HttpServletRequest request, final HttpServletResponse response, final ModelAndView modelAndView) { final boolean showDebug = Config.getBoolean(SHOW_STOREFRONT_DEBUG_INFO_PROPERTY_KEY, false); // Store the show debug flag in a request attribute request.setAttribute(SHOW_STOREFRONT_DEBUG_INFO, Boolean.valueOf(showDebug)); if (showDebug) { final JaloSession currentSession = JaloSession.getCurrentSession(); final TreeMap<String, Object> attributeMap = new TreeMap<String, Object>(); // Build up the session attributes as a request attribute attributeMap.putAll(currentSession.getAttributes()); // Add the session id as an attribute attributeMap.put("JaloSession ID", currentSession.getSessionID()); request.setAttribute(JALO_SESSION_ATTRIBUTES, mapToString(attributeMap)); }/*from w w w .j ava 2 s . com*/ }
From source file:com.opengamma.analytics.financial.forex.method.MultipleCurrencyInterestRateCurveSensitivity.java
/** * Returns a new multiple currency sensitivity by creating clean sensitivity for each currency (see {@link InterestRateCurveSensitivity} clean() method). * @return The cleaned sensitivity.//from w ww .ja v a 2s . c o m */ public MultipleCurrencyInterestRateCurveSensitivity cleaned() { final TreeMap<Currency, InterestRateCurveSensitivity> map = new TreeMap<>(); for (final Currency loopccy : _sensitivity.keySet()) { map.put(loopccy, _sensitivity.get(loopccy).cleaned()); } final MultipleCurrencyInterestRateCurveSensitivity result = new MultipleCurrencyInterestRateCurveSensitivity( map); return result; }
From source file:com.opengamma.analytics.financial.interestrate.CashFlowEquivalentCalculator.java
/** * Add a cash flow amount at a given time in the flow map. If the time is present, the amount is added; if the time is not present a new entry is created. * @param flow The map describing the cash flows. * @param time The time of the flow to add. * @param amount The amount of the flow to add. *///from ww w .j a v a 2 s . c om private void addcf(TreeMap<Double, Double> flow, double time, double amount) { if (flow.containsKey(time)) { flow.put(time, flow.get(time) + amount); } else { flow.put(time, amount); } }