Implementing states
When you want to write a process that passes through one or more states it is good practice to have one action per state. For example:
action inAuction() {
on AuctionClosed outOfAuction();
}
action outOfAuction() {
on all Price (stock,*):p and not InAuction() {
on Price(stock,>p.price*1.01) and not InAuction() {
sellStock();
}
}
on InAuction() inAuction();
}