当前位置: 首页>>代码示例>>Java>>正文


Java DoubleArrayList.get方法代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.doubles.DoubleArrayList.get方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleArrayList.get方法的具体用法?Java DoubleArrayList.get怎么用?Java DoubleArrayList.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在it.unimi.dsi.fastutil.doubles.DoubleArrayList的用法示例。


在下文中一共展示了DoubleArrayList.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGenerator

import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
@Override
protected GeneratorYDCurve getGenerator(final CurveDefinition definition, final LocalDate valuationDate) {
  if (definition instanceof InterpolatedCurveDefinition) {
    final InterpolatedCurveDefinition interpolatedDefinition = (InterpolatedCurveDefinition) definition;
    final String interpolatorName = interpolatedDefinition.getInterpolatorName();
    final String leftExtrapolatorName = interpolatedDefinition.getLeftExtrapolatorName();
    final String rightExtrapolatorName = interpolatedDefinition.getRightExtrapolatorName();
    final Interpolator1D interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(interpolatorName, leftExtrapolatorName, rightExtrapolatorName);
    if (definition instanceof FixedDateInterpolatedCurveDefinition) {
      final FixedDateInterpolatedCurveDefinition fixedDateDefinition = (FixedDateInterpolatedCurveDefinition) definition;
      final List<LocalDate> fixedDates = fixedDateDefinition.getFixedDates();
      final DoubleArrayList nodePoints = new DoubleArrayList(fixedDates.size()); //TODO what about equal node points?
      for (final LocalDate fixedDate : fixedDates) {
        nodePoints.add(TimeCalculator.getTimeBetween(valuationDate, fixedDate)); //TODO what to do if the fixed date is before the valuation date?
      }
      final double anchor = nodePoints.get(0); //TODO should the anchor go into the definition?
      return new GeneratorCurveYieldInterpolatedAnchorNode(nodePoints.toDoubleArray(), anchor, interpolator);
    }
    return new GeneratorCurveYieldInterpolated(getMaturityCalculator(), interpolator);
  }
  throw new OpenGammaRuntimeException("Cannot handle curves of type " + definition.getClass());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:23,代码来源:MultiCurveDiscountingFunction.java

示例2: getGenerator

import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
private GeneratorYDCurve getGenerator(final AbstractCurveDefinition definition, LocalDate valuationDate) {

    if (definition instanceof InterpolatedCurveDefinition) {
      final InterpolatedCurveDefinition interpolatedDefinition = (InterpolatedCurveDefinition) definition;
      final String interpolatorName = interpolatedDefinition.getInterpolatorName();
      final String leftExtrapolatorName = interpolatedDefinition.getLeftExtrapolatorName();
      final String rightExtrapolatorName = interpolatedDefinition.getRightExtrapolatorName();
      final Interpolator1D interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(interpolatorName,
                                                                                                  leftExtrapolatorName,
                                                                                                  rightExtrapolatorName);
      if (definition instanceof FixedDateInterpolatedCurveDefinition) {
        final FixedDateInterpolatedCurveDefinition fixedDateDefinition = (FixedDateInterpolatedCurveDefinition) definition;
        final List<LocalDate> fixedDates = fixedDateDefinition.getFixedDates();
        final DoubleArrayList nodePoints = new DoubleArrayList(fixedDates.size()); //TODO what about equal node points?
        for (final LocalDate fixedDate : fixedDates) {
          nodePoints.add(TimeCalculator.getTimeBetween(valuationDate, fixedDate)); //TODO what to do if the fixed date is before the valuation date?
        }
        final double anchor = nodePoints.get(0); //TODO should the anchor go into the definition?
        return new GeneratorCurveYieldInterpolatedAnchorNode(nodePoints.toDoubleArray(), anchor, interpolator);
      }
      return new GeneratorCurveYieldInterpolated(LastTimeCalculator.getInstance(), interpolator);
    }

    throw new OpenGammaRuntimeException("Cannot handle curves of type " + definition.getClass());
  }
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:26,代码来源:DefaultDiscountingMulticurveBundleFn.java

示例3: getGenerator

import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
private GeneratorYDCurve getGenerator(final AbstractCurveDefinition definition, LocalDate valuationDate) {

    if (definition instanceof InterpolatedCurveDefinition) {
      InterpolatedCurveDefinition interpolatedDefinition = (InterpolatedCurveDefinition) definition;
      String interpolatorName = interpolatedDefinition.getInterpolatorName();
      String leftExtrapolatorName = interpolatedDefinition.getLeftExtrapolatorName();
      String rightExtrapolatorName = interpolatedDefinition.getRightExtrapolatorName();
      Interpolator1D interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(interpolatorName,
                                                                                                  leftExtrapolatorName,
                                                                                                  rightExtrapolatorName);
      if (definition instanceof FixedDateInterpolatedCurveDefinition) {
        FixedDateInterpolatedCurveDefinition fixedDateDefinition = (FixedDateInterpolatedCurveDefinition) definition;
        List<LocalDate> fixedDates = fixedDateDefinition.getFixedDates();
        DoubleArrayList nodePoints = new DoubleArrayList(fixedDates.size()); //TODO what about equal node points?
        for (final LocalDate fixedDate : fixedDates) {
          //TODO what to do if the fixed date is before the valuation date?
          nodePoints.add(TimeCalculator.getTimeBetween(valuationDate, fixedDate));
        }
        final double anchor = nodePoints.get(0); //TODO should the anchor go into the definition?
        return new GeneratorCurveYieldInterpolatedAnchorNode(nodePoints.toDoubleArray(), anchor, interpolator);
      }
      return new GeneratorCurveYieldInterpolated(LastTimeCalculator.getInstance(), interpolator);
    }

    throw new OpenGammaRuntimeException("Cannot handle curves of type " + definition.getClass());
  }
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:27,代码来源:CurveBundleProviderFn.java

示例4: createCurveGenerator

import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
/**
 * Creates a curve generator for a curve definition and valuation date.
 *
 * @param definition the curve definition
 * @param valuationDate the valuation date
 * @return a generator capable of generating the curve
 */
private GeneratorYDCurve createCurveGenerator(AbstractCurveDefinition definition, LocalDate valuationDate) {
  if (definition instanceof InterpolatedCurveDefinition) {
    InterpolatedCurveDefinition interpolatedDefinition = (InterpolatedCurveDefinition) definition;
    Interpolator1D interpolator =
        CombinedInterpolatorExtrapolatorFactory.getInterpolator(interpolatedDefinition.getInterpolatorName(),
                                                                interpolatedDefinition.getLeftExtrapolatorName(),
                                                                interpolatedDefinition.getRightExtrapolatorName());
    if (definition instanceof FixedDateInterpolatedCurveDefinition) {
      FixedDateInterpolatedCurveDefinition fixedDateDefinition = (FixedDateInterpolatedCurveDefinition) definition;
      List<LocalDate> fixedDates = fixedDateDefinition.getFixedDates();
      DoubleArrayList nodePoints = new DoubleArrayList(fixedDates.size()); //TODO what about equal node points?

      for (LocalDate fixedDate : fixedDates) {
        nodePoints.add(TimeCalculator.getTimeBetween(valuationDate, fixedDate)); //TODO what to do if the fixed date is before the valuation date?
      }
      double anchor = nodePoints.get(0); //TODO should the anchor go into the definition?
      return new GeneratorCurveYieldInterpolatedAnchorNode(nodePoints.toDoubleArray(), anchor, interpolator);
    }
    return new GeneratorCurveYieldInterpolated(LastTimeCalculator.getInstance(), interpolator);
  }
  throw new OpenGammaRuntimeException("Cannot handle curves of type " + definition.getClass());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:30,代码来源:AbstractMulticurveMarketDataBuilder.java

示例5: getValueOnQuantile

import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
/**
 * List will be sorted after passing to this function,
 * so a pre-sorting is not needed.
 *
 * @param list
 * @param quantile
 * @return
 */
public static double getValueOnQuantile(DoubleArrayList list, double quantile) {
    checkArgument(quantile >= 0 && quantile <= 1, "quantile must be in range [0, 1]");

    Collections.sort(list, new Comparator<Double>() {
        @Override
        public int compare(Double o1, Double o2) {
            return o1.compareTo(o2);
        }
    });

    int index = (int) (list.size()*quantile);
    return list.get(index);
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:22,代码来源:PercentileUtil.java

示例6: extractFinalResult

import it.unimi.dsi.fastutil.doubles.DoubleArrayList; //导入方法依赖的package包/类
@Nonnull
@Override
public Double extractFinalResult(@Nonnull DoubleArrayList intermediateResult) {
  int size = intermediateResult.size();
  if (size == 0) {
    return DEFAULT_FINAL_RESULT;
  } else {
    Collections.sort(intermediateResult);
    return intermediateResult.get((int) ((long) intermediateResult.size() * _percentile / 100));
  }
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:12,代码来源:PercentileAggregationFunction.java


注:本文中的it.unimi.dsi.fastutil.doubles.DoubleArrayList.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。