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

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

            Assert.IsTrue(alphabet.Contains('a'));
        }
Exemplo n.º 4
0
 public void NullCharsTest()
 {
     var alphabet = new Alphabet(null);
 }
Exemplo 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}"
 };
Exemplo 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);