Package com.opengamma.engine.function

Examples of com.opengamma.engine.function.ParameterizedFunction


    final DependencyNode node = new DependencyNode(target);
    final ValueSpecification output;
    if (inputNodes.isEmpty()) {
      final MarketDataSourcingFunction msdf = MarketDataSourcingFunction.INSTANCE;
      output = new ValueSpecification(name, target.toSpecification(), ValueProperties.with(ValuePropertyNames.FUNCTION, msdf.getUniqueId()).get());
      node.setFunction(new ParameterizedFunction(msdf, msdf.getDefaultParameters()));
    } else {
      final MockFunction mock = new MockFunction(target);
      output = new ValueSpecification(name, target.toSpecification(), ValueProperties.with(ValuePropertyNames.FUNCTION, mock.getUniqueId()).get());
      node.setFunction(mock);
      mock.addResult(new ComputedValue(output, null));
View Full Code Here


  }

  private ParameterizedFunction parameterizedFunction() {
    final ComputationTarget target = new ComputationTarget(ComputationTargetType.NULL, null);
    final MockFunction function = new MockFunction(target);
    return new ParameterizedFunction(function, function.getDefaultParameters());
  }
View Full Code Here

  public void testFunctionApplication() {
    final ValueRequirement req1 = valueRequirement();
    final ValueRequirement req2 = valueRequirement();
    final ValueRequirement req3 = valueRequirement();
    final ParameterizedFunction function = parameterizedFunction();
    final ValueSpecification spec1 = valueSpecification(req1);
    final ValueSpecification spec2 = valueSpecification(req2);
    assertEncodeDecodeCycle(ResolutionFailure.class, ResolutionFailureImpl.functionApplication(req1, function, spec1).getRequirementsFailed());
    assertEncodeDecodeCycle(ResolutionFailure.class, ResolutionFailureImpl.functionApplication(req1, function, spec1).requirement(req2, ResolutionFailureImpl.recursiveRequirement(req2)));
    assertEncodeDecodeCycle(ResolutionFailure.class, ResolutionFailureImpl.functionApplication(req1, function, spec1).requirements(Collections.singletonMap(spec2, req2)));
View Full Code Here

  }

  private ParameterizedFunction parameterizedFunction() {
    final ComputationTarget target = new ComputationTarget(ComputationTargetType.NULL, null);
    final MockFunction function = new MockFunction(target);
    return new ParameterizedFunction(function, function.getDefaultParameters());
  }
View Full Code Here

  public void testFunctionApplication() {
    final ValueRequirement req1 = valueRequirement();
    final ValueRequirement req2 = valueRequirement();
    final ValueRequirement req3 = valueRequirement();
    final ParameterizedFunction function = parameterizedFunction();
    final ValueSpecification spec1 = valueSpecification(req1);
    final ValueSpecification spec2 = valueSpecification(req2);
    assertEquals(ResolutionFailureImpl.functionApplication(req1, function, spec1).getRequirementsFailed(), "getRequirementsFailed=" + req1 + ",mock," + spec1);
    assertEquals(ResolutionFailureImpl.functionApplication(req1, function, spec1).requirement(req2, null), "failedFunction=" + req1 + ",mock," + spec1 + ",{},[unsatisfied=" + req2 + "]");
    assertEquals(ResolutionFailureImpl.functionApplication(req1, function, spec1).requirement(req2, ResolutionFailureImpl.recursiveRequirement(req2)), "failedFunction=" + req1 + ",mock," + spec1 +
View Full Code Here

  private static final ParameterizedFunction MARKET_DATA_SOURCING_FUNCTION = createParameterizedFunction(MarketDataSourcingFunction.INSTANCE);
  private static final ParameterizedFunction RELABELLING_FUNCTION = createParameterizedFunction(MarketDataAliasingFunction.INSTANCE);

  private static ParameterizedFunction createParameterizedFunction(final CompiledFunctionDefinition function) {
    return new ParameterizedFunction(function, function.getFunctionDefinition().getDefaultParameters());
  }
View Full Code Here

  private void scheduleCollapsers() {
    if (!_collapsers.isEmpty()) {
      final Iterator<ParameterizedFunction> itrCollapsers = _collapsers.iterator();
      do {
        final ParameterizedFunction function = itrCollapsers.next();
        final PerFunctionNodeInfo nodeInfo = _func2nodeInfo.get(function);
        scheduleCollapsers(function, nodeInfo);
      } while (itrCollapsers.hasNext());
    }
  }
View Full Code Here

        final ValueProperties constraints = requirement.getConstraints();
        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);
View Full Code Here

  private final Set<ValueSpecification> _inputs2;
  private final Set<ValueSpecification> _outputs1;
  private final Set<ValueSpecification> _outputs2;

  public DefaultFunctionBlacklistQueryTest() {
    _function1 = new ParameterizedFunction(new MockFunction("F1", null), new EmptyFunctionParameters());
    _function2 = new ParameterizedFunction(new MockFunction("F2", null), new EmptyFunctionParameters());
    _function3 = new ParameterizedFunction(new MockFunction("F1", null), new SimpleFunctionParameters());
    _function4 = new ParameterizedFunction(new MockFunction("F2", null), new SimpleFunctionParameters());
    _target1 = ComputationTargetSpecification.of(UniqueId.of("Test", "Foo"));
    _target2 = ComputationTargetSpecification.of(UniqueId.of("Test", "Bar"));
    _inputs1 = Collections.singleton(new ValueSpecification("Foo", _target1, ValueProperties.with(ValuePropertyNames.FUNCTION, "X").get()));
    _inputs2 = Collections.singleton(new ValueSpecification("Bar", _target1, ValueProperties.with(ValuePropertyNames.FUNCTION, "X").get()));
    _outputs1 = Collections.singleton(new ValueSpecification("Foo", _target2, ValueProperties.with(ValuePropertyNames.FUNCTION, "Y").get()));
View Full Code Here

  private final ComputationTargetSpecification _target;
  private final Set<ValueSpecification> _inputs;
  private final Set<ValueSpecification> _outputs;

  public DefaultManageableFunctionBlacklistExpiryTest() {
    _function = new ParameterizedFunction(new MockFunction("F1", null), new EmptyFunctionParameters());
    _target = ComputationTargetSpecification.of(UniqueId.of("Test", "Foo"));
    _inputs = Collections.singleton(new ValueSpecification("Foo", _target, ValueProperties.with(ValuePropertyNames.FUNCTION, "X").get()));
    _outputs = Collections.singleton(new ValueSpecification("Bar", _target, ValueProperties.with(ValuePropertyNames.FUNCTION, "Y").get()));
  }
View Full Code Here

TOP

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

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.