Esempio n. 1
0
 public void EmptyCharsTest()
 {
     var alphabet = new Alphabet(new char[] { });
 }
Esempio n. 2
0
        public void ContainsFalseTest()
        {
            var alphabet = new Alphabet("ab");

            Assert.IsFalse(alphabet.Contains('c'));
        }
Esempio n. 3
0
        public void ContainsTrueTest()
        {
            var alphabet = new Alphabet("ab");

            Assert.IsTrue(alphabet.Contains('a'));
        }
Esempio n. 4
0
 public void NullCharsTest()
 {
     var alphabet = new Alphabet(null);
 }
Esempio n. 5
0
 /// <summary>
 /// Creates a new alphabet which is a union of two alphabets.
 /// </summary>
 /// <param name="a1">The first alphabet.</param>
 /// <param name="a2">The second alphabet.</param>
 /// <returns>A new alphabet which is a union of two alphabets.</returns>
 /// <remarks>This operation is not commutative.</remarks>
 public static Alphabet Union(Alphabet a1, Alphabet a2)
 => new Alphabet(a1.indices.Keys.Concat(a2.indices.Keys))
 {
     Name = $"{a1.Name} + {a2.Name}"
 };
Esempio n. 6
0
 /// <summary>
 /// Compates the equality of this alphabet to the other alphabet.
 /// </summary>
 /// <param name="other">The alphabet to compare to.</param>
 /// <returns>
 /// <c>true</c>, if this alphabet equals the other.
 /// Otherwise, <c>false</c>.
 /// </returns>
 public bool Equals(Alphabet other)
 => other != null && this.indices.Keys.SequenceEqual(other.indices.Keys);