mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 16:43:52 +09:00
Split out lower and upper interval inclusivity
A single IsInclusive field causes unexpected issues when trying to formulate a half-open interval query. Split out IsInclusive into two fields, Is{Lower,Upper}Inclusive and update usages accordingly.
This commit is contained in:
@ -53,7 +53,7 @@ namespace osu.Game.Screens.Select
|
|||||||
if (comparison < 0)
|
if (comparison < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (comparison == 0 && !IsInclusive)
|
if (comparison == 0 && !IsLowerInclusive)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ namespace osu.Game.Screens.Select
|
|||||||
if (comparison > 0)
|
if (comparison > 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (comparison == 0 && !IsInclusive)
|
if (comparison == 0 && !IsUpperInclusive)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,12 +73,14 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public T? Min;
|
public T? Min;
|
||||||
public T? Max;
|
public T? Max;
|
||||||
public bool IsInclusive;
|
public bool IsLowerInclusive;
|
||||||
|
public bool IsUpperInclusive;
|
||||||
|
|
||||||
public bool Equals(OptionalRange<T> other)
|
public bool Equals(OptionalRange<T> other)
|
||||||
=> Min.Equals(other.Min)
|
=> Min.Equals(other.Min)
|
||||||
&& Max.Equals(other.Max)
|
&& Max.Equals(other.Max)
|
||||||
&& IsInclusive.Equals(other.IsInclusive);
|
&& IsLowerInclusive.Equals(other.IsLowerInclusive)
|
||||||
|
&& IsUpperInclusive.Equals(other.IsUpperInclusive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,30 +106,30 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
case "=":
|
case "=":
|
||||||
case ":":
|
case ":":
|
||||||
range.IsInclusive = true;
|
range.IsLowerInclusive = range.IsUpperInclusive = true;
|
||||||
range.Min = value;
|
range.Min = value;
|
||||||
range.Max = value;
|
range.Max = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ">":
|
case ">":
|
||||||
range.IsInclusive = false;
|
range.IsLowerInclusive = false;
|
||||||
range.Min = value;
|
range.Min = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ">=":
|
case ">=":
|
||||||
case ">:":
|
case ">:":
|
||||||
range.IsInclusive = true;
|
range.IsLowerInclusive = true;
|
||||||
range.Min = value;
|
range.Min = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "<":
|
case "<":
|
||||||
range.IsInclusive = false;
|
range.IsUpperInclusive = false;
|
||||||
range.Max = value;
|
range.Max = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "<=":
|
case "<=":
|
||||||
case "<:":
|
case "<:":
|
||||||
range.IsInclusive = true;
|
range.IsUpperInclusive = true;
|
||||||
range.Max = value;
|
range.Max = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user