include "primitives.alh"

SimpleAttribute Boolean {
    name = "Boolean"
}
SimpleAttribute TriState {
    name = "TriState"
}
SimpleAttribute String{
    name = "String"
    constraint = $
        String function constraint(model : Element, name : String):
            if (is_physical_string(model["model"][name])):
                return "OK"!
            else:
                return "String has non-string value"!
        $
}

Class State {
    name = "State"
    isInitial : Boolean
    isError : Boolean
    name : String
}

Class Up : State {
    name = "Up"
}
Class Down : State {
    name = "Down"
}
Class Neutral : State {
    name = "Neutral"
}

Association Transition (State, State) {
    name = "Transition"
    objDetected : TriState
}
Association UpPressed : Transition (State, State) {
    name = "UpPressed"
}
Association NonePressed : Transition (State, State) {
    name = "NonePressed"
}
Association DownPressed : Transition (State, State) {
    name = "DownPressed"
}
