Пример #1
0
        /// <summary>
        /// Gets the <see cref="Element" /> with the specified label.
        /// </summary>
        /// <value>
        /// The first <see cref="Element" /> with specifid <see cref="label" />.
        /// </value>
        /// <param name="label">The label.</param>
        /// <returns>
        /// The first <see cref="Element" /> with specifid <see cref="label" />
        /// </returns>
        /// <exception cref="System.Collections.Generic.KeyNotFoundException">If <see cref="Element" /> with <see cref="label" /> not exists</exception>
        public Element this[string label]
        {
            get
            {
                var cmp = new FemNetStringCompairer();

                var cleanLabel = FemNetStringCompairer.Clean(label);

                foreach (var elm in _list)
                {
                    if (cmp.Equals(cleanLabel, elm.Label))
                    {
                        return(elm);
                    }
                }

                throw new KeyNotFoundException("label");
            }
        }
Пример #2
0
        /// <summary>
        /// Determines whether the specified <see cref="label"/> is valid for new <see cref="StructurePart"/> or not.
        /// </summary>
        /// <param name="label">The label.</param>
        /// <returns>yes if is valid, otherwise no</returns>
        internal bool IsValidLabel(string label)
        {
            foreach (var elm in elements)
            {
                if (FemNetStringCompairer.IsEqual(elm.Label, label))
                {
                    return(false);
                }
            }


            foreach (var nde in nodes)
            {
                if (FemNetStringCompairer.IsEqual(nde.Label, label))
                {
                    return(false);
                }
            }


            return(true);
        }
Пример #3
0
 /// <summary>
 /// Determines whether the specified objects are equal.
 /// </summary>
 /// <param name="x">The first object of type <paramref name="T" /> to compare.</param>
 /// <param name="y">The second object of type <paramref name="T" /> to compare.</param>
 /// <returns>
 /// true if the specified objects are equal; otherwise, false.
 /// </returns>
 /// <exception cref="System.NotImplementedException"></exception>
 public bool Equals(string x, string y)
 {
     return(FemNetStringCompairer.IsEqual(x, y));
 }