Skip to content

Commit 14ea8b8

Browse files
committed
fix: Fix bugs after pull.
1 parent 2045d29 commit 14ea8b8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/src/main/kotlin/dbSave/jsonFormat/JsonRepository.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ import com.google.common.reflect.TypeToken
44
import com.google.gson.GsonBuilder
55
import java.io.File
66

7-
class JsonRepository<Pack : Comparable<Pack>>(private val dirPath: String) {
7+
class JsonRepository(private val dirPath: String) {
88

99
init {
1010
File(dirPath).mkdirs()
1111
}
1212

13-
fun saveChanges(
13+
fun <Pack: Comparable<Pack>>saveChanges(
1414
preOrder: Array<DrawBINVertex<Pack>>,
15-
typeToken: TypeToken<Array<DrawBINVertex<Pack>>>,
1615
fileName: String
1716
) {
1817

@@ -24,13 +23,13 @@ class JsonRepository<Pack : Comparable<Pack>>(private val dirPath: String) {
2423
writeText(json)
2524
}
2625

27-
val preOrd = gson.fromJson<Array<DrawBINVertex<Pack>>>(json, typeToken.type)
28-
2926
}
3027

31-
fun exportTree(fileName: String) {
28+
fun <Pack: Comparable<Pack>>exportTree(fileName: String, typeToken: TypeToken<Array<DrawBINVertex<Pack>>>) {
3229
val gson = GsonBuilder().setPrettyPrinting().create()
33-
//val json = gson.fromJson(File(dirPath, fileName).readText(), ArrayVertices::class.java)
30+
val json = File(dirPath, fileName).readText()
31+
32+
val preOrd = gson.fromJson<Array<DrawBINVertex<Pack>>>(json, typeToken.type)
3433

3534

3635
}

0 commit comments

Comments
 (0)