Bimba.git

ref: 6a472fe3427cdf16857f62a4929861095be410a4

app/src/main/java/ml/adamsprogs/bimba/models/gtfs/Route.kt


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package ml.adamsprogs.bimba.models.gtfs

import android.os.Parcel
import android.os.Parcelable


data class Route(val id: AgencyAndId, val agency: AgencyAndId, val shortName: String,
                 val longName: String, val description: String, val type: Int, val colour: Int,
                 val textColour: Int, val modifications: HashMap<String, String>) : Parcelable {
    companion object CREATOR : Parcelable.Creator<Route> {
        const val TYPE_BUS = 3
        const val TYPE_TRAM = 0

        override fun createFromParcel(parcel: Parcel): Route {
            return Route(parcel)
        }

        override fun newArray(size: Int): Array<Route?> {
            return arrayOfNulls(size)
        }
    }

    @Suppress("UNCHECKED_CAST")
    constructor(parcel: Parcel) : this(
            AgencyAndId(parcel.readString()),
            AgencyAndId(parcel.readString()),
            parcel.readString(),
            parcel.readString(),
            parcel.readString(),
            parcel.readInt(),
            parcel.readInt(),
            parcel.readInt(),
            parcel.readSerializable() as HashMap<String, String>)

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(id.id)
        parcel.writeString(agency.id)
        parcel.writeString(shortName)
        parcel.writeString(longName)
        parcel.writeString(description)
        parcel.writeInt(type)
        parcel.writeInt(colour)
        parcel.writeInt(textColour)
        parcel.writeSerializable(modifications)
    }

    override fun describeContents(): Int {
        return Parcelable.CONTENTS_FILE_DESCRIPTOR
    }
}