Rail Traffic System Adaptation Model


Rail Traffic System Adaptation Rules

C: select Display.access
   where Display.access = true
A: update Track.visible := true
   where part-of(Track,Display)

C: select Display.access
   where Display.access = true
A: update Track.visible := false
   where NOT part-of(Track,Display)

The first rule says that the Track should be visible if the Track is part of the display. This means that if the system is being displayed on a PC, then it should be part of that display set, and therefore the track's visible attribute would be set to true. The opposite also holds. If the track is not part of the display, such as with a mobile phone where the information is only displayed in text, then the visible attribute is set to false.

C: select Display.access
   where Display.access = true
A: update Track.color := "red"
   where part-of(Track,train_location)

This rule says that the Track color should be updated to "red" if the Track is part of the train location. In other words, if the current track instance is one of the tracks that the simulator says the train is sitting on, then change the color of that track to red.

Note: The train_location is a value set from outside the system. Therefore a rule does not appear here to set it.

C: select Display.access
   where Display.access = true
A: update Track.color := "yellow"
   where ( part-of((Track - 1),train_location) AND NOT part-of(Track,train_location) )

This rule says that the Track color should be updated to "yellow" if the previous Track is part of the train location and the the current Track instance is not part of the track. Effectively this rule says that the track which will next be occupied by the train should be colored yellow.

C: select Display.access
   where Display.access = true
A: update Track.color := "green"
   where NOT part-of(Track,train_location)

This rule simply says that the Track color should be updated to "green" if the Track is not occupied by a train.