| Summary: | API for cloning a model | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Nepomuk Seiler <nepomuk.seiler> |
| Component: | Sapphire | Assignee: | Konstantin Komissarchik <konstantin> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | konstantin, shenxue.zhou |
| Version: | unspecified | Keywords: | plan |
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Nepomuk Seiler
Enhancement implemented. See IModelElement.copy( [IModelElement] ) method. Unit tests in TestModelingMisc0012. Please verify.
Usage examples (from 0.4 enhancements guide):
In this example, the copy method is used to duplicate the entities held in a list property.
ModelElementList<Entity> entities = model.getEntities();
for( int i = 0, n = entities.size; i < n; i++ )
{
final Entity original = entities.get( i );
final Entity duplicate = entities.addNewElement();
duplicate.copy( original );
}
Here, an entire model is copied to a memory resource. Perhaps the original model instance was loaded from disk via an XML resource.
Model original = ...
Model duplicate = Model.TYPE.instantiate();
duplicate.copy( original );
I've used IModelElement.copy() method. Closing. Since you are a committer, you can mark the bug as closed when verifying, without going through the verified status. |