Skip to content

Coevolution

Damiano Di Vincenzo edited this page Jun 15, 2024 · 7 revisions

Attributes

When a structural feature (attribute, reference, operation) definition is changed (like changing his type in M2) the values of his instances in M1 will change accordingly to comply with the new definition.

Upperbound

The exceeding values are hidden without data loss, and completely unavailable until the upperbound is raised again.

Lowerbound

The missing values are filled with default values.

Operation Type conversion rules:

Since operations cannot have instances, the model is unaffected.

Reference Type conversion rules:

All values pointing to objects which conform to the new type, including subclasses, are kept. All the invalid values are "hidden" and unavailable without data loss until the reference type is changed back.

Advanced: How "no data loss" works:

Every time a DValue object is asked for his value array (eg: data.values), it does not return his real persistent shape, but it will return a copy where all invalid values are omitted, and all missing values are inserted, while keeping the original persistent value array unchanged. In the background, the persistent value array is always exactly what the user last specified, and an item is deleted or inserted only if the user explicitly removes it. This way, when queried, the DValue will always respond with a cleaned and always valid projection of the original "dirty" value collection, which never loses the original user input. The only way to see the original shape of a value array is through data.__raw.values

Attribute Type conversion rules:

Type Legenda:
Type category Primitive types
integer byte, short, int, long
decimal double, float
number integer, decimal
From To Operation
anything string The new value is the string representation of the old value
anything char The new value is the first char of the string representation of the old value
string number The new value is the first number found inside the string, then bound to the number type valid value range
decimal integer The value is truncated (round toward 0), then bound to the new type valid value range
number_1 number_2 The value is undersized to the maximum valid value for number_2 if it was exceeding it and downsized to the mimimum valid value for number_2 if it was below the minumum value
any other The value is transformed as if it becomes a string, then it is converted to the target type
Number bound reminder:
Type Lower limit Upper limit
byte -128 +127
short -32'768 +32'767
int -2'147'483'648 +2'147'483'647
long -9'223'372'036'854'775'808 +9'223'372'036'854'775'807
Default values

When a type conversion is not possible at all (such as a string without numbers being converted to an int), the value is resetted to the default value. Default values are true for boolean, the empty string for string, 0 for any numeric type.

References

If the container class have M1-instances with references linked, those M1-links that are now invalid will be deleted.
A valid value for a reference is an object that is the same class of the reference type or a subclass of it.\

Inheritance, inserting a feature, removing a feature.

Any new element acquired either by direct insertion or by acquired inheritance will create a new value inside the instances with default value. Any removed element lost either by direct elimination or by a deleted inheritance relationship will remove the related field and values in all the instances.

Type conversion

Instances can be converted to a new class type, either individually (from M1 context-menù) or all of them at the same time (from M2 context-menù)

Converting all instances of a class from M2
type convert m2

Converting a single instance from M1
type convert m1

An object can currently only be converted into a subclass or a superclass of his current type.
The "Best match" is the convertable class with the least missing features or the least exceeding features, the one resembles the current schema the most, giving priority to not losing features over adding new ones.
For each possible new type the editor will tell you woh much features the instance will gain or lose in the conversion.

NB: Despite looking small, the Admin class is the one with most features since it is inheriting from Moderator that is inheriting from User, that's why the conversion tooltip in this example only lists gained features.

Clone this wiki locally