Mercurial > hg > Members > tatsuki > TreeMap
changeset 22:aa30cf7adec2
fit method
author | tatsuki |
---|---|
date | Wed, 29 Apr 2015 16:11:47 +0900 |
parents | a2242522c2cd |
children | 60f35f5c6982 |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/TreeMap/TreeMap.java src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/test/TreeMapDelete.java src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/test/TreeMapTest.java |
diffstat | 3 files changed, 5 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/TreeMap/TreeMap.java Wed Apr 29 16:02:56 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/TreeMap/TreeMap.java Wed Apr 29 16:11:47 2015 +0900 @@ -62,8 +62,8 @@ } @Test - public void checkBlackCount(){ - root.checkBlackCount(0,0); + public void checkDepth(){ + root.checkDepth(0,0); System.out.println("-----------------------------------"); } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/test/TreeMapDelete.java Wed Apr 29 16:02:56 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/test/TreeMapDelete.java Wed Apr 29 16:11:47 2015 +0900 @@ -17,67 +17,21 @@ TreeMap<Integer, Integer> map = new TreeMap(); for (int count = 1; count < 3000; count++) { map = map.put(count, count); - map.checkBlackCount(); + map.checkDepth(); } ArrayList<Integer> list = new ArrayList(); for (int i = 1; i < 3000; i++) { list.add(i); } -// test(map); Collections.shuffle(list); for (Integer num : list) { System.out.println(num); TreeMap newMap = map.delete(num); map = newMap; - map.checkBlackCount(); + map.checkDepth(); } System.out.println("end"); } - - public static void test(TreeMap map) throws RotateParent { - TreeMap newMap = map.delete(13); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(26); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(5); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(3); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(29); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(8); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(22); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(2); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(20); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(11); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(19); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(6); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(25); - map = newMap; - map.checkBlackCount(); - newMap = map.delete(12); - map = newMap; - map.checkBlackCount(); - } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/test/TreeMapTest.java Wed Apr 29 16:02:56 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/test/TreeMapTest.java Wed Apr 29 16:11:47 2015 +0900 @@ -1,6 +1,5 @@ package jp.ac.u_ryukyu.ie.cr.tatsuki.test; -import jp.ac.u_ryukyu.ie.cr.tatsuki.TreeMap.Node; import jp.ac.u_ryukyu.ie.cr.tatsuki.TreeMap.TreeMap; import java.util.Optional; @@ -18,7 +17,7 @@ TreeMap<Integer, Integer> map5 = map4.put(4,4); for (int count = 100; count > 0; count--) { map = map.put(count, count); - map.checkBlackCount(); + map.checkDepth(); System.out.println("-------------------------------------------"); }