Hashcodes
This commit is contained in:
parent
961dcd29d1
commit
9596811ae7
@ -7,7 +7,7 @@
|
||||
<Authors>Glax</Authors>
|
||||
<RepositoryUrl>https://github.com/C9Glax/CShocker</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<Version>2.0.1</Version>
|
||||
<Version>2.0.2</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -11,4 +11,9 @@ public class DurationRange : RandomIntegerRange
|
||||
{
|
||||
return obj is IntensityRange && base.Equals(obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine("DR", base.GetHashCode());
|
||||
}
|
||||
}
|
@ -11,4 +11,9 @@ public class IntensityRange : RandomIntegerRange
|
||||
{
|
||||
return obj is IntensityRange && base.Equals(obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine("IR", base.GetHashCode());
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
public abstract class RandomIntegerRange
|
||||
{
|
||||
public short Min, Max;
|
||||
public readonly short Min, Max;
|
||||
internal RandomIntegerRange(short min, short max, short minLimit, short maxLimit)
|
||||
{
|
||||
if (max - min < 0)
|
||||
@ -27,8 +27,16 @@ public abstract class RandomIntegerRange
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is RandomIntegerRange rir &&
|
||||
this.Min == rir.Min &&
|
||||
this.Max == rir.Max;
|
||||
return obj is RandomIntegerRange rir && Equals(rir);
|
||||
}
|
||||
|
||||
private bool Equals(RandomIntegerRange other)
|
||||
{
|
||||
return Min == other.Min && Max == other.Max;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(Min, Max);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user