Exemplo n.º 1
0
        public void ClearChildren(NodeChildrenType? newChildrenType = null)
        {
            m_ChildLines.Clear();
            m_ChildNodes.Clear();

            if (newChildrenType != null) ChildNodeType = (NodeChildrenType)newChildrenType;
        }
Exemplo n.º 2
0
 private void EnsureProperType(NodeChildrenType expectedType)
 {
     if (ChildNodeType != expectedType)
     {
         if (ChildNodes.Count == 0)
             ChildNodeType = expectedType;
         else
             throw new InvalidOperationException($"can't get child from this node. Expected type was {expectedType}, but node children are of type {ChildNodeType}");
     }
 }
Exemplo n.º 3
0
        private void EnsureProperChildType(NodeChildrenType expectedType)
        {
            if (expectedType != NodeChildrenType.multiLineString && !this.Value.IsNullOrEmpty())
            {
                throw new Exception($"node has a value ({Value}), which means it can't have children");
            }

            if (ChildNodeType != expectedType)
            {
                if (ChildNodes.Count == 0)
                {
                    ChildNodeType = expectedType;
                }
                else
                {
                    throw new InvalidOperationException($"can't get child from this node. Expected type was {expectedType}, but node children are of type {ChildNodeType}");
                }
            }
        }