public override int CalculateHash(HashCalculator calc)
 {
     return HashCalculator.Combine(
     GetType().GetHashCode(),
     calc.Calculate(_from),
     calc.Calculate(_to));
 }
 public override int CalculateHash(HashCalculator calc)
 {
     return HashCalculator.Combine(
     GetType().GetHashCode(),
     _preventCombatOnly.GetHashCode(),
     calc.Calculate(_source));
 }
 public override int CalculateHash(HashCalculator calc)
 {
     return HashCalculator.Combine(
     GetType().GetHashCode(),
     _amount.Value,
     calc.Calculate((IHashable)_creatureOrPlayer));
 }
Beispiel #4
0
 public int CalculateHash(HashCalculator calc)
 {
     return HashCalculator.Combine(
     Step.GetHashCode(),
     TurnCount,
     State.GetHashCode()
     );
 }
Beispiel #5
0
        public int CalculateHash(HashCalculator calc)
        {
            var hashable = _value as IHashable;

            return(hashable != null
        ? calc.Calculate(hashable)
        : _value.GetHashCode());
        }
        public void Calculate()
        {
            var hashcode1 = new HashCalculator().Calculate(new Car(3));
              var hashcode2 = new HashCalculator().Calculate(new Car(4));
              var hashcode3 = new HashCalculator().Calculate(new Car(4));

              Assert.NotEqual(hashcode1, hashcode2);
              Assert.Equal(hashcode2, hashcode3);
        }
        public void Cache()
        {
            var calculator = new HashCalculator();
              var obj = new Country();

              var hashcode1 = calculator.Calculate(obj);
              var hashcode2 = calculator.Calculate(obj);

              Assert.Equal(hashcode1, hashcode2);
        }
Beispiel #8
0
        public int CalculateHash(HashCalculator calc)
        {
            var hashcodes = new List <int>();

            foreach (var item in _items.Keys)
            {
                var hashable = item as IHashable;
                hashcodes.Add(hashable != null ? hashable.CalculateHash(calc) : item.GetHashCode());
            }

            return(HashCalculator.CombineCommutative(hashcodes));
        }
Beispiel #9
0
        public void HashOfCopyShouldNotChange2()
        {
            var mountain = C("Mountain");
              Hand(P1, mountain);

              var calc = new HashCalculator();

              var cardCopy = new CopyService().CopyRoot(C(mountain));

              var originalHash = calc.Calculate(C(mountain));
              var copyHash = calc.Calculate(cardCopy);

              Assert.Equal(originalHash, copyHash);
        }
 public int CalculateHash(HashCalculator calc)
 {
     return HashCalculator.Combine(Wheels.Select(calc.Calculate));
 }
Beispiel #11
0
 public int CalculateHash(HashCalculator calc)
 {
     return HashCalculator.Combine(
     calc.Calculate(Card),
     DamageAssignmentOrder,
     calc.Calculate(_assignedDamage));
 }
Beispiel #12
0
 public int CalculateHash(HashCalculator calc)
 {
     return 0;
 }
Beispiel #13
0
 public int CalculateHash(HashCalculator calc)
 {
     return HashCalculator.Combine(
     _value.GetHashCode(),
     _isEnabled.Value.GetHashCode());
 }
 public int CalculateHash(HashCalculator calc)
 {
     return calc.Calculate(_abilities);
 }
 public int CalculateHash(HashCalculator calc)
 {
     return calc.Calculate(_redirections);
 }
Beispiel #16
0
 public int CalculateHash(HashCalculator calc)
 {
     return Amount;
 }
Beispiel #17
0
 public virtual int CalculateHash(HashCalculator calc)
 {
     return _isEnabled.Value.GetHashCode();
 }
Beispiel #18
0
 public int CalculateHash(HashCalculator calc)
 {
     return(calc.Calculate(_items, _orderImpactsHashcode));
 }
 public int CalculateHash(HashCalculator calc)
 {
     return RandomEx.Next();
 }
Beispiel #20
0
 public int CalculateHash(HashCalculator calc)
 {
   return GetType().GetHashCode();
 }
Beispiel #21
0
 public int CalculateHash(HashCalculator calc)
 {
     return _queue.Count;
 }
Beispiel #22
0
 public override int CalculateHash(HashCalculator calc)
 {
     return Count;
 }
 public int CalculateHash(HashCalculator calc)
 {
     return calc.Calculate(_preventions);
 }
Beispiel #24
0
 public int CalculateHash(HashCalculator calc)
 {
     return Effect().CalculateHash(calc);
 }
Beispiel #25
0
 public int CalculateHash(HashCalculator calc)
 {
     return HashCalculator.Combine(
     calc.Calculate(_isBlocked),
     calc.Calculate(_card),
     calc.Calculate(_blockers),
     calc.Calculate(_assignedDamage));
 }
Beispiel #26
0
 public int CalculateHash(HashCalculator hashCalculator)
 {
     return Card.CalculateHash(hashCalculator);
 }
Beispiel #27
0
 public int CalculateHash(HashCalculator calc)
 {
     return HashCalculator.Combine(calc.Calculate(_colors), calc.Calculate(_cardTypes));
 }
Beispiel #28
0
 public int CalculateHash(HashCalculator calc)
 {
     return(calc.Calculate(_items.Keys.ToList(),
                           orderImpactsHashcode: false));
 }
 public abstract int CalculateHash(HashCalculator calc);