Package com.opengamma.engine.depgraph

Examples of com.opengamma.engine.depgraph.DependencyNode


   
    Set<ValueSpecification> inputValues = deserializer.fieldValueToObject(Set.class, msg.getByName(INPUT_VALUES_FIELD));
    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) {
      node.addInputValue(inputValue);
    }
    for (ValueSpecification outputValue : outputValues) {
      node.addOutputValue(outputValue);
    }
    for (ValueSpecification terminalOutputValue : terminalOutputValues) {
      node.addTerminalOutputValue(terminalOutputValue);
    }
    return node;
  }
View Full Code Here


        // No graph available - an empty one will return null for any of the value specifications
        depGraph = new DependencyGraph(calcConfigName);
      }
      _graphs.put(calcConfigName, depGraph);
    }
    DependencyNode node = depGraph.getNodeProducing(valueSpec);
    return node;
  }
View Full Code Here

    }

    public DependencyGraph get(final CompiledFunctionRepository functions) {
      final DependencyGraph graph = new DependencyGraph(_calcConfig);
      for (int i = 0; i < _nodeTargets.length; i++) {
        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);
          if (inputNode != null) {
            node.addInputNode(inputNode);
          }
        }
      }
View Full Code Here

  private PLAT3249() {
  }

  private DependencyNode getOrCreateCopy(DependencyNode node) {
    DependencyNode newNode = _originalToNew.get(node);
    if (newNode == null) {
      newNode = new DependencyNode(node);
      _originalToNew.put(node, newNode);
      for (DependencyNode inputNode : node.getInputNodes()) {
        newNode.addInputNode(getOrCreateCopy(inputNode));
      }
    }
    return newNode;
  }
View Full Code Here

          if (functionParameters.containsKey(selector)) {
            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

  @Override
  public DependencyGraph buildObject(FudgeDeserializer deserializer, FudgeMsg msg) {
    String calcConfigName = msg.getString(CALCULATION_CONFIGURATION_NAME_FIELD);
    List<DependencyNode> nodes = new ArrayList<DependencyNode>();
    for (FudgeField nodeField : msg.getAllByName(NODE_FIELD)) {
      DependencyNode node = deserializer.fieldValueToObject(DependencyNode.class, nodeField);
      nodes.add(node);
    }
    List<FudgeField> edgeConnections = msg.getAllByName(EDGE_FIELD);
    for (int i = 0; i < edgeConnections.size(); i += 2) {
      int from = deserializer.fieldValueToObject(Integer.class, edgeConnections.get(i));
      int to = deserializer.fieldValueToObject(Integer.class, edgeConnections.get(i + 1));
      DependencyNode inputNode = nodes.get(from);
      DependencyNode dependentNode = nodes.get(to);
      dependentNode.addInputNode(inputNode);
    }
   
    DependencyGraph graph = new DependencyGraph(calcConfigName);
    for (DependencyNode node : nodes) {
      graph.addDependencyNode(node);
View Full Code Here

  private DependencyGraph createDependencyGraph() {
    final DependencyGraph graph = new DependencyGraph("Default");
    final ValueProperties properties = ValueProperties.with(ValuePropertyNames.FUNCTION, "Mock").get();
    final ComputationTarget t1 = new ComputationTarget(ComputationTargetType.PORTFOLIO_NODE, new SimplePortfolioNode(UniqueId.of("Node", "0"), "node"));
    final DependencyNode n1 = new DependencyNode(t1.toSpecification());
    n1.setFunction(new MockFunction("F1", t1));
    n1.addOutputValue(new ValueSpecification("Foo", t1.toSpecification(), properties));
    n1.addTerminalOutputValue(new ValueSpecification("Foo", t1.toSpecification(), properties));
    graph.addDependencyNode(n1);
    final ComputationTarget t2 = new ComputationTarget(ComputationTargetType.POSITION, new SimplePosition(UniqueId.of("Pos", "0"), BigDecimal.ONE, ExternalId.of("Security", "Foo")));
    final DependencyNode n2 = new DependencyNode(t2.toSpecification());
    n2.setFunction(new MockFunction("F2", t1));
    n2.addOutputValue(new ValueSpecification("Foo", t2.toSpecification(), properties));
    n1.addInputValue(new ValueSpecification("Foo", t2.toSpecification(), properties));
    n1.addInputNode(n2);
    graph.addDependencyNode(n2);
    final ComputationTarget t3 = new ComputationTarget(ComputationTargetType.SECURITY, createSecurity(UniqueId.of("Pos", "0"), ExternalId.of("Security", "Foo")));
    final DependencyNode n3 = new DependencyNode(t3.toSpecification());
    n3.setFunction(new MockFunction("F3", t1));
    n3.addOutputValue(new ValueSpecification("Foo", t3.toSpecification(), properties));
    n2.addInputValue(new ValueSpecification("Foo", t3.toSpecification(), properties));
    n2.addInputNode(n3);
    graph.addDependencyNode(n3);
    graph.addTerminalOutput(new ValueRequirement("Foo", t1.toSpecification()), new ValueSpecification("Foo", t1.toSpecification(), properties));
    return graph;
View Full Code Here

        ComputationTargetType.CURRENCY,
        Currency.USD.getUniqueId());

    ComputationTarget target = new ComputationTarget(targetSpecification, Currency.USD);

    DependencyNode yieldCurveNode = new DependencyNode(targetSpecification);
    yieldCurveNode.setFunction(new MockFunction(target));
    yieldCurveNode.addOutputValue(new ValueSpecification(
        "YieldCurve",
        targetSpecification,
        ValueProperties.builder().with("Curve", "Forward3M").with("Function", "someFunction").get()));

    graph.addDependencyNode(yieldCurveNode);
View Full Code Here

   * <pre>
   *      N1 -> N2*
   * </pre>
   */
  private DependencyGraph smallGraph() {
    final DependencyNode n1 = node(1);
    final DependencyNode n2 = tnode(2);
    n2.addInputNode(n1);
    return graph(n1, n2);
  }
View Full Code Here

   *         ->    /
   *    N3 ---> N6
   * </pre>
   */
  private DependencyGraph largeGraph() {
    final DependencyNode n1 = node(1);
    final DependencyNode n2 = node(2);
    final DependencyNode n3 = node(3);
    final DependencyNode n4 = tnode(4);
    final DependencyNode n5 = node(5);
    final DependencyNode n6 = node(6);
    final DependencyNode n7 = tnode(7);
    final DependencyNode n8 = tnode(8);
    n4.addInputNode(n1);
    n5.addInputNode(n2);
    n6.addInputNode(n2);
    n6.addInputNode(n3);
    n7.addInputNode(n5);
    n7.addInputNode(n6);
    n8.addInputNode(n4);
    n8.addInputNode(n7);
    return graph(n1, n2, n3, n4, n5, n6, n7, n8);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.depgraph.DependencyNode

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.