Example #1
0
 /// <summary>
 /// Adds one matrix to another.
 /// Addition is defined by taking the maximum dimension value of each position
 /// in the summand matrices.
 /// </summary>
 /// <param name="im">The matrix to add.</param>
 public void Add(IntersectionMatrix im)
 {
     for (int i = 0; i < 3; i++)
     {
         for (int j = 0; j < 3; j++)
         {
             SetAtLeast((Location)i, (Location)j, im.Get((Location)i, (Location)j));
         }
     }
 }
Example #2
0
 /// <summary>
 /// Creates an <see cref="IntersectionMatrix" /> with the same elements as
 /// <c>other</c>.
 /// </summary>
 /// <param name="other">An <see cref="IntersectionMatrix" /> to copy.</param>
 public IntersectionMatrix(IntersectionMatrix other)
     : this()
 {
     _matrix[(int)Location.Interior, (int)Location.Interior] = other._matrix[(int)Location.Interior, (int)Location.Interior];
     _matrix[(int)Location.Interior, (int)Location.Boundary] = other._matrix[(int)Location.Interior, (int)Location.Boundary];
     _matrix[(int)Location.Interior, (int)Location.Exterior] = other._matrix[(int)Location.Interior, (int)Location.Exterior];
     _matrix[(int)Location.Boundary, (int)Location.Interior] = other._matrix[(int)Location.Boundary, (int)Location.Interior];
     _matrix[(int)Location.Boundary, (int)Location.Boundary] = other._matrix[(int)Location.Boundary, (int)Location.Boundary];
     _matrix[(int)Location.Boundary, (int)Location.Exterior] = other._matrix[(int)Location.Boundary, (int)Location.Exterior];
     _matrix[(int)Location.Exterior, (int)Location.Interior] = other._matrix[(int)Location.Exterior, (int)Location.Interior];
     _matrix[(int)Location.Exterior, (int)Location.Boundary] = other._matrix[(int)Location.Exterior, (int)Location.Boundary];
     _matrix[(int)Location.Exterior, (int)Location.Exterior] = other._matrix[(int)Location.Exterior, (int)Location.Exterior];
 }
Example #3
0
        /// <summary>
        /// Tests if each of the actual dimension symbols in a matrix string satisfies the
        /// corresponding required dimension symbol in a pattern string.
        /// </summary>
        /// <param name="actualDimensionSymbols">
        /// Nine dimension symbols to validate.
        /// Possible values are <c>T, F, * , 0, 1, 2</c>.
        /// </param>
        /// <param name="requiredDimensionSymbols">
        /// Nine dimension symbols to validate
        /// against. Possible values are <c>T, F, * , 0, 1, 2</c>.
        /// </param>
        /// <returns>
        /// <c>true</c> if each of the required dimension
        /// symbols encompass the corresponding actual dimension symbol.
        /// </returns>
        public static bool Matches(string actualDimensionSymbols, string requiredDimensionSymbols)
        {
            var m = new IntersectionMatrix(actualDimensionSymbols);

            return(m.Matches(requiredDimensionSymbols));
        }