public AbstractionModel(AbstractionModel source = null) { if (source != null) { CloneFrom(source); } }
/// <summary> /// Replaces the contents of this node with that of another source. Note: This is destructive, and will set the destination with the default values found in the source. /// </summary> /// <param name="source"></param> public void CloneFrom(AbstractionModel source) { if (source == null) { return; } Type = source.Type; FullType = source.FullType; _documentation = source._documentation; SourceCode = source.SourceCode; CodeFilePath = source.GetCodeFilePath(); _portsById.Clear(); _implementedPorts.Clear(); foreach (var pair in source._implementedPorts) { var port = pair.Value; AddImplementedPort(port.Type, port.Name, port.IsReversePort, port.Description); AddPortGenericIndices(port.Name, source.GetPortGenericIndices(port.Name)); } _acceptedPorts.Clear(); foreach (var pair in source._acceptedPorts) { var port = pair.Value; AddAcceptedPort(port.Type, port.Name, port.IsReversePort, port.Description); AddPortGenericIndices(port.Name, source.GetPortGenericIndices(port.Name)); } ReplaceDict(source._fields, _fields); ReplaceDict(source._constructorArgs, _constructorArgs); ReplaceDict(source._properties, _properties); ReplaceDict(source._types, _types); ReplaceDict(source._memberDocumentation, _memberDocumentation); _initialised = source._initialised.ToHashSet(); SetValue("InstanceName", "", false); SetGenerics(source.GetGenerics()); }