Datatype timestamp |
Post Reply |
Author | |
Tinhinane
Member Joined: 16.Mar.2018 Points: 4 |
Post Options
Thanks(0)
Posted: 20.Mar.2018 at 20:35 |
I have an object of type Button, with a state (boolean) property and a time (timestamp) property. I would like to make the timeproperty update everytime I change the state of a button in the MetaEdit+ Editor (Meaning on a model). Is that possible?
The purpose behind this is to say: I press button A at time X and then I press button B at time X`. Is this possible on MetaEdit+? |
|
stevek
MetaCase Joined: 11.Mar.2008 Points: 641 |
Post Options
Thanks(0)
|
If you mean that you make a Button object A, and then make a Button object B, then yes, the Creation Timestamp property in B will be later than that in A.
That fits with your first and third sentences, but I'm having trouble understanding what you mean in your second sentence. The time that you make a change while modeling has no connection to the time which that model element represents in the real world. You could draw B first and then A, or A first then B, and that wouldn't say anything about which button is pressed first in the real world. The real world ordering could be expressed by something like a state machine - see the Digital Watch project for an example. The Creation Timestamp tells you the time of a modeling operation - the creation of that model element - and you thus can't give it a value manually. If what you want to record is a time related to the real world, don't use Creation Timestamp, just use a simple String property, or maybe a Number if you just need a value in seconds. With those, you can enter whatever values you want, and change them as you like.
|
|
Tinhinane
Member Joined: 16.Mar.2018 Points: 4 |
Post Options
Thanks(0)
|
I see. The goal is actually to express the intended behavior of a system, say for example a LED will be ON only if I first press button A and then I press button B. I don't want to use state machines, because I want my DSL to be used by users with limited knowledge about that.
The issue with giving just a property as a number is that the user can enter any value, doesn't mean it will really be a time. Is there any other way than that in MetaEdit+? |
|
stevek
MetaCase Joined: 11.Mar.2008 Points: 641 |
Post Options
Thanks(0)
|
Sure - you can specify a regular expression for the String property type, to make it comply with whatever time syntax you had in mind. (Or, as I mentioned, use a Number property to express seconds - or whatever time unit you prefer - as an integer or decimal.)
Your "first press A then B to light the LED" reminds me of Martin Fowler's Gothic castle DSL, which was also a state machine - although as you'll see from my blog, it can be expressed in a way that makes it easy for a domain expert to use, without knowing anything about state models. Edited by stevek - 21.Mar.2018 at 08:58 |
|
Tinhinane
Member Joined: 16.Mar.2018 Points: 4 |
Post Options
Thanks(0)
|
Thank you, that answers my question!
|
|
Post Reply | |
Tweet |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |