Package org.jamesii.perfdb.recording.selectiontrees

Examples of org.jamesii.perfdb.recording.selectiontrees.SelectedFactoryNode


              .equals(abstractFactorySummary)) {
        eligibleNodes.add(selFacNode);
      }
    }

    SelectedFactoryNode closestFacNode = null;
    int distanceToRoot = Integer.MAX_VALUE;
    for (SelectedFactoryNode selFacNode : eligibleNodes) {
      int thisNodesDistance =
          BasicTree.getVertexSequenceFromRoot(childParentMap, selFacNode)
              .size();
      if (distanceToRoot > thisNodesDistance) {
        closestFacNode = selFacNode;
        distanceToRoot = thisNodesDistance;
      }
    }

    return closestFacNode == null ? "" : Strings.dispClassName(closestFacNode
        .getFactoryClass());
  }
View Full Code Here


  @Override
  public void setUp() {

    testTree1 = new SelectionTree(null);
    SelectedFactoryNode sfn1 =
        new SelectedFactoryNode(new SelectionInformation<>(
            AbstractProcessorFactory.class, new ParameterBlock(),
            new BogusSimulatorFactoryA()));
    testTree1.addVertex(sfn1);
    testTree1.addEdge(new Edge<>(sfn1, testTree1.getRoot()));

    testTree2 = new SelectionTree(null);
    SelectedFactoryNode sfn2 =
        new SelectedFactoryNode(new SelectionInformation<>(
            AbstractProcessorFactory.class, new ParameterBlock(),
            new BogusSimulatorFactoryA()));
    testTree2.addVertex(sfn2);
    testTree2.addEdge(new Edge<>(sfn2, testTree2.getRoot()));

    testTree3 = new SelectionTree(null);
    SelectedFactoryNode sfn3 =
        new SelectedFactoryNode(new SelectionInformation<>(
            AbstractProcessorFactory.class, (new ParameterBlock()).addSubBl(
                FlexibleBogusSimulatorFactory.SIM_PROPERTIES,
                TEST_PARAMETER_VALUE), new FlexibleBogusSimulatorFactory()));
    testTree3.addVertex(sfn3);
    testTree3.addEdge(new Edge<>(sfn3, testTree3.getRoot()));

    testTree4 = new SelectionTree(null);
    SelectedFactoryNode sfn4 =
        new SelectedFactoryNode(new SelectionInformation<>(
            AbstractProcessorFactory.class, new ParameterBlock().addSubBl(
                "test1", 1.0).addSubBl("test2", 2.0),
            new BogusSimulatorFactoryA()));
    testTree4.addVertex(sfn4);
    testTree4.addEdge(new Edge<>(sfn4, testTree4.getRoot()));
View Full Code Here

  public void testEquality() {
    assertTrue(EqualsCheck.equals(testTree1, testTree2));
    assertFalse(EqualsCheck.equals(testTree1, testTree3));
    assertFalse(EqualsCheck.equals(testTree1, testTree4));

    SelectedFactoryNode factoryNode =
        testTree1.getChildren(testTree1.getRoot()).get(0);
    SelectionInformation<?> si = factoryNode.getSelectionInformation();
    ParameterBlock pb = si.getParameter();
    pb.addSubBl("test1", 1.0).addSubBl("test2", 2.0);

    SelectionInformation<?> newSelectionInformation =
        new SelectionInformation<>(
            AbstractProcessorFactory.class, pb, new BogusSimulatorFactoryA());
    SelectedFactoryNode newFactoryNode =
        new SelectedFactoryNode(newSelectionInformation);
    testTree1.removeVertex(factoryNode);
    assertEquals(1, testTree1.getVertexCount());
    testTree1.addVertex(newFactoryNode);
    testTree1.addEdge(new Edge<>(newFactoryNode, testTree1
        .getRoot()));
View Full Code Here

   * Create bogus node 'a'.
   *
   * @return the selected factory node
   */
  public static SelectedFactoryNode nA() {
    return new SelectedFactoryNode(
        new SelectionInformation<>(
            AbstractDistributionFactory.class, null,
            new NormalDistributionFactory()));
  }
View Full Code Here

   * Create bogus node 'b'.
   *
   * @return the selected factory node
   */
  public static SelectedFactoryNode nB() {
    return new SelectedFactoryNode(
        new SelectionInformation<>(
            AbstractDistributionFactory.class, null,
            new ExponentialDistributionFactory()));
  }
View Full Code Here

   * Create bogus node 'c'.
   *
   * @return the selected factory node
   */
  public static SelectedFactoryNode nC() {
    return new SelectedFactoryNode(
        new SelectionInformation<>(
            AbstractDistributionFactory.class, null,
            new UniformDistributionFactory()));
  }
View Full Code Here

   * Create bogus node 'd'.
   *
   * @return the selected factory node
   */
  public static SelectedFactoryNode nD() {
    return new SelectedFactoryNode(
        new SelectionInformation<>(
            AbstractDistributionFactory.class, null,
            new WeibullDistributionFactory()));
  }
View Full Code Here

   * Create bogus node 'e'.
   *
   * @return the selected factory node
   */
  public static SelectedFactoryNode nE() {
    return new SelectedFactoryNode(
        new SelectionInformation<>(
            AbstractDistributionFactory.class, null,
            new CamelDistributionFactory()));
  }
View Full Code Here

  }

  @Override
  public SelectionTree getTestObject() {
    SelectionTree st = new SelectionTree(null);
    st.addVertex(new SelectedFactoryNode(
        new SelectionInformation<>(
            AbstractEventQueueFactory.class, new ParameterBlock(),
            new SimpleEventQueueFactory())));
    return st;
  }
View Full Code Here

   * @return the parameters for the factory
   */
  protected List<String> getParametersForFactory(SelectionTree selectionTree,
      Class<? extends Factory<?>> factory) {

    SelectedFactoryNode selFacNode =
        searchSelectedFactoryNode(selectionTree, factory);

    if (selFacNode == null) {
      throw new IllegalArgumentException("Factory '" + factory
          + "' was not found!");
    }

    ParameterBlock paramBlock = selFacNode.getParameter();
    if (paramBlock == null) {
      paramBlock = new ParameterBlock();
    }

    return compileResults(
        factoryParametersMap.get(SimSystem.getRegistry()
            .getBaseFactoryForAbstractFactory(
                selFacNode.getAbstractFactoryClass())), paramBlock);
  }
View Full Code Here

TOP

Related Classes of org.jamesii.perfdb.recording.selectiontrees.SelectedFactoryNode

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.