Default "value" attribute is a great idea.
I have been thinking about how to express the values for attributes.
As you can see in the example I have used named parameters.
enum WindSpeed {
int beaufortNumber;
double minMps;
double maxMps;
CALM(beaufortNumber="1",
minMps="0",
maxMps="0.2"),
STORM(beaufortNumber="10",
minMps="24.5",
maxMps="28.4"),
HURRICAN(beaufortNumber="12",
minMps="32.7",
maxMps="40.8");
}
An alternative, which is closer to java syntax, is to use ordered parameters
(like constructor parameters).
enum WindSpeed {
int beaufortNumber;
double minMps;
double maxMps;
CALM("1", "0", "0.2"),
STORM("10", "24.5", "28.4"),
HURRICAN("12", "32.7", "40.8");
}
I'm not sure if it will be possible to get rid of the string quotes "" (it
is not string attributes). Depends on possibilities in xtext. I will have to
try that out.
Another feature that maybe could be useful is that instead of defining the
enum values in the DSL you can define the type and then refer to a manually
coded enum, which can be complex.
enum WindSpeed {
class="org.mycomp.util.WindSpeed"
}
/Patrik
--
View this message in context:
http://www.nabble.com/Enums-tp13922588s17564p14431728.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer