Skip to content

Coevolution

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

Attributes

When an attribute definition is changed (like changing type in M2) the values of instances of that attribute in M1 will change accordingly to comply with the new type.

Type Legenda:
Type category Primitive types
integer byte, short, int, long
decimal double, float
number integer, decimal
Type conversion rules:
Number bound reminder:
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
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