/// <summary> /// Returns a nine-character <c>String</c> representation of this <see cref="IntersectionMatrix" />. /// </summary> /// <returns> /// The nine dimension symbols of this <see cref="IntersectionMatrix" /> /// in row-major order. /// </returns> public override string ToString() { var buf = new StringBuilder("123456789"); for (int ai = 0; ai < 3; ai++) for (int bi = 0; bi < 3; bi++) buf[3 * ai + bi] = DimensionUtility.ToDimensionSymbol(_matrix[ai, bi]); return buf.ToString(); }
/// <summary> /// For each element in this <see cref="IntersectionMatrix" />, changes the /// element to the corresponding minimum dimension symbol if the element is /// less. /// </summary> /// <param name="minimumDimensionSymbols"> /// Nine dimension symbols with which to /// compare the elements of this <see cref="IntersectionMatrix" />. The /// order of dimension values from least to greatest is <c>Dontcare, True, False, 0, 1, 2</c>. /// </param> public void SetAtLeast(string minimumDimensionSymbols) { for (int i = 0; i < minimumDimensionSymbols.Length; i++) { int row = i / 3; int col = i % 3; SetAtLeast((Location)row, (Location)col, DimensionUtility.ToDimensionValue(minimumDimensionSymbols[i])); } }
/// <summary> /// Changes the elements of this <see cref="IntersectionMatrix" /> to the /// dimension symbols in <c>dimensionSymbols</c>. /// </summary> /// <param name="dimensionSymbols"> /// Nine dimension symbols to which to set this <see cref="IntersectionMatrix" /> /// s elements. Possible values are <c>{T, F, * , 0, 1, 2}</c> /// </param> public void Set(string dimensionSymbols) { for (int i = 0; i < dimensionSymbols.Length; i++) { int row = i / 3; int col = i % 3; _matrix[row, col] = DimensionUtility.ToDimensionValue(dimensionSymbols[i]); } }