Package com.google.common.collect.BstTesting

Examples of com.google.common.collect.BstTesting.SimpleNode


    //    d
    //   / \
    //  b   f
    // /     \
    // a     g
    SimpleNode a = new SimpleNode('a', null, null);
    SimpleNode b = new SimpleNode('b', a, null);
    SimpleNode g = new SimpleNode('g', null, null);
    SimpleNode f = new SimpleNode('f', null, g);
    SimpleNode d = new SimpleNode('d', b, f);

    BstNodeFactory<SimpleNode> nodeFactory = EasyMock.createStrictMock(BstNodeFactory.class);
    BstBalancePolicy<SimpleNode> balancePolicy = EasyMock.createStrictMock(BstBalancePolicy.class);
    BstModifier<Character, SimpleNode> modifier = EasyMock.createStrictMock(BstModifier.class);
View Full Code Here


   * this and handle it.
   */
  @GwtIncompatible("EasyMock")
  private void expectPossibleEntryfication(BstNodeFactory<SimpleNode> factory, SimpleNode entry) {
    expect(factory.createNode(same(entry), (SimpleNode) isNull(), (SimpleNode) isNull()))
        .andReturn(new SimpleNode(entry.getKey(), null, null))
        .times(0, 1);
  }
View Full Code Here

    //    d
    //   / \
    //  b   f
    //   \   \
    //   c   g
    SimpleNode c = new SimpleNode('c', null, null);
    SimpleNode b = new SimpleNode('b', null, c);
    SimpleNode g = new SimpleNode('g', null, null);
    SimpleNode f = new SimpleNode('f', null, g);
    SimpleNode d = new SimpleNode('d', b, f);

    SimpleNode a = new SimpleNode('a', null, null);
    SimpleNode newRoot = BstOperations.insertMin(d, a, nodeFactory, balancePolicy);
    assertInOrderTraversalIs(newRoot, "abcdfg");
  }
View Full Code Here

    //    d
    //   / \
    //  b   f
    //       \
    //       g
    SimpleNode b = new SimpleNode('b', null, null);
    SimpleNode g = new SimpleNode('g', null, null);
    SimpleNode f = new SimpleNode('f', null, g);
    SimpleNode d = new SimpleNode('d', b, f);

    SimpleNode a = new SimpleNode('a', null, null);
    SimpleNode newRoot = BstOperations.insertMin(d, a, nodeFactory, balancePolicy);
    assertInOrderTraversalIs(newRoot, "abdfg");
  }
View Full Code Here

    SimpleNode newRoot = BstOperations.insertMin(d, a, nodeFactory, balancePolicy);
    assertInOrderTraversalIs(newRoot, "abdfg");
  }

  public void testInsertMinEmpty() {
    SimpleNode a = new SimpleNode('a', null, null);
    SimpleNode newRoot = BstOperations.insertMin(null, a, nodeFactory, balancePolicy);
    assertInOrderTraversalIs(newRoot, "a");
  }
View Full Code Here

    //    d
    //   / \
    //  b   f
    //   \   \
    //   c   g
    SimpleNode c = new SimpleNode('c', null, null);
    SimpleNode b = new SimpleNode('b', null, c);
    SimpleNode g = new SimpleNode('g', null, null);
    SimpleNode f = new SimpleNode('f', null, g);
    SimpleNode d = new SimpleNode('d', b, f);

    SimpleNode h = new SimpleNode('h', null, null);
    SimpleNode newRoot = BstOperations.insertMax(d, h, nodeFactory, balancePolicy);
    assertInOrderTraversalIs(newRoot, "bcdfgh");
  }
View Full Code Here

    //    d
    //   / \
    //  b   f
    //     /
    //     e
    SimpleNode b = new SimpleNode('b', null, null);
    SimpleNode e = new SimpleNode('e', null, null);
    SimpleNode f = new SimpleNode('f', e, null);
    SimpleNode d = new SimpleNode('d', b, f);

    SimpleNode h = new SimpleNode('h', null, null);
    SimpleNode newRoot = BstOperations.insertMax(d, h, nodeFactory, balancePolicy);
    assertInOrderTraversalIs(newRoot, "bdefh");
  }
View Full Code Here

    SimpleNode newRoot = BstOperations.insertMax(d, h, nodeFactory, balancePolicy);
    assertInOrderTraversalIs(newRoot, "bdefh");
  }

  public void testInsertMaxEmpty() {
    SimpleNode a = new SimpleNode('a', null, null);
    SimpleNode newRoot = BstOperations.insertMax(null, a, nodeFactory, balancePolicy);
    assertInOrderTraversalIs(newRoot, "a");
  }
View Full Code Here

    //    d
    //   / \
    //  b   f
    //   \   \
    //   c   g
    SimpleNode c = new SimpleNode('c', null, null);
    SimpleNode b = new SimpleNode('b', null, c);
    SimpleNode g = new SimpleNode('g', null, null);
    SimpleNode f = new SimpleNode('f', null, g);
    SimpleNode d = new SimpleNode('d', b, f);

    BstMutationResult<Character, SimpleNode> extractMin =
        BstOperations.extractMin(d, nodeFactory, balancePolicy);
    assertEquals('b', extractMin.getTargetKey().charValue());
    assertEquals(d, extractMin.getOriginalRoot());
View Full Code Here

    //    d
    //   / \
    //  b   f
    //       \
    //       g
    SimpleNode b = new SimpleNode('b', null, null);
    SimpleNode g = new SimpleNode('g', null, null);
    SimpleNode f = new SimpleNode('f', null, g);
    SimpleNode d = new SimpleNode('d', b, f);

    BstMutationResult<Character, SimpleNode> extractMin =
        BstOperations.extractMin(d, nodeFactory, balancePolicy);
    assertEquals('b', extractMin.getTargetKey().charValue());
    assertEquals(d, extractMin.getOriginalRoot());
View Full Code Here

TOP

Related Classes of com.google.common.collect.BstTesting.SimpleNode

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.