The command
Split Model can be used to create new classes in
several ways.
You can:
- Create a submodel from selected objects
- Create a base class from selected objects
- Create a model and copy the selected objects to that model
The starting point here is a class (often a model) containing
components. Compared to creating an empty class (using the
New Class command), this can be seen as creating
a class from a selection of objects (even a single object).
Submodels are useful to group components in a complex model, making
the model easier to understand. The grouped components (and related parameters
and connections, if so selected), are moved to a new class. That class is then
instantiated to replace the components in the original class. Connections to
the outside of that component are restored. (Connectors are automatically added
in the submodel.) Submodels can be made public for reuse, and inserted in other
classes than the original class. Submodels are always of class type model.
Base classes are useful to reuse classes. The grouped components (and
related parameters and connections, if so selected), are moved to a new base
class. That class is extended by an extends clause into the original class.
Connections to the components of the original class are restored. Base classes
created this way can only be created as public. They can be inserted in other
packages than the original one. They can also be made partial. Base classes
inherit the type of the selected components.
Copy to a new model leaves the selected objects and the enclosing
class untouched; the selected objects are copied to a new model. This is useful
when you want to use the selected objects as a starting point rather than for
resuse. The new model can be made partial.
To split a model, see
Splitting a Model.