mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Move easy filters so Machine can use them
This commit is contained in:
@@ -1209,6 +1209,76 @@ namespace SabreTools.Library.Filtering
|
||||
|
||||
#endregion
|
||||
|
||||
#region Filter Running
|
||||
|
||||
/// <summary>
|
||||
/// Determines if a value passes a bool? filter
|
||||
/// </summary>
|
||||
/// <param name="filterItem">Filter item to check</param>
|
||||
/// <param name="value">Value to check</param>
|
||||
/// <returns>True if the value passes, false otherwise</returns>
|
||||
public bool PassBoolFilter(FilterItem<bool?> filterItem, bool? value)
|
||||
{
|
||||
if (filterItem.MatchesNeutral(null, value) == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if a value passes a double? filter
|
||||
/// </summary>
|
||||
/// <param name="filterItem">Filter item to check</param>
|
||||
/// <param name="value">Value to check</param>
|
||||
/// <returns>True if the value passes, false otherwise</returns>
|
||||
public bool PassDoubleFilter(FilterItem<double?> filterItem, double? value)
|
||||
{
|
||||
if (filterItem.MatchesNeutral(null, value) == false)
|
||||
return false;
|
||||
else if (filterItem.MatchesPositive(null, value) == false)
|
||||
return false;
|
||||
else if (filterItem.MatchesNegative(null, value) == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if a value passes a long? filter
|
||||
/// </summary>
|
||||
/// <param name="filterItem">Filter item to check</param>
|
||||
/// <param name="value">Value to check</param>
|
||||
/// <returns>True if the value passes, false otherwise</returns>
|
||||
public bool PassLongFilter(FilterItem<long?> filterItem, long? value)
|
||||
{
|
||||
if (filterItem.MatchesNeutral(null, value) == false)
|
||||
return false;
|
||||
else if (filterItem.MatchesPositive(null, value) == false)
|
||||
return false;
|
||||
else if (filterItem.MatchesNegative(null, value) == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if a value passes a string filter
|
||||
/// </summary>
|
||||
/// <param name="filterItem">Filter item to check</param>
|
||||
/// <param name="value">Value to check</param>
|
||||
/// <returns>True if the value passes, false otherwise</returns>
|
||||
public bool PassStringFilter(FilterItem<string> filterItem, string value)
|
||||
{
|
||||
if (filterItem.MatchesPositiveSet(value) == false)
|
||||
return false;
|
||||
if (filterItem.MatchesNegativeSet(value) == true)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion // Instance Methods
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user