Package com.opengamma.engine.function

Examples of com.opengamma.engine.function.CompiledFunctionDefinition


      return null;
    }
    s_logger.debug("Got spot rate {} for {}", spotRate, spotRateIdentifier);
    final FunctionExecutionContext execContext = createFunctionExecutionContext(spotRate.getFirst());
    final FunctionCompilationContext compContext = createFunctionCompilationContext();
    final CompiledFunctionDefinition payYieldCurveSpecificationFunction = createFunction(compContext, execContext, new YieldCurveSpecificationFunction(payCurrency, getCurrencyCurveName()));
    final CompiledFunctionDefinition payYieldCurveMarketDataFunction = createFunction(compContext, execContext, new YieldCurveMarketDataFunction(payCurrency, getCurrencyCurveName()));
    final CompiledFunctionDefinition receiveYieldCurveSpecificationFunction = createFunction(compContext, execContext, new YieldCurveSpecificationFunction(receiveCurrency, getCurrencyCurveName()));
    final CompiledFunctionDefinition receiveYieldCurveMarketDataFunction = createFunction(compContext, execContext, new YieldCurveMarketDataFunction(receiveCurrency, getCurrencyCurveName()));
    final CompiledFunctionDefinition yieldCurveFunction = createFunction(compContext, execContext, new MultiYieldCurvePresentValueMethodFunction());
    final CompiledFunctionDefinition fxForwardCurveFromYieldCurveFunction = createFunction(compContext, execContext, new FXForwardCurveFromYieldCurvesFunction());
    ComputationTarget target;
    // PAY
    target = new ComputationTarget(ComputationTargetType.CURRENCY, payCurrency);
    // PAY - YieldCurveMarketDataFunction
    final ComputedValue[] payCurveDataRequirements = findMarketData(compContext, payYieldCurveMarketDataFunction.getRequirements(compContext, target, null));
View Full Code Here


    getUnderlyingDefinition().init(context);
  }

  @Override
  public CompiledFunctionDefinition compile(final FunctionCompilationContext context, final Instant atInstant) {
    final CompiledFunctionDefinition underlying = getUnderlyingDefinition().compile(context, atInstant);
    if (underlying == getUnderlyingCompiled()) {
      s_logger.debug("Compiling underlying on {} gives self", this);
      return this;
    } else {
      s_logger.debug("Creating delegate for compiled underlying on {}", this);
View Full Code Here

      if (!visitedRequirements.add(requirement)) {
        // This shouldn't happen
        throw new IllegalStateException();
      }
      for (final Map.Entry<CompiledFunctionDefinition, Set<ValueSpecification>> functionResult : functionResults.entrySet()) {
        final CompiledFunctionDefinition function = functionResult.getKey();
        for (final ValueSpecification result : functionResult.getValue()) {
          if (isSatisfied(requirement, result)) {
            final FunctionExclusionGroup group = (_functionExclusionGroups == null) ? null : _functionExclusionGroups.getExclusionGroup(function.getFunctionDefinition());
            if ((group == null) || visitedFunctions.add(group)) {
              s_logger.debug("Resolving {} to satisfy {}", result, requirement);
              final Set<ValueSpecification> resolved = resultWithSatisfiedRequirements(visitedRequirements, visitedFunctions, function, target, requirement, result.compose(requirement));
              if (resolved != null) {
                if (allResults == null) {
View Full Code Here

        do {
          final ValueProperties properties = _resolutions.getValueProperties();
          if (constraints.isSatisfiedBy(properties)) {
            s_logger.info("Trying digest resolution {} for {}", properties, requirement);
            final ParameterizedFunction function = _resolutions.getFunction();
            final CompiledFunctionDefinition functionDef = function.getFunction();
            if (!functionDef.getTargetType().isCompatible(target.getType())) {
              s_logger.debug("Function {} type is not compatible with {}", functionDef, target);
              continue;
            }
            final ComputationTarget adjustedTarget = ResolutionRule.adjustTarget(functionDef.getTargetType(), target);
            if (!functionDef.canApplyTo(context.getCompilationContext(), adjustedTarget)) {
              s_logger.debug("Function {} cannot be applied to {}", functionDef, target);
              continue;
            }
            Collection<ValueSpecification> results = functionDef.getResults(context.getCompilationContext(), adjustedTarget);
            if ((results == null) || results.isEmpty()) {
              s_logger.debug("Function {} applied to {} produced no results", functionDef, target);
              continue;
            }
            final ValueProperties composedConstraints;
View Full Code Here

    final ResolvedValueProducer producer = context.declareTaskProducing(getResolvedOutput(), getTask(), worker);
    if (producer == worker) {
      producer.release(context);
      // Populate the worker and position this task in the chain for pumping alternative resolutions to dependents
      s_logger.debug("Registered worker {} for {} production", worker, getResolvedOutput());
      final CompiledFunctionDefinition functionDefinition = getFunction().getFunction();
      final ComputationTarget target = getComputationTarget(context);
      Set<ValueRequirement> inputRequirements = null;
      try {
        //DebugUtils.getRequirements_enter();
        inputRequirements = functionDefinition.getRequirements(context.getCompilationContext(), target, getIterationBase().getDesiredValue());
        //DebugUtils.getRequirements_leave();
      } catch (Throwable t) {
        //DebugUtils.getRequirements_leave();
        s_logger.warn("Exception thrown by getRequirements", t);
        context.exception(t);
View Full Code Here

    Set<ValueSpecification> outputValues = deserializer.fieldValueToObject(Set.class, msg.getByName(OUTPUT_VALUES_FIELD));
    Set<ValueSpecification> terminalOutputValues = deserializer.fieldValueToObject(Set.class, msg.getByName(TERMINAL_OUTPUT_VALUES_FIELD));
   
    DependencyNode node = new DependencyNode(target);
   
    CompiledFunctionDefinition function = new CompiledFunctionDefinitionStub(target.getType(), functionUniqueId, functionShortName);
    ParameterizedFunction parameterizedFunction = new ParameterizedFunction(function, functionParameters);
    parameterizedFunction.setUniqueId(parameterizedFunctionUniqueId);
    node.setFunction(parameterizedFunction);
   
    for (ValueSpecification inputValue : inputValues) {
View Full Code Here

  // DependencyNodeFilter

  @Override
  public boolean accept(final DependencyNode node) {
    final CompiledFunctionDefinition cfd = node.getFunction().getFunction();
    Instant t = cfd.getEarliestInvocationTime();
    if (t != null) {
      if (_valuationTime.isBefore(t)) {
        return false;
      }
    }
    t = cfd.getLatestInvocationTime();
    if (t != null) {
      if (_valuationTime.isAfter(t)) {
        return false;
      }
    }
View Full Code Here

   */
  public List<ValueSpecification> getPartialResults(final ComputationTarget target) {
    final Map<ComputationTargetType, ComputationTarget> adjustedTargetCache = new HashMap<ComputationTargetType, ComputationTarget>();
    final Set<ValueSpecification> result = new LinkedHashSet<ValueSpecification>();
    for (final ResolutionRule rule : getRules()) {
      final CompiledFunctionDefinition function = rule.getParameterizedFunction().getFunction();
      if (!function.getTargetType().isCompatible(target.getType())) {
        continue;
      }
      final ComputationTarget adjustedTarget = rule.adjustTarget(adjustedTargetCache, target);
      final Set<ValueSpecification> results;
      try {
View Full Code Here

      visited.remove(requirement);
      return null;
    }
    s_logger.debug("Partially resolving {}", requirement);
    for (final ResolutionRule rule : getRules()) {
      final CompiledFunctionDefinition function = rule.getParameterizedFunction().getFunction();
      if (!function.getTargetType().isCompatible(target.getType())) {
        continue;
      }
      final ComputationTarget adjustedTarget = rule.adjustTarget(adjustedTargetCache, target);
      final ValueSpecification result;
      try {
View Full Code Here

   * @param target the computation target
   * @param context Function compilation context
   * @return the set of all value specifications produced by the function, null if none can be produced
   */
  public Set<ValueSpecification> getResults(final ComputationTarget target, final FunctionCompilationContext context) {
    final CompiledFunctionDefinition function = _parameterizedFunction.getFunction();
    // check the function can apply to the target
    //DebugUtils.canApplyTo_enter();
    if (!function.canApplyTo(context, target)) {
      //DebugUtils.canApplyTo_leave();
      return null;
    }
    //DebugUtils.canApplyTo_leave();
    // return the maximal set of results the function can produce for the target
    //DebugUtils.getResults1_enter();
    final Set<ValueSpecification> results = function.getResults(context, target);
    //DebugUtils.getResults1_leave();
    assert isValidResultsOnTarget(target, results) : "Results " + results + " not valid for target " + target;
    return results;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.function.CompiledFunctionDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.