14 private readonly
string fieldName;
15 private LinkedList<Filter> filters =
null;
19 private bool minInclusive;
20 private bool maxInclusive;
31 this.filters =
new LinkedList<Filter>();
42 this.filters = Filters;
53 public object Min => this.min;
58 public object Max => this.max;
63 public object Point => this.point;
90 get {
return this.IsRange && (this.min is
null || this.max is
null); }
98 get {
return (this.isRange && !(this.min is
null)) || (this.isPoint && !(this.point is
null)); }
106 get {
return (this.isRange && !(this.max is
null)) || (this.isPoint && !(this.point is
null)); }
120 if (this.filters is
null)
121 this.filters =
new LinkedList<Filter>();
123 this.filters.AddLast(
Filter);
137 if (!(this.min is
null))
141 if (!i.HasValue || i.Value > 0 || (i.Value == 0 && !
this.minInclusive))
147 if (!(this.max is
null))
151 if (!i.HasValue || i.Value < 0 || (i.Value == 0 && !
this.maxInclusive))
158 this.isRange =
false;
162 else if (this.isPoint)
165 return (i.HasValue && i.Value == 0);
182 public bool SetMin(
object Value,
bool Inclusive, out
bool Smaller)
190 if (!(this.min is
null))
201 if (!this.minInclusive && Inclusive)
206 if (i.HasValue && i.Value == 0)
212 this.minInclusive = Inclusive;
214 else if (i.Value == 0)
216 if (!Inclusive && this.minInclusive)
218 this.minInclusive =
false;
226 this.minInclusive = Inclusive;
230 if (!(this.max is
null))
233 if (!i.HasValue || i.Value < 0)
235 else if (i.Value == 0)
237 if (!(this.minInclusive && this.maxInclusive))
242 this.isRange =
false;
250 else if (this.isPoint)
255 return i.HasValue && i.Value >= 0;
257 return i.HasValue && i.Value > 0;
262 this.minInclusive = Inclusive;
276 public bool SetMax(
object Value,
bool Inclusive, out
bool Smaller)
284 if (!(this.max is
null))
295 if (!this.maxInclusive && Inclusive)
300 if (i.HasValue && i.Value == 0)
306 this.maxInclusive = Inclusive;
308 else if (i.Value == 0)
310 if (!Inclusive && this.maxInclusive)
312 this.maxInclusive =
false;
320 this.maxInclusive = Inclusive;
324 if (!(this.min is
null))
327 if (!i.HasValue || i.Value < 0)
329 else if (i.Value == 0)
331 if (!(this.minInclusive && this.maxInclusive))
336 this.isRange =
false;
344 else if (this.isPoint)
348 return !(!i.HasValue || i.Value > 0 || (i.Value == 0 && !Inclusive));
353 this.maxInclusive = Inclusive;
377 Destination.min = this.min;
378 Destination.max = this.max;
379 Destination.point = this.point;
380 Destination.minInclusive = this.minInclusive;
381 Destination.maxInclusive = this.maxInclusive;
382 Destination.isRange = this.isRange;
383 Destination.isPoint = this.isPoint;
392 if (this.filters is
null)
395 return this.filters.GetEnumerator();
402 IEnumerator IEnumerable.GetEnumerator()
410 StringBuilder sb =
new StringBuilder();
414 sb.Append(this.fieldName);
418 else if (this.isRange)
422 if (this.minInclusive)
427 sb.Append(this.fieldName);
429 if (this.maxInclusive)
437 sb.Append(this.fieldName);
439 return sb.ToString();
Static class that performs comparisons of property values.
static bool Decrement(ref object Value)
Decrements Value to the largest value smaller than Value .
static ? int Compare(object Value1, object Value2)
Compares two values. The values can be of different, but compatible types.
static bool Increment(ref object Value)
Increments Value to the smallest value greater than Value .
Contains information about a range in a search operation.
bool HasMin
If the range has a minimum endpoint.
RangeInfo(string FieldName)
Contains information about a range in a search operation.
bool HasFilters
If range has associated filters.
object Max
Maximum endpoint, if a range.
bool MinInclusive
If the minimum endpoint is included in the range.
bool SetMin(object Value, bool Inclusive, out bool Smaller)
Sets minimum endpoint of range.
bool SetMax(object Value, bool Inclusive, out bool Smaller)
Sets maximum endpoint of range.
IEnumerator< Filter > GetEnumerator()
Gets an enumerator of associated fields.
string FieldName
Field Name
object Min
Minimum endpoint, if a range.
void CopyTo(RangeInfo Destination)
Copies the range information to another range object.
object Point
Point value, if not a range.
bool IsRange
If the object specifies a range (true) or a single point (false).
override string ToString()
bool IsOpenEndedRange
If the range is open-ended.
RangeInfo Copy()
Creates a copy of the range information.
bool IsPoint
If the object specifies a point (true) or a range (false).
void AddFilterReference(Filter Filter)
Adds a reference to a filter.
bool HasMax
If the range has a maximum endpoint.
bool SetPoint(object Value)
Range consists of a single point value.
bool MaxInclusive
If the maximum endpoint is included in the range.
RangeInfo(string FieldName, LinkedList< Filter > Filters)
Contains information about a range in a search operation.
Base class for all filter classes.