mirror of
https://github.com/smyalygames/checklist-tester.git
synced 2025-05-18 06:24:12 +02:00
feat(connector): add VDM type data class for ItemObject
This commit is contained in:
parent
34904c4bf8
commit
51269484af
@ -4,7 +4,7 @@ package io.anthonyberg.connector.shared.vdmj.type
|
||||
* Aircraft record type in the VDM-SL model
|
||||
*/
|
||||
data class Aircraft(
|
||||
val items: Map<String, Switch>, // TODO value should be ItemObject type
|
||||
val items: Map<String, ItemObject>,
|
||||
val procedure: MutableList<ProcedureItem>
|
||||
) {
|
||||
/**
|
||||
|
@ -0,0 +1,13 @@
|
||||
package io.anthonyberg.connector.shared.vdmj.type
|
||||
|
||||
data class ItemObject(val type: ItemType, val item: Switch) { // TODO add types for other items
|
||||
/**
|
||||
* Converts to String for a VDM representation of an ItemObject record
|
||||
*
|
||||
* @return String representation for VDM ItemObject
|
||||
*/
|
||||
fun toVDMString(): String {
|
||||
return "mk_ItemObject(${type.toVDMString()}, ${item.toVDMString()})"
|
||||
}
|
||||
|
||||
}
|
@ -12,21 +12,12 @@ data class Switch(val position: Int, val middlePosition: Boolean = false) {
|
||||
require((position >= 0) and ((position <= 1) and !middlePosition) or ((position <= 2) and middlePosition))
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts to String for a VDM representation of an ItemObject record
|
||||
*
|
||||
* @return String representation for VDM ItemObject
|
||||
*/
|
||||
fun toVDMString(): String {
|
||||
return "mk_ItemObject(<SWITCH>, ${toSwitchVDMString()})"
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts to String for a VDM representation of a Switch record
|
||||
*
|
||||
* @return String representation for VDM Switch
|
||||
*/
|
||||
private fun toSwitchVDMString(): String {
|
||||
fun toVDMString(): String {
|
||||
return "mk_Switch(${getSwitchState()}, $middlePosition)"
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user