Beispiel #1
0
 /// <summary>
 /// Derives the properties values from the <paramref name="source" />.
 /// </summary>
 /// <param name="source">The source to get values from if not defined.</param>
 protected override void CopyPropertyValuesFrom(IInstanceDesign source)
 {
     base.CopyPropertyValuesFrom(source);
     if (this.ReferenceType.IsNull || this.ReferenceType.NameIsBasedOnDefault)
     {
         this.ReferenceType.UpdateNameAndNamespaceBasedOn(source.ReferenceType);
     }
     if (this.Declaration.IsNull || this.Declaration.NameIsBasedOnDefault)
     {
         this.Declaration.UpdateNameAndNamespaceBasedOn(source.Declaration);
     }
     if (this.TypeDefinition.IsNull || this.TypeDefinition.NameIsBasedOnDefault)
     {
         this.TypeDefinition.UpdateNameAndNamespaceBasedOn(source.TypeDefinition);
     }
     if (this.ModellingRule == null)
     {
         this.ModellingRule = source.ModellingRule;
     }
     if (this.MinCardinality == 0) //by default it is 0
     {
         this.MinCardinality = source.MinCardinality;
     }
     if (this.MaxCardinality == 0) //by default it is 0
     {
         this.MaxCardinality = source.MaxCardinality;
     }
     if (!this.PreserveDefaultAttributes) //by default it is false
     {
         this.PreserveDefaultAttributes = source.PreserveDefaultAttributes;
     }
 }
Beispiel #2
0
        /// <summary>
        /// Creates a new instance and derive property values from current object and the source <paramref name="source" />.
        /// </summary>
        /// <param name="source">The source model node - from which we want to derive values.</param>
        /// <returns>created new instance node of the model that derived data from this instance node and node passed as the source <paramref name="source" /></returns>
        public IInstanceDesign DerivePropertyValuesFrom(IInstanceDesign source)
        {
            InstanceDesign <T> ret = CreateNewInstance();

            ret.CopyPropertyValuesFrom(this);
            if (source != null)
            {
                ret.CopyPropertyValuesFrom(source);
            }
            return(ret);
        }
Beispiel #3
0
 private void Initialize(AddressSpaceCompiler addressSpaceCompiler, IInstanceNode node, XmlQualifiedName nodeID, bool isInstanceDeclaration, int?parentAddressSpaceIndex)
 {
     Debug.Assert(node != null, "Parameter error at AddressSpaceNode creator: node cannot be null");
     Debug.Assert(nodeID != null, "NodeID cannot be null");
     ErrorList                 = new List <Diagnostics>();
     m_References              = new InstanceReferencesCollection(this);
     m_Compiler                = addressSpaceCompiler;
     m_IsInstanceDeclaration   = isInstanceDeclaration;
     m_ParentAddressSpaceIndex = parentAddressSpaceIndex;
     m_Node            = node;
     m_NodeID          = nodeID;
     AddressSpaceIndex = m_Compiler.AddNode2AddressSpace(this, m_NodeID.ToString());
     InstanceWrapper   = m_Node.DerivePropertyValuesFrom(null);
 }
Beispiel #4
0
 /// <summary>
 /// Derives the properties values from the <paramref name="source"/>.
 /// </summary>
 /// <param name="source">The source to get values from if not defined.</param>
 /// <exception cref="System.ArgumentNullException">source</exception>
 protected virtual void CopyPropertyValuesFrom(IInstanceDesign source)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     if (string.IsNullOrEmpty(this.BrowseName))
     {
         this.BrowseName = source.BrowseName;
     }
     if (this.DisplayName.IsEmpty())
     {
         this.DisplayName.UpdateBaseOnOtherLocalizedText(source.DisplayName);
     }
     if (this.Description.IsEmpty())
     {
         this.Description.UpdateBaseOnOtherLocalizedText(source.Description);
     }
     if (this.SymbolicName.IsNull || this.SymbolicName.NameIsBasedOnDefault)
     {
         this.SymbolicName.UpdateNameAndNamespaceBasedOn(source.SymbolicName);
     }
     if (this.SymbolicId.IsNull || this.SymbolicName.NameIsBasedOnDefault)
     {
         this.SymbolicId.UpdateNameAndNamespaceBasedOn(source.SymbolicId);
     }
     if (!this.IsDeclaration) // by default this is false;
     {
         this.IsDeclaration = source.IsDeclaration;
     }
     if (string.IsNullOrEmpty(this.StringId))
     {
         this.StringId = source.StringId;
     }
     if (WriteAccess == 0) // by default this is 0;
     {
         this.WriteAccess = source.WriteAccess;
     }
     if (!NumericIdSpecified)
     {
         this.NumericId          = source.NumericId;
         this.NumericIdSpecified = source.NumericIdSpecified;
     }
 }
Beispiel #5
0
 IInstanceDesign IInstanceNode.DerivePropertyValuesFrom(IInstanceDesign source)
 {
     return(this.Wrapper.DerivePropertyValuesFrom(source));
 }