MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Datatype timestamp
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Datatype timestamp

 Post Reply Post Reply
Author
Message
Tinhinane View Drop Down
Member
Member


Joined: 16.Mar.2018
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tinhinane Quote  Post ReplyReply Direct Link To This Post Topic: Datatype timestamp
    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+?
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 641
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 20.Mar.2018 at 21:00
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.
Back to Top
Tinhinane View Drop Down
Member
Member


Joined: 16.Mar.2018
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tinhinane Quote  Post ReplyReply Direct Link To This Post Posted: 20.Mar.2018 at 21:21
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+?
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 641
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 20.Mar.2018 at 22:33
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
Back to Top
Tinhinane View Drop Down
Member
Member


Joined: 16.Mar.2018
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tinhinane Quote  Post ReplyReply Direct Link To This Post Posted: 21.Mar.2018 at 18:22
Thank you, that answers my question!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.063 seconds.