Пример #1
0
        /// <summary>
        /// Gets an attributeList from a ParseTreeNode.
        /// </summary>
        /// <param name="aChildNode">The interesting ParseTreeNode.</param>
        /// <param name="myTypeManager">the typemanager</param>
        /// <returns>A Dictionary with attribute definitions.</returns>
        private Dictionary <AttributeDefinition, String> GetAttributeList(ParseTreeNode aChildNode)
        {
            #region Data

            var attributes = new Dictionary <AttributeDefinition, String>();

            #endregion

            foreach (ParseTreeNode aAttrDefNode in aChildNode.ChildNodes)
            {
                VertexTypeAttributeDefinitionNode aAttrDef = (VertexTypeAttributeDefinitionNode)aAttrDefNode.AstNode;
                if (aAttrDef.AttributeDefinition.DefaultValue != null)
                {
                    if (aAttrDef.AttributeDefinition.AttributeType.TypeCharacteristics == null)
                    {
                        aAttrDef.AttributeDefinition.AttributeType.TypeCharacteristics = new TypeCharacteristics();
                    }
                    aAttrDef.AttributeDefinition.AttributeType.TypeCharacteristics.IsMandatory = true;
                }

                if (attributes.Any(item => item.Key.AttributeName == aAttrDef.AttributeDefinition.AttributeName))
                {
                    throw new VertexAttributeAlreadyExistsException(aAttrDef.AttributeDefinition.AttributeName);
                }
                else
                {
                    attributes.Add(aAttrDef.AttributeDefinition, aAttrDef.AttributeDefinition.AttributeType.Name);
                }
            }

            return(attributes);
        }
Пример #2
0
        private void CreateVertexTypeAttributeDefinitionNode(ParsingContext context, ParseTreeNode parseNode)
        {
            VertexTypeAttributeDefinitionNode aCreateAttributeNode = new VertexTypeAttributeDefinitionNode();

            aCreateAttributeNode.Init(context, parseNode);

            parseNode.AstNode = aCreateAttributeNode;
        }