Пример #1
0
 public override void In(FlowScriptEngine.FlowEventArgs e)
 {
     SetArray();
     if (Array != null)
     {
         SetValue(nameof(Items));
         SetValue(nameof(StartIndex));
         SetValue(nameof(Length));
         var comparer = new CallbackComparer((x, y) =>
         {
             X = x;
             Y = y;
             FireEvent(Compare, true);
             ProcessChildEvent();
             SetValue(nameof(Result));
             return(Result);
         });
         System.Array.Sort(Array, Items, StartIndex, Length, comparer);
         OnSuccess();
     }
     else
     {
         OnFailed();
     }
 }
Пример #2
0
 public override void In(FlowScriptEngine.FlowEventArgs e)
 {
     SetArrayList();
     if (ArrayList != null)
     {
         SetValue(nameof(Value));
         SetValue(nameof(StartIndex));
         SetValue(nameof(Count));
         var comparer = new CallbackComparer((x, y) =>
         {
             X = x;
             Y = y;
             FireEvent(Compare, true);
             ProcessChildEvent();
             SetValue(nameof(Result));
             return(Result);
         });
         FoundIndex = ArrayList.BinarySearch(StartIndex, Count, Value, comparer);
         OnSuccess();
     }
     else
     {
         OnFailed();
     }
 }
Пример #3
0
                public void WithComparer_Should_ComputeSameHashCodeAsWithExplicitOrderedItems()
                {
                    var builder1 = new global::HashCode.Builder();
                    var builder2 = new global::HashCode.Builder();
                    var comparer = new CallbackComparer <int>((x, y) => (x == y ? 0 : (x < y) ? -1 : +1));

                    // Act
                    builder1.AddIgnoreOrder(comparer, 2, 1);
                    builder2.Add(1, 2);

                    // Assert
                    builder1.Build().Should().Be(builder2.Build());
                }
Пример #4
0
                public void WithEqualityComparerReturningTheArgumentIntegerValuesModulusByTwoAndAndWithComparer_Should_ComputeTheSameHashCode()
                {
                    var builder1         = new global::HashCode.Builder();
                    var builder2         = new global::HashCode.Builder();
                    var equalityComparer = new CallbackEqualityComparer <int>((x, y) => true, (obj) => obj % 2);
                    var comparer         = new CallbackComparer <int>((x, y) => (x == y ? 0 : (x < y) ? -1 : +1));

                    // Act
                    builder1.AddIgnoreOrder(equalityComparer, comparer, 4, 3);
                    builder2.Add(equalityComparer, 1, 2);

                    // Assert
                    builder1.Build().Should().Be(builder2.Build());
                }
Пример #5
0
 public override void In(FlowScriptEngine.FlowEventArgs e)
 {
     SetArrayList();
     if (ArrayList != null)
     {
         var comparer = new CallbackComparer((x, y) =>
         {
             X = x;
             Y = y;
             FireEvent(Compare, true);
             ProcessChildEvent();
             SetValue(nameof(Result));
             return(Result);
         });
         ArrayList.Sort(comparer);
         OnSuccess();
     }
     else
     {
         OnFailed();
     }
 }