Ejemplo n.º 1
0
        /// <summary>
        /// Adds an new word in the referential
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="kind">The kind.</param>
        /// <param name="multiplicity">The multiplicity.</param>
        /// <param name="types">The types.</param>
        /// <returns></returns>
        public WordItem Add(string text, KindEnum kind, MultiplicityEnum multiplicity, params string[] types)
        {
            Assert.NotEmpty(text, "text");
            Assert.Ensure(types.Length > 0, () => new ArgumentOutOfRangeException("types can't be empty"));

            List <WordType> _types = new List <WordType>();

            foreach (var item in types)
            {
                this.Types.Resolve(item.Trim());
            }

            WordItem w = new WordItem()
            {
                Text         = text.Trim(),
                Kind         = kind,
                Multiplicity = multiplicity,
                Types        = _types,
            };

            this._items.Add(w);

            return(w);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EvaluatedWord"/> class.
        /// </summary>
        /// <param name="item">The item.</param>
        public EvaluatedWord(WordItem item)
        {
            Assert.NotNull(item, "item");

            this.Item = item;
        }