|
@@ -1,110 +0,0 @@
|
|
|
-//package com.gxzc.zen.api
|
|
|
-//
|
|
|
-//import com.fasterxml.jackson.databind.ObjectMapper
|
|
|
-//import com.gxzc.zen.api.sys.common.DictTypeTree
|
|
|
-//import com.gxzc.zen.common.util.TreeUtil
|
|
|
-//import org.junit.Test
|
|
|
-//
|
|
|
-///**
|
|
|
-// *
|
|
|
-// * @author NorthLan
|
|
|
-// * @date 2018/4/28
|
|
|
-// * @url https://noahlan.com
|
|
|
-// */
|
|
|
-//class TestDictTypeTreeRedis {
|
|
|
-//
|
|
|
-// fun buildData(): MutableList<DictTypeTree> {
|
|
|
-// return mutableListOf<DictTypeTree>().apply {
|
|
|
-// add(DictTypeTree().apply {
|
|
|
-// id = 1
|
|
|
-// parentId = 0
|
|
|
-// type = 1
|
|
|
-// })
|
|
|
-// add(DictTypeTree().apply {
|
|
|
-// id = 2
|
|
|
-// parentId = 1
|
|
|
-// type = 1
|
|
|
-// })
|
|
|
-// add(DictTypeTree().apply {
|
|
|
-// id = 3
|
|
|
-// parentId = 1
|
|
|
-// type = 1
|
|
|
-// })
|
|
|
-// add(DictTypeTree().apply {
|
|
|
-// id = 4
|
|
|
-// parentId = 2
|
|
|
-// type = 1
|
|
|
-// code = "test"
|
|
|
-// })
|
|
|
-// add(DictTypeTree().apply {
|
|
|
-// id = 5
|
|
|
-// parentId = 4
|
|
|
-// type = 2
|
|
|
-// value = "1"
|
|
|
-// code = "test"
|
|
|
-// })
|
|
|
-// add(DictTypeTree().apply {
|
|
|
-// id = 6
|
|
|
-// parentId = 4
|
|
|
-// type = 2
|
|
|
-// value = "2"
|
|
|
-// code = "test"
|
|
|
-// })
|
|
|
-// add(DictTypeTree().apply {
|
|
|
-// id = 7
|
|
|
-// parentId = 4
|
|
|
-// type = 2
|
|
|
-// value = "3"
|
|
|
-// code = "test"
|
|
|
-// })
|
|
|
-// add(DictTypeTree().apply {
|
|
|
-// id = 8
|
|
|
-// parentId = 4
|
|
|
-// type = 2
|
|
|
-// value = "4"
|
|
|
-// code = "test"
|
|
|
-// })
|
|
|
-// add(DictTypeTree().apply {
|
|
|
-// id = 9
|
|
|
-// parentId = 4
|
|
|
-// type = 2
|
|
|
-// value = "5"
|
|
|
-// code = "test"
|
|
|
-// })
|
|
|
-// add(DictTypeTree().apply {
|
|
|
-// id = 10
|
|
|
-// parentId = 4
|
|
|
-// type = 2
|
|
|
-// value = "6"
|
|
|
-// code = "test"
|
|
|
-// })
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Test
|
|
|
-// fun testTreeFind() {
|
|
|
-// val data = buildData()
|
|
|
-// val tree = TreeUtil.buildByRecursive(data, 0)
|
|
|
-//
|
|
|
-// println(ObjectMapper().writeValueAsString(tree))
|
|
|
-//
|
|
|
-// var now = System.currentTimeMillis()
|
|
|
-// val find = TreeUtil.findBFS(tree) {
|
|
|
-// it.type == 1 && it.code == "test"
|
|
|
-// }
|
|
|
-//
|
|
|
-// println("BFS: ${System.currentTimeMillis() - now}")
|
|
|
-//
|
|
|
-// println(ObjectMapper().writeValueAsString(find))
|
|
|
-//
|
|
|
-// now = System.currentTimeMillis()
|
|
|
-// val find2 = TreeUtil.findDFS(tree) {
|
|
|
-// it.type == 1 && it.code == "test"
|
|
|
-// }
|
|
|
-//
|
|
|
-// println("DFS: ${System.currentTimeMillis() - now}")
|
|
|
-//
|
|
|
-//
|
|
|
-// println(ObjectMapper().writeValueAsString(find2))
|
|
|
-// }
|
|
|
-//}
|