Author: Adam <git@apiote.xyz>
fixup fruchtfleisch
app/src/main/java/ml/adamsprogs/bimba/api/Structs.kt | 60 +++++++------- build.gradle | 1 fruchtfleisch/build.gradle | 6
diff --git a/app/src/main/java/ml/adamsprogs/bimba/api/Structs.kt b/app/src/main/java/ml/adamsprogs/bimba/api/Structs.kt index dda6d449bd2ae9a070db87193dbcab646f270986..4e713cc4d4ea1124edf8fe0d3abc62bf12e04d96 100644 --- a/app/src/main/java/ml/adamsprogs/bimba/api/Structs.kt +++ b/app/src/main/java/ml/adamsprogs/bimba/api/Structs.kt @@ -32,7 +32,7 @@ override fun toString(): String = "$latitude,$longitude" companion object { fun unmarshal(stream: InputStream): Position { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) return Position( reader.readFloat64(), reader.readFloat64() @@ -91,7 +91,7 @@ val lastUpdate: DateTime ) { companion object { fun unmarshal(stream: InputStream): FeedInfo { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) return FeedInfo( reader.readString(), reader.readString(), @@ -112,7 +112,7 @@ val Effect: UInt ) { companion object { fun unmarshal(stream: InputStream): Alert { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) val header = reader.readString() val description = reader.readString() val url = reader.readString() @@ -132,11 +132,11 @@ val Zone: String ) { companion object { fun unmarshal(stream: InputStream): Time { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) return Time( - reader.readUInt().toUInt(), - reader.readUInt().toUInt(), - reader.readUInt().toUInt(), + reader.readUInt().toULong().toUInt(), + reader.readUInt().toULong().toUInt(), + reader.readUInt().toULong().toUInt(), reader.readI8(), reader.readString() ) @@ -147,7 +147,7 @@ data class Colour(val R: UByte, val G: UByte, val B: UByte) { companion object { fun unmarshal(stream: InputStream): Colour { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) return Colour( reader.readU8(), reader.readU8(), @@ -222,7 +222,7 @@ } companion object { fun unmarshal(stream: InputStream): Vehicle { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) return Vehicle( reader.readString(), Position.unmarshal(stream), @@ -248,11 +248,11 @@ val name: String ) : LineAbstract { companion object { fun unmarshal(stream: InputStream): LineStub { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) val colour = Colour.unmarshal(stream) val type = reader.readUInt() val name = reader.readString() - return LineStub(name = name, colour = colour, type = LineType.of(type.toUInt())) + return LineStub(name = name, colour = colour, type = LineType.of(type.toULong().toUInt())) } } @@ -326,7 +326,7 @@ } companion object { fun unmarshal(stream: InputStream): Departure { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) val id = reader.readString() val line = LineStub.unmarshal(stream) val headsign = reader.readString() @@ -414,11 +414,11 @@ } companion object { fun unmarshal(stream: InputStream): Stop { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) val code = reader.readString() val zone = reader.readString() val position = Position.unmarshal(stream) - val chOptionsNum = reader.readUInt() + val chOptionsNum = reader.readUInt().toULong() val changeOptions = mutableListOf<ChangeOption>() for (i in 0UL until chOptionsNum) { changeOptions.add(ChangeOption.unmarshal(stream)) @@ -545,15 +545,15 @@ } companion object { fun unmarshal(stream: InputStream): Line { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) val colour = Colour.unmarshal(stream) val type = reader.readUInt() - val headsignsThereNum = reader.readUInt() + val headsignsThereNum = reader.readUInt().toULong() val headsignsThere = mutableListOf<String>() for (i in 0UL until headsignsThereNum) { headsignsThere.add(reader.readString()) } - val headsignsBackNum = reader.readUInt() + val headsignsBackNum = reader.readUInt().toULong() val headsignsBack = mutableListOf<String>() for (i in 0UL until headsignsBackNum) { headsignsBack.add(reader.readString()) @@ -562,7 +562,7 @@ val graphThere = LineGraph.unmarshal(stream) val graphBack = LineGraph.unmarshal(stream) val name = reader.readString() return Line( - name = name, colour = colour, type = LineType.of(type.toUInt()), + name = name, colour = colour, type = LineType.of(type.toULong().toUInt()), headsignsThere = headsignsThere, headsignsBack = headsignsBack, graphThere = graphThere, graphBack = graphBack ) @@ -587,7 +587,7 @@ data class ChangeOption(val line: String, val headsign: String) { companion object { fun unmarshal(stream: InputStream): ChangeOption { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) return ChangeOption(line = reader.readString(), headsign = reader.readString()) } } @@ -600,31 +600,31 @@ val prevNodes: Map> ) { companion object { fun unmarshal(stream: InputStream): LineGraph { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) - val stopsNum = reader.readUInt() + val reader = Reader(stream) + val stopsNum = reader.readUInt().toULong() val stops = mutableListOf<StopStub>() for (i in 0UL until stopsNum) { stops.add(StopStub.unmarshal(stream)) } - val nextNodesNum = reader.readUInt() + val nextNodesNum = reader.readUInt().toULong() val nextNodes = mutableMapOf<Long, List<Long>>() for (i in 0UL until nextNodesNum) { - val from = reader.readInt() - val toNum = reader.readUInt() + val from = reader.readInt().toLong() + val toNum = reader.readUInt().toULong() val to = mutableListOf<Long>() for (j in 0UL until toNum) { - to.add(reader.readInt()) + to.add(reader.readInt().toLong()) } nextNodes[from] = to } - val prevNodesNum = reader.readUInt() + val prevNodesNum = reader.readUInt().toULong() val prevNodes = mutableMapOf<Long, List<Long>>() for (i in 0UL until prevNodesNum) { - val from = reader.readInt() - val toNum = reader.readUInt() + val from = reader.readInt().toLong() + val toNum = reader.readUInt().toULong() val to = mutableListOf<Long>() for (j in 0UL until toNum) { - to.add(reader.readInt()) + to.add(reader.readInt().toLong()) } prevNodes[from] = to } @@ -637,7 +637,7 @@ data class StopStub(val name: String, val code: String, val zone: String, val onDemand: Boolean) { companion object { fun unmarshal(stream: InputStream): StopStub { - val reader = xyz.apiote.fruchtfleisch.Reader(stream) + val reader = Reader(stream) return StopStub( code = reader.readString(), name = reader.readString(), diff --git a/build.gradle b/build.gradle index 9823be4b148839ed8d9405055e8b0cbc4660e26a..74d65fbdbccb43c494abe0c8ebe108e5094f72a0 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id 'com.android.application' version '7.3.1' apply false id 'com.android.library' version '7.3.1' apply false id 'org.jetbrains.kotlin.android' version '1.7.10' apply false + id 'org.jetbrains.kotlin.jvm' version '1.7.20' apply false } task clean(type: Delete) { diff --git a/fruchtfleisch/build.gradle b/fruchtfleisch/build.gradle index b1a7126119782ae28a7a75086af3235f2619292e..e7ceb4cce7d2dcbc650fa806ead2fcfa26ba232e 100644 --- a/fruchtfleisch/build.gradle +++ b/fruchtfleisch/build.gradle @@ -4,9 +4,9 @@ id 'org.jetbrains.kotlin.jvm' } java { - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } dependencies { - implementation 'org.jetbrains.kotlin:kotlin-reflect:1.8.10' + //implementation 'org.jetbrains.kotlin:kotlin-reflect:1.8.10' } \ No newline at end of file