private static ImmutableSet <string> getEntries(File jarFile, string rootPath) { ImmutableSet.Builder <string> builder = ImmutableSet.builder(); try { using (JarFile jar = new JarFile(jarFile)) { IEnumerator <JarEntry> jarEntries = jar.entries(); while (jarEntries.MoveNext()) { JarEntry entry = jarEntries.Current; string entryName = entry.Name; if (entryName.StartsWith(rootPath, StringComparison.Ordinal) && !entryName.Equals(rootPath)) { string relativeEntryPath = entryName.Substring(rootPath.Length + 1); if (relativeEntryPath.Trim().Length > 0) { builder.add(relativeEntryPath); } } } } } catch (Exception e) { throw new System.ArgumentException(Messages.format("Error scanning entries in JAR file: {}", jarFile), e); } return(builder.build()); }
// collect the set of indices, validating they are IborIndex private static ImmutableSet <IborIndex> buildIndices(RateComputation floatingRate) { ImmutableSet.Builder <Index> builder = ImmutableSet.builder(); floatingRate.collectIndices(builder); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: return(builder.build().Select(index => typeof(IborIndex).cast(index)).collect(toImmutableSet())); }
// collect the set of indices private static ImmutableSet <Index> buildIndices(ResolvedIborCapFloorLeg capFloorLeg, ResolvedSwapLeg payLeg) { ImmutableSet.Builder <Index> builder = ImmutableSet.builder(); builder.add(capFloorLeg.Index); if (payLeg != null) { payLeg.collectIndices(builder); } return(builder.build()); }
// collect the set of currencies private static ImmutableSet <Currency> buildCurrencies(IList <ResolvedSwapLeg> legs) { // avoid streams as profiling showed a hotspot ImmutableSet.Builder <Currency> builder = ImmutableSet.builder(); foreach (ResolvedSwapLeg leg in legs) { builder.add(leg.Currency); } return(builder.build()); }
// collect the set of currencies private static ImmutableSet <Currency> buildCurrencies(ResolvedIborCapFloorLeg capFloorLeg, ResolvedSwapLeg payLeg) { ImmutableSet.Builder <Currency> builder = ImmutableSet.builder(); builder.add(capFloorLeg.Currency); if (payLeg != null) { builder.add(payLeg.Currency); } return(builder.build()); }
/// <summary> /// Returns the set of indices referred to by the cap/floor. /// <para> /// A cap/floor will typically refer to one index, such as 'GBP-LIBOR-3M'. /// Calling this method will return the complete list of indices. /// /// </para> /// </summary> /// <returns> the set of indices referred to by this cap/floor </returns> public ImmutableSet <Index> allIndices() { ImmutableSet.Builder <Index> builder = ImmutableSet.builder(); builder.add(capFloorLeg.Calculation.Index); if (payLeg != null) { payLeg.collectIndices(builder); } return(builder.build()); }
// collect the set of indices private static ImmutableSet <Index> buildIndices(IList <ResolvedSwapLeg> legs) { // avoid streams as profiling showed a hotspot ImmutableSet.Builder <Index> builder = ImmutableSet.builder(); foreach (ResolvedSwapLeg leg in legs) { leg.collectIndices(builder); } return(builder.build()); }
public void collectCurrencies(ImmutableSet.Builder <Currency> builder) { if (this == MOCK_USD1) { builder.add(GBP, EUR, USD); } else { builder.add(GBP); } }
/// <summary> /// Returns the set of rate indices referred to by the CMS. /// <para> /// The CMS leg will refer to one index, such as 'GBP-LIBOR-3M'. /// The pay leg may refer to a different index. /// The swap index will not be included. /// /// </para> /// </summary> /// <returns> the set of indices referred to by this CMS </returns> public ImmutableSet <Index> allRateIndices() { IborIndex cmsIndex = cmsLeg.UnderlyingIndex; if (payLeg == null) { return(ImmutableSet.of(cmsIndex)); } ImmutableSet.Builder <Index> builder = ImmutableSet.builder(); payLeg.collectIndices(builder); builder.add(cmsIndex); return(builder.build()); }
public ImmutableSet <Currency> allCurrencies() { if (payLeg == null) { return(ImmutableSet.of(cmsLeg.Currency)); } else { ImmutableSet.Builder <Currency> builder = ImmutableSet.builder(); builder.add(cmsLeg.Currency); builder.addAll(payLeg.allCurrencies()); return(builder.build()); } }
//------------------------------------------------------------------------- public ResolvedSwap resolve(ReferenceData refData) { // avoid streams as profiling showed a hotspot // most efficient to loop around legs once ImmutableList.Builder <ResolvedSwapLeg> resolvedLegs = ImmutableList.builder(); ImmutableSet.Builder <Currency> currencies = ImmutableSet.builder(); ImmutableSet.Builder <Index> indices = ImmutableSet.builder(); foreach (SwapLeg leg in legs) { ResolvedSwapLeg resolvedLeg = leg.resolve(refData); resolvedLegs.add(resolvedLeg); currencies.add(resolvedLeg.Currency); leg.collectIndices(indices); } return(new ResolvedSwap(resolvedLegs.build(), currencies.build(), indices.build())); }
// to create edits and get edits filename private static ImmutableSet <FSEditLogOpCodes> SkippedOps() { ImmutableSet.Builder <FSEditLogOpCodes> b = ImmutableSet.Builder(); // Deprecated opcodes ((ImmutableSet.Builder <FSEditLogOpCodes>)((ImmutableSet.Builder <FSEditLogOpCodes> )((ImmutableSet.Builder <FSEditLogOpCodes>)((ImmutableSet.Builder <FSEditLogOpCodes >)b.Add(FSEditLogOpCodes.OpDatanodeAdd)).Add(FSEditLogOpCodes.OpDatanodeRemove)) .Add(FSEditLogOpCodes.OpSetNsQuota)).Add(FSEditLogOpCodes.OpClearNsQuota)).Add(FSEditLogOpCodes .OpSetGenstampV1); // Cannot test delegation token related code in insecure set up ((ImmutableSet.Builder <FSEditLogOpCodes>)((ImmutableSet.Builder <FSEditLogOpCodes> )b.Add(FSEditLogOpCodes.OpGetDelegationToken)).Add(FSEditLogOpCodes.OpRenewDelegationToken )).Add(FSEditLogOpCodes.OpCancelDelegationToken); // Skip invalid opcode b.Add(FSEditLogOpCodes.OpInvalid); return((ImmutableSet <FSEditLogOpCodes>)b.Build()); }
//------------------------------------------------------------------------- /// <summary> /// Merges multiple sets of requirements into a single set. /// </summary> /// <param name="requirements"> market data requirements </param> /// <returns> a single set of requirements containing all the requirements from the input sets </returns> public static MarketDataRequirements combine(IList <MarketDataRequirements> requirements) { ImmutableSet.Builder <ObservableId> observablesBuilder = ImmutableSet.builder(); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: com.google.common.collect.ImmutableSet.Builder<com.opengamma.strata.data.MarketDataId<?>> nonObservablesBuilder = com.google.common.collect.ImmutableSet.builder(); ImmutableSet.Builder <MarketDataId <object> > nonObservablesBuilder = ImmutableSet.builder(); ImmutableSet.Builder <ObservableId> timeSeriesBuilder = ImmutableSet.builder(); ImmutableSet.Builder <Currency> outputCurrenciesBuilder = ImmutableSet.builder(); foreach (MarketDataRequirements req in requirements) { observablesBuilder.addAll(req.observables); nonObservablesBuilder.addAll(req.nonObservables); timeSeriesBuilder.addAll(req.timeSeries); outputCurrenciesBuilder.addAll(req.outputCurrencies); } return(new MarketDataRequirements(observablesBuilder.build(), nonObservablesBuilder.build(), timeSeriesBuilder.build(), outputCurrenciesBuilder.build())); }
//------------------------------------------------------------------------- public void collectIndices(ImmutableSet.Builder <Index> builder) { builder.add(shortObservation.Index); builder.add(longObservation.Index); }
public void collectCurrencies(ImmutableSet.Builder <Currency> builder) { builder.add(index.Currency); }
//------------------------------------------------------------------------- /// <summary> /// Returns the set of indices referred to by the swap. /// <para> /// A swap will typically refer to at least one index, such as 'GBP-LIBOR-3M'. /// Calling this method will return the complete list of indices, including /// any associated with FX reset. /// /// </para> /// </summary> /// <returns> the set of indices referred to by this swap </returns> public ImmutableSet <Index> allIndices() { ImmutableSet.Builder <Index> builder = ImmutableSet.builder(); legs.ForEach(leg => leg.collectIndices(builder)); return(builder.build()); }
/// <summary> /// Returns the set of currencies referred to by the swap. /// <para> /// This returns the complete set of currencies for the swap, not just the payment currencies. /// /// </para> /// </summary> /// <returns> the set of currencies referred to by this swap </returns> public ImmutableSet <Currency> allCurrencies() { ImmutableSet.Builder <Currency> builder = ImmutableSet.builder(); legs.ForEach(leg => leg.collectCurrencies(builder)); return(builder.build()); }
public void collectIndices(ImmutableSet.Builder <Index> builder) { calculation.collectIndices(builder); notionalSchedule.FxReset.ifPresent(fxReset => builder.add(fxReset.Index)); }
public void collectIndices(ImmutableSet.Builder <Index> builder) { builder.add(IborIndices.GBP_LIBOR_3M, FxIndices.EUR_GBP_ECB, OvernightIndices.EUR_EONIA); }
//------------------------------------------------------------------------- public void collectIndices(ImmutableSet.Builder <Index> builder) { builder.add(Index); }
//------------------------------------------------------------------------- public void collectIndices(ImmutableSet.Builder <Index> builder) { rateComputation.collectIndices(builder); }
// collect the indices internal void collectIndices(ImmutableSet.Builder <Index> builder) { Index.ifPresent(idx => builder.add(idx)); IndexInterpolated.ifPresent(idx => builder.add(idx)); }
// collect the currencies internal void collectCurrencies(ImmutableSet.Builder <Currency> builder) { KnownAmount.ifPresent(amt => builder.add(amt.Currency)); Index.ifPresent(idx => builder.add(idx.Currency)); IndexInterpolated.ifPresent(idx => builder.add(idx.Currency)); }
public void collectIndices(ImmutableSet.Builder <Index> builder) { FxResetObservation.ifPresent(fxReset => builder.add(fxReset.Index)); }
public void collectIndices(ImmutableSet.Builder <Index> builder) { // no indices }
public void collectCurrencies(ImmutableSet.Builder <Currency> builder) { // no currencies }
public void collectIndices(ImmutableSet.Builder <Index> builder) { accrualPeriods.ForEach(accrual => accrual.RateComputation.collectIndices(builder)); FxReset.ifPresent(fxReset => builder.add(fxReset.Index)); }
public void collectCurrencies(ImmutableSet.Builder <Currency> builder) { builder.add(Currency); calculation.collectCurrencies(builder); notionalSchedule.FxReset.ifPresent(fxReset => builder.add(fxReset.ReferenceCurrency)); }