Package com.opengamma.engine.function

Examples of com.opengamma.engine.function.ParameterizedFunction


   * Uses default parameters to invoke the function. Useful in tests.
   *
   * @param function Function to be invoked
   */
  public void setFunction(final CompiledFunctionDefinition function) {
    setFunction(new ParameterizedFunction(function, function.getFunctionDefinition().getDefaultParameters()));
  }
View Full Code Here


    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) {
      node.addInputValue(inputValue);
    }
View Full Code Here

        final DependencyNode node = new DependencyNode(_nodeTargets[i]);
        for (ValueSpecification input : _nodeInputs[i]) {
          node.addInputValue(input);
        }
        node.addOutputValues(_nodeOutputs[i]);
        node.setFunction(new ParameterizedFunction(functions.getDefinition(_nodeFunctions[i]), _nodeParameters[i]));
        graph.addDependencyNode(node);
      }
      for (DependencyNode node : graph.getDependencyNodes()) {
        for (ValueSpecification inputValue : node.getInputValues()) {
          final DependencyNode inputNode = graph.getNodeProducing(inputValue);
View Full Code Here

      return new MultipleAdjust().with(this).with(other);
    }

    @Override
    protected void apply(final ResolutionRule originalRule, final Collection<ResolutionRule> output) {
      ParameterizedFunction function = originalRule.getParameterizedFunction();
      if (_parameters != null) {
        function = new ParameterizedFunction(originalRule.getParameterizedFunction().getFunction(), _parameters);
      }
      final ComputationTargetFilter computationTargetFilter;
      if (_computationTargetFilter != null) {
        computationTargetFilter = _computationTargetFilter;
      } else {
View Full Code Here

    // REVIEW 2011-07-29 SJC: static method?
    final Collection<CompiledFunctionDefinition> functions = repository.getAllFunctions();
    final Collection<ResolutionRule> result = new ArrayList<ResolutionRule>(functions.size());
    for (CompiledFunctionDefinition compiledFnDefn : repository.getAllFunctions()) {
      if (compiledFnDefn.getTargetType() != null) {
        ParameterizedFunction paramFn = new ParameterizedFunction(compiledFnDefn, compiledFnDefn.getFunctionDefinition().getDefaultParameters());
        result.add(new ResolutionRule(paramFn, ApplyToAllTargets.INSTANCE, getPriority(compiledFnDefn)));
      }
    }
    return result;
  }
View Full Code Here

            parameters = functionParameters.get(selector);
          } else {
            parameters = new EmptyFunctionParameters();
          }
          DependencyNode node = graph.getNodeProducing(valueSpecification);
          node.setFunction(new ParameterizedFunction(node.getFunction().getFunction(), parameters));
          nodeCount++;
        }
      }
      s_logger.info("Inserted manipulation functions and parameters into {} nodes", nodeCount);
View Full Code Here

@Test(groups = TestGroup.UNIT)
public class DefaultCompiledFunctionResolverTest {

  private static ParameterizedFunction function(final CompiledFunctionDefinition cfd, final String uid) {
    ((AbstractFunction) cfd).setUniqueId(uid);
    return new ParameterizedFunction(cfd, cfd.getFunctionDefinition().getDefaultParameters());
  }
View Full Code Here

    return context;
  }

  public void testBasicResolution() {
    final ComputationTarget target = new ComputationTarget(ComputationTargetType.PRIMITIVE, UniqueId.of("scheme", "test_target"));
    final ParameterizedFunction parameterizedF1 = function(new PrimitiveTestFunction("req1"), "1");
    final ParameterizedFunction parameterizedF2 = function(new PrimitiveTestFunction("req1"), "2");
    final DefaultCompiledFunctionResolver resolver = new DefaultCompiledFunctionResolver(createFunctionCompilationContext());
    resolver.addRule(new ResolutionRule(parameterizedF1, ApplyToAllTargets.INSTANCE, 100));
    resolver.addRule(new ResolutionRule(parameterizedF2, ApplyToAllTargets.INSTANCE, 200));
    resolver.compileRules();
    Triple<ParameterizedFunction, ValueSpecification, Collection<ValueSpecification>> result = resolver.resolveFunction("req1", target, ValueProperties.none()).next();
View Full Code Here

  }

  public void testFilteredRule() {
    final ComputationTarget target = new ComputationTarget(ComputationTargetType.PRIMITIVE, UniqueId.of("scheme", "test_target"));
    final ParameterizedFunction parameterizedF1 = function(new PrimitiveTestFunction("req1"), "1");
    final ParameterizedFunction parameterizedF2 = function(new PrimitiveTestFunction("req1"), "2");
    final DefaultCompiledFunctionResolver resolver = new DefaultCompiledFunctionResolver(createFunctionCompilationContext());
    resolver.addRule(new ResolutionRule(parameterizedF1, ApplyToAllTargets.INSTANCE, 100));
    resolver.addRule(new ResolutionRule(parameterizedF2, new Filter(target), 200));
    resolver.compileRules();
    Triple<ParameterizedFunction, ValueSpecification, Collection<ValueSpecification>> result = resolver.resolveFunction("req1", target, ValueProperties.none()).next();
View Full Code Here

  }

  public void testSecurityFunction() {
    final ComputationTarget target = new ComputationTarget(ComputationTargetType.SECURITY, new MockSecurityA());
    final ParameterizedFunction pfn = function(new TestSecurityFunction(), "1");
    final DefaultCompiledFunctionResolver resolver = new DefaultCompiledFunctionResolver(createFunctionCompilationContext());
    resolver.addRule(new ResolutionRule(pfn, ApplyToAllTargets.INSTANCE, 0));
    resolver.compileRules();
    Triple<ParameterizedFunction, ValueSpecification, Collection<ValueSpecification>> result = resolver.resolveFunction("Value", target, ValueProperties.none()).next();
    assertEquals(result.getFirst(), pfn);
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.