205 lines
4.4 KiB
C#
205 lines
4.4 KiB
C#
using System;
|
|
|
|
namespace System.Text.RegularExpressions
|
|
{
|
|
// Token: 0x020002D2 RID: 722
|
|
internal struct Interval : IComparable
|
|
{
|
|
// Token: 0x06001A3E RID: 6718 RVA: 0x0005EF7C File Offset: 0x0005D17C
|
|
public Interval(int low, int high)
|
|
{
|
|
if (low > high)
|
|
{
|
|
int num = low;
|
|
low = high;
|
|
high = num;
|
|
}
|
|
this.low = low;
|
|
this.high = high;
|
|
this.contiguous = true;
|
|
}
|
|
|
|
// Token: 0x17000814 RID: 2068
|
|
// (get) Token: 0x06001A3F RID: 6719 RVA: 0x0005EFB0 File Offset: 0x0005D1B0
|
|
public static Interval Empty
|
|
{
|
|
get
|
|
{
|
|
Interval interval;
|
|
interval.low = 0;
|
|
interval.high = interval.low - 1;
|
|
interval.contiguous = true;
|
|
return interval;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000815 RID: 2069
|
|
// (get) Token: 0x06001A40 RID: 6720 RVA: 0x0005EFE0 File Offset: 0x0005D1E0
|
|
public static Interval Entire
|
|
{
|
|
get
|
|
{
|
|
return new Interval(int.MinValue, int.MaxValue);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000816 RID: 2070
|
|
// (get) Token: 0x06001A41 RID: 6721 RVA: 0x0005EFF4 File Offset: 0x0005D1F4
|
|
public bool IsDiscontiguous
|
|
{
|
|
get
|
|
{
|
|
return !this.contiguous;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000817 RID: 2071
|
|
// (get) Token: 0x06001A42 RID: 6722 RVA: 0x0005F000 File Offset: 0x0005D200
|
|
public bool IsSingleton
|
|
{
|
|
get
|
|
{
|
|
return this.contiguous && this.low == this.high;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000818 RID: 2072
|
|
// (get) Token: 0x06001A43 RID: 6723 RVA: 0x0005F020 File Offset: 0x0005D220
|
|
public bool IsRange
|
|
{
|
|
get
|
|
{
|
|
return !this.IsSingleton && !this.IsEmpty;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000819 RID: 2073
|
|
// (get) Token: 0x06001A44 RID: 6724 RVA: 0x0005F03C File Offset: 0x0005D23C
|
|
public bool IsEmpty
|
|
{
|
|
get
|
|
{
|
|
return this.low > this.high;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700081A RID: 2074
|
|
// (get) Token: 0x06001A45 RID: 6725 RVA: 0x0005F04C File Offset: 0x0005D24C
|
|
public int Size
|
|
{
|
|
get
|
|
{
|
|
if (this.IsEmpty)
|
|
{
|
|
return 0;
|
|
}
|
|
return this.high - this.low + 1;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001A46 RID: 6726 RVA: 0x0005F06C File Offset: 0x0005D26C
|
|
public bool IsDisjoint(Interval i)
|
|
{
|
|
return this.IsEmpty || i.IsEmpty || (this.low > i.high || i.low > this.high);
|
|
}
|
|
|
|
// Token: 0x06001A47 RID: 6727 RVA: 0x0005F0BC File Offset: 0x0005D2BC
|
|
public bool IsAdjacent(Interval i)
|
|
{
|
|
return !this.IsEmpty && !i.IsEmpty && (this.low == i.high + 1 || this.high == i.low - 1);
|
|
}
|
|
|
|
// Token: 0x06001A48 RID: 6728 RVA: 0x0005F10C File Offset: 0x0005D30C
|
|
public bool Contains(Interval i)
|
|
{
|
|
return (!this.IsEmpty && i.IsEmpty) || (!this.IsEmpty && this.low <= i.low && i.high <= this.high);
|
|
}
|
|
|
|
// Token: 0x06001A49 RID: 6729 RVA: 0x0005F168 File Offset: 0x0005D368
|
|
public bool Contains(int i)
|
|
{
|
|
return this.low <= i && i <= this.high;
|
|
}
|
|
|
|
// Token: 0x06001A4A RID: 6730 RVA: 0x0005F188 File Offset: 0x0005D388
|
|
public bool Intersects(Interval i)
|
|
{
|
|
return !this.IsEmpty && !i.IsEmpty && ((this.Contains(i.low) && !this.Contains(i.high)) || (this.Contains(i.high) && !this.Contains(i.low)));
|
|
}
|
|
|
|
// Token: 0x06001A4B RID: 6731 RVA: 0x0005F1FC File Offset: 0x0005D3FC
|
|
public void Merge(Interval i)
|
|
{
|
|
if (i.IsEmpty)
|
|
{
|
|
return;
|
|
}
|
|
if (this.IsEmpty)
|
|
{
|
|
this.low = i.low;
|
|
this.high = i.high;
|
|
}
|
|
if (i.low < this.low)
|
|
{
|
|
this.low = i.low;
|
|
}
|
|
if (i.high > this.high)
|
|
{
|
|
this.high = i.high;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001A4C RID: 6732 RVA: 0x0005F27C File Offset: 0x0005D47C
|
|
public void Intersect(Interval i)
|
|
{
|
|
if (this.IsDisjoint(i))
|
|
{
|
|
this.low = 0;
|
|
this.high = this.low - 1;
|
|
return;
|
|
}
|
|
if (i.low > this.low)
|
|
{
|
|
this.low = i.low;
|
|
}
|
|
if (i.high > this.high)
|
|
{
|
|
this.high = i.high;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001A4D RID: 6733 RVA: 0x0005F2EC File Offset: 0x0005D4EC
|
|
public int CompareTo(object o)
|
|
{
|
|
return this.low - ((Interval)o).low;
|
|
}
|
|
|
|
// Token: 0x06001A4E RID: 6734 RVA: 0x0005F310 File Offset: 0x0005D510
|
|
public new string ToString()
|
|
{
|
|
if (this.IsEmpty)
|
|
{
|
|
return "(EMPTY)";
|
|
}
|
|
if (!this.contiguous)
|
|
{
|
|
return string.Concat(new object[] { "{", this.low, ", ", this.high, "}" });
|
|
}
|
|
if (this.IsSingleton)
|
|
{
|
|
return "(" + this.low + ")";
|
|
}
|
|
return string.Concat(new object[] { "(", this.low, ", ", this.high, ")" });
|
|
}
|
|
|
|
// Token: 0x04001599 RID: 5529
|
|
public int low;
|
|
|
|
// Token: 0x0400159A RID: 5530
|
|
public int high;
|
|
|
|
// Token: 0x0400159B RID: 5531
|
|
public bool contiguous;
|
|
}
|
|
}
|