|
Re: Change Property [message #1700551 is a reply to message #1700540] |
Fri, 03 July 2015 13:40 |
|
Hi, Markus,
If you have a class named "MyConfiguration" with attributes like, say,
+ aReal : Real
+ anotherReal : Real
+ anInteger : Integer
etc.
and a class Foo that has a property like
+ configuration : MyConfiguration
then Foo::configuration can have a defaultValue that is an
InstanceValue referencing an InstanceSpecification in which:
* MyConfiguration is a classifier of the instance spec
* the instance spec has a Slot for each of the properties of
MyConfiguration for which
you want it to provide a value
* each slot of the InstanceSpecification has an appropriate value
specification, such
as LiteralReal, LiteralInteger, even more InstanceValues for
properties of class type
The instance specification would be defined in the same package as the
Foo class.
I'm going out on a limb guessing at what you're actually trying to do.
You may need to be more specific in the description of your problem.
HTH,
Christian
On 2015-07-03 12:07:17 +0000, Markus Schuss said:
> Hi,
>
> I created a class which has a property called configuration (with a
> couple of reals, integers and so on as I cannot assign them to the
> class directly it seems) which represent the default parameters for
> that class.
> Next I created a second class which has a property of that class type
> and now I want to change the configuration (basically calling the
> constructor with different values than the default ones).
> Could anyone explain to me how because I can't seem to figure that one out.
>
> Thanks in advance
> Markus
|
|
|
|
Re: Change Property [message #1700680 is a reply to message #1700638] |
Mon, 06 July 2015 12:35 |
|
Hi, Markus,
Okay, that sounds like something different.
A subclass can redefine an inherited to property to change various of
its attributes, including type, multiplicity, derivedness, and also the
default value.
So, if class Foo has an attribute myConfig of type MyConfiguration, a
subclass SubFoo having a generalization relationship to Foo can define
an attribute myConfig that redefines Foo::myConfig (actually
referencing it in the 'redefines' table in the property sheet). Then
SubFoo::myConfig can define its own defaultValue that supersedes the
inherited defaultValue.
HTH,
Christian
On 2015-07-06 05:04:59 +0000, Markus Schuss said:
> Thanks for your reply,
>
> My main problem is that the class Foo as well as MyConfiguration would
> reside in a read only library (from a plugin). I merely create a class
> which then has a property of type Foo (which then has a property
> configuration) which I can't seem to change anything of (since read
> only). My main question was if there is a way to overwrite a
> defaultValue (maybe that is what you are trying to explain, if so I may
> not have understood you properly, sorry).
>
> Thanks in advance
> Markus
|
|
|
Powered by
FUDForum. Page generated in 0.02107 seconds