Пример #1
0
        public void TestPermutation_TwoSubstituents()
        {
            PermutationParity p = Permutation(new int[] { 1, 2, 0 });

            Assert.IsTrue(p is BasicPermutationParity);
            FieldInfo field = p.GetType().GetField("indices", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 1, 2 }, (int[])field.GetValue(p)));
        }
Пример #2
0
 /// <summary>
 /// Create a new encoder for multiple stereo centres (specified as an array).
 /// </summary>
 /// <param name="centres">the stereo centres which will be configured</param>
 /// <param name="permutation">calculator for permutation parity</param>
 /// <param name="geometric">geometric calculator</param>
 /// <exception cref="ArgumentException">if the centres[] were empty</exception>
 public GeometryEncoder(int[] centres, PermutationParity permutation, GeometricParity geometric)
 {
     if (centres.Length == 0)
     {
         throw new ArgumentException("no centres[] provided");
     }
     this.permutation = permutation;
     this.geometric   = geometric;
     this.centres     = new int[centres.Length];
     Array.Copy(centres, this.centres, centres.Length);
 }
Пример #3
0
 /// <summary>
 /// Convenience method to create a new encoder for a single stereo centre.
 /// </summary>
 /// <param name="centre">a stereo centre which will be configured</param>
 /// <param name="permutation">calculator for permutation parity</param>
 /// <param name="geometric">geometric calculator</param>
 /// <exception cref="ArgumentException">if the centres[] were empty</exception>
 public GeometryEncoder(int centre, PermutationParity permutation, GeometricParity geometric)
     : this(new int[] { centre }, permutation, geometric)
 {
 }