[XCORE] How To Design Question: How to model extensible single instances [message #1398737] |
Fri, 11 July 2014 14:01 |
xjn Mising name Messages: 20 Registered: May 2010 |
Junior Member |
|
|
Hi,
i have the following design problem using EMF and/or XCore.
In plain Java it's easy, but i'd like to give EMF/XCore a try
for this.
--
I have an abstract base class : class AbstractDecoderProtocol
I have a (unknown) number of plugins extending
AbstractDecoderProtocol, lets assume :
- plugin "NB" provides
-- DecoderProtocolNB extending AbstractDecoderProtocol
and
- pluging "NX" provides
-- DecoderProtocolN1 extending AbstractDecoderProtocol
-- DecoderProtocolN2 extending AbstractDecoderProtocol
and
- pluging "M1" provides
-- DecoderProtocolM1 extending AbstractDecoderProtocol
But there should be only one available instance for
- DecoderProtocolNB
- DecoderProtocolN1
- DecoderProtocolN2
- DecoderProtocolM1
as if they were Enums.
I don't have any idea how to model this with EMF/XCore ...
Any idea/help welcome
thx
br
xjn
|
|
|
|
Re: [XCORE] How To Design Question: How to model extensible single instances [message #1398768 is a reply to message #1398745] |
Fri, 11 July 2014 14:59 |
xjn Mising name Messages: 20 Registered: May 2010 |
Junior Member |
|
|
Ed,
yes, i want to model Singletons.
I've already modeled Singleton's in 'asm', in 'C', in 'Java', etc.
---
Singletons, especially extensible Singletons, are all around in real
World.
---
There is a "Car-Type", is a "VW", is a "VW-Golf", is a "VW-Golf-V", is a ...
All these are Singleton Enum's, but with derived properties and derived op's.
---
There is one Singleton "VW-Golf-V"-model, but many bought instances ...
I don't have any idea how to model this ...
br
xjn
|
|
|
Re: [XCORE] How To Design Question: How to model extensible single instances [message #1398786 is a reply to message #1398768] |
Fri, 11 July 2014 15:36 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Comments below.
On 11/07/2014 4:59 PM, xjn Mising name wrote:
> Ed,
>
> yes, i want to model Singletons.
>
> I've already modeled Singleton's in 'asm', in 'C', in 'Java', etc.
You've implemented it.
>
> ---
>
> Singletons, especially extensible Singletons, are all around in real
> World.
Yes and you can implement them in pretty much any language.
> ---
>
> There is a "Car-Type", is a "VW", is a "VW-Golf", is a "VW-Golf-V", is
> a ...
>
> All these are Singleton Enum's, but with derived properties and
> derived op's.
>
> ---
>
> There is one Singleton "VW-Golf-V"-model, but many bought instances ...
>
> I don't have any idea how to model this ...
As I said, this is not an appropriate domain in which to model. Some
things are best done in Java. Xcore doesn't aim to replace Java, it
aims to be better (less verbose and more flexible) at certain types of
things than Java and to integrate well with Java. In the end Xcore
maps onto Ecore and there is no such concept as a singleton so you can't
model it (with Ecore).
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02969 seconds