diff --git a/src/main/kotlin/application/model/Vessel.kt b/src/main/kotlin/application/model/Vessel.kt index 8d3d5a3..2533699 100644 --- a/src/main/kotlin/application/model/Vessel.kt +++ b/src/main/kotlin/application/model/Vessel.kt @@ -19,7 +19,8 @@ class Vessel(val mmsi: String?) { fun getAllTimeBeforeSelectedTime(): ArrayList { val timeList = arrayListOf() messageBeforeSelectedTime.forEach { - timeList.add(it.value.time.value!!) + if (it.value.time.value != null) + timeList.add(it.value.time.value!!) } return timeList @@ -28,7 +29,8 @@ class Vessel(val mmsi: String?) { fun getAllLatitudeBeforeSelectedTime(): ArrayList { val latitudeList = arrayListOf() messageBeforeSelectedTime.forEach { - latitudeList.add(it.value.latitude.value!!) + if (it.value.latitude.value != null) + latitudeList.add(it.value.latitude.value!!) } return latitudeList @@ -37,7 +39,8 @@ class Vessel(val mmsi: String?) { fun getAllLongitudeBeforeSelectedTime(): ArrayList { val longitudeList = arrayListOf() messageBeforeSelectedTime.forEach { - longitudeList.add(it.value.longitude.value!!) + if (it.value.longitude.value != null) + longitudeList.add(it.value.longitude.value!!) } return longitudeList @@ -46,7 +49,8 @@ class Vessel(val mmsi: String?) { fun getAllSpeedOverGroundBeforeSelectedTime(): ArrayList { val speedOverGroundList = arrayListOf() messageBeforeSelectedTime.forEach { - speedOverGroundList.add(it.value.speedOverGround.value!!) + if (it.value.speedOverGround.value != null) + speedOverGroundList.add(it.value.speedOverGround.value!!) } return speedOverGroundList @@ -55,7 +59,8 @@ class Vessel(val mmsi: String?) { fun getAllCourseOverGroundBeforeSelectedTime(): ArrayList { val res = arrayListOf() messageBeforeSelectedTime.forEach { - res.add(it.value.courseOverGround.value!!) + if (it.value.courseOverGround.value != null) + res.add(it.value.courseOverGround.value!!) } return res @@ -64,7 +69,8 @@ class Vessel(val mmsi: String?) { fun getAllHeadingBeforeSelectedTime(): ArrayList { val res = arrayListOf() messageBeforeSelectedTime.forEach { - res.add(it.value.heading.value!!) + if (it.value.heading.value != null) + res.add(it.value.heading.value!!) } return res @@ -73,7 +79,8 @@ class Vessel(val mmsi: String?) { fun getAllVesselNameBeforeSelectedTime(): ArrayList { val res = arrayListOf() messageBeforeSelectedTime.forEach { - res.add(it.value.vesselName.value!!) + if (it.value.vesselName.value != null) + res.add(it.value.vesselName.value!!) } return res } @@ -81,7 +88,8 @@ class Vessel(val mmsi: String?) { fun getAllIMOBeforeSelectedTime(): ArrayList { val res = arrayListOf() messageBeforeSelectedTime.forEach { - res.add(it.value.imo.value!!) + if (it.value.imo.value != null) + res.add(it.value.imo.value!!) } return res } @@ -89,7 +97,8 @@ class Vessel(val mmsi: String?) { fun getAllCallSignBeforeSelectedTime(): ArrayList { val res = arrayListOf() messageBeforeSelectedTime.forEach { - res.add(it.value.callSign.value!!) + if (it.value.callSign.value != null) + res.add(it.value.callSign.value!!) } return res } @@ -97,7 +106,8 @@ class Vessel(val mmsi: String?) { fun getAllVesselTypeBeforeSelectedTime(): ArrayList { val res = arrayListOf() messageBeforeSelectedTime.forEach { - res.add(it.value.vesselType.value!!) + if (it.value.vesselType.value != null) + res.add(it.value.vesselType.value!!) } return res } @@ -105,7 +115,8 @@ class Vessel(val mmsi: String?) { fun getAllStatusBeforeSelectedTime(): ArrayList { val res = arrayListOf() messageBeforeSelectedTime.forEach { - res.add(it.value.status.value!!) + if (it.value.status.value != null) + res.add(it.value.status.value!!) } return res } @@ -113,7 +124,8 @@ class Vessel(val mmsi: String?) { fun getAllLengthBeforeSelectedTime(): ArrayList { val res = arrayListOf() messageBeforeSelectedTime.forEach { - res.add(it.value.length.value!!) + if (it.value.length.value != null) + res.add(it.value.length.value!!) } return res } @@ -121,7 +133,8 @@ class Vessel(val mmsi: String?) { fun getAllWidthBeforeSelectedTime(): ArrayList { val res = arrayListOf() messageBeforeSelectedTime.forEach { - res.add(it.value.width.value!!) + if (it.value.width.value != null) + res.add(it.value.width.value!!) } return res } @@ -129,7 +142,8 @@ class Vessel(val mmsi: String?) { fun getAllDraftBeforeSelectedTime(): ArrayList { val res = arrayListOf() messageBeforeSelectedTime.forEach { - res.add(it.value.draft.value!!) + if (it.value.draft.value != null) + res.add(it.value.draft.value!!) } return res } @@ -137,7 +151,8 @@ class Vessel(val mmsi: String?) { fun getAllCargoBeforeSelectedTime(): ArrayList { val res = arrayListOf() messageBeforeSelectedTime.forEach { - res.add(it.value.cargo.value!!) + if (it.value.cargo.value != null) + res.add(it.value.cargo.value!!) } return res } @@ -145,7 +160,8 @@ class Vessel(val mmsi: String?) { fun getAllTime(): ArrayList { val timeList = arrayListOf() messages.forEach { - timeList.add(it.value.time.value!!) + if (it.value.time.value != null) + timeList.add(it.value.time.value!!) } return timeList @@ -154,7 +170,8 @@ class Vessel(val mmsi: String?) { fun getAllLatitude(): ArrayList { val latitudeList = arrayListOf() messages.forEach { - latitudeList.add(it.value.latitude.value!!) + if (it.value.latitude.value != null) + latitudeList.add(it.value.latitude.value!!) } return latitudeList @@ -163,7 +180,8 @@ class Vessel(val mmsi: String?) { fun getAllLongitude(): ArrayList { val longitudeList = arrayListOf() messages.forEach { - longitudeList.add(it.value.longitude.value!!) + if (it.value.longitude.value != null) + longitudeList.add(it.value.longitude.value!!) } return longitudeList @@ -172,7 +190,8 @@ class Vessel(val mmsi: String?) { fun getAllSpeedOverGround(): ArrayList { val speedOverGroundList = arrayListOf() messages.forEach { - speedOverGroundList.add(it.value.speedOverGround.value!!) + if (it.value.speedOverGround.value != null) + speedOverGroundList.add(it.value.speedOverGround.value!!) } return speedOverGroundList @@ -181,7 +200,8 @@ class Vessel(val mmsi: String?) { fun getAllCourseOverGround(): ArrayList { val res = arrayListOf() messages.forEach { - res.add(it.value.courseOverGround.value!!) + if (it.value.courseOverGround.value != null) + res.add(it.value.courseOverGround.value!!) } return res @@ -190,6 +210,7 @@ class Vessel(val mmsi: String?) { fun getAllHeading(): ArrayList { val res = arrayListOf() messages.forEach { + if (it.value.heading.value != null) res.add(it.value.heading.value!!) } @@ -199,7 +220,8 @@ class Vessel(val mmsi: String?) { fun getAllVesselName(): ArrayList { val res = arrayListOf() messages.forEach { - res.add(it.value.vesselName.value!!) + if (it.value.vesselName.value != null) + res.add(it.value.vesselName.value!!) } return res } @@ -207,7 +229,8 @@ class Vessel(val mmsi: String?) { fun getAllIMO(): ArrayList { val res = arrayListOf() messages.forEach { - res.add(it.value.imo.value!!) + if (it.value.imo.value != null) + res.add(it.value.imo.value!!) } return res } @@ -215,7 +238,8 @@ class Vessel(val mmsi: String?) { fun getAllCallSign(): ArrayList { val res = arrayListOf() messages.forEach { - res.add(it.value.callSign.value!!) + if (it.value.callSign.value != null) + res.add(it.value.callSign.value!!) } return res } @@ -223,7 +247,8 @@ class Vessel(val mmsi: String?) { fun getAllVesselType(): ArrayList { val res = arrayListOf() messages.forEach { - res.add(it.value.vesselType.value!!) + if (it.value.vesselType.value != null) + res.add(it.value.vesselType.value!!) } return res } @@ -231,7 +256,8 @@ class Vessel(val mmsi: String?) { fun getAllStatus(): ArrayList { val res = arrayListOf() messages.forEach { - res.add(it.value.status.value!!) + if (it.value.status.value != null) + res.add(it.value.status.value!!) } return res } @@ -239,7 +265,8 @@ class Vessel(val mmsi: String?) { fun getAllLength(): ArrayList { val res = arrayListOf() messages.forEach { - res.add(it.value.length.value!!) + if (it.value.length.value != null) + res.add(it.value.length.value!!) } return res } @@ -247,7 +274,8 @@ class Vessel(val mmsi: String?) { fun getAllWidth(): ArrayList { val res = arrayListOf() messages.forEach { - res.add(it.value.width.value!!) + if (it.value.width.value != null) + res.add(it.value.width.value!!) } return res } @@ -255,7 +283,8 @@ class Vessel(val mmsi: String?) { fun getAllDraft(): ArrayList { val res = arrayListOf() messages.forEach { - res.add(it.value.draft.value!!) + if (it.value.draft.value != null) + res.add(it.value.draft.value!!) } return res } @@ -263,7 +292,9 @@ class Vessel(val mmsi: String?) { fun getAllCargo(): ArrayList { val res = arrayListOf() messages.forEach { - res.add(it.value.cargo.value!!) + if (it.value.cargo.value != null) + res.add(it.value.cargo.value!!) + } return res }