18 using System.Collections.Generic;
23 namespace Deveel.Data.Index {
26 : base(table, columnOffset) {
29 protected virtual int Count {
34 get {
return GetValue(0); }
38 get {
return GetValue(Count - 1); }
43 throw new InvalidOperationException(
"The index is read-only");
46 public override void Insert(
int rowNumber) {
50 public override void Remove(
int rowNumber) {
54 protected override void Dispose(
bool disposing) {
57 protected abstract int SearchFirst(
DataObject value);
59 protected abstract int SearchLast(
DataObject value);
61 protected virtual IEnumerable<int>
AddRange(
int start,
int end, IEnumerable<int> input) {
62 var list =
new List<int>((end - start) + 2);
66 for (
int i = start; i <= end; ++i) {
80 int r1 = PositionOfRangePoint(startFlag, start);
81 int r2 = PositionOfRangePoint(endFlag, end);
87 return AddRange(r1, r2, list);
92 return AddRange(0, Count - 1, null);
98 return new List<int>(0);
100 IEnumerable<int> list = null;
101 foreach (var range
in ranges) {
102 list = AddRange(range, list);
106 return new List<int>(0);
128 p = SearchFirst(cell);
147 p = SearchLast(cell);
166 p = SearchFirst(cell);
183 p = SearchLast(cell);
191 throw new InvalidOperationException(
"Unrecognised position.");
Defines the contract to access the data contained into a table of a database.
IEnumerable< int > AddRange(IndexRange range, IEnumerable< int > list)
override bool Equals(object obj)
Describes the range of values to select from an index.
DataObject EndValue
Gets the last value of the range.
static readonly DataObject FirstInSet
RangeFieldOffset EndOffset
Gets the offset of the last value of the range.
int PositionOfRangePoint(RangeFieldOffset position, DataObject val)
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
DataObject StartValue
Gets the first value of the range.
override void Insert(int rowNumber)
override IEnumerable< int > SelectRange(IndexRange[] ranges)
override void Remove(int rowNumber)
override IEnumerable< int > SelectAll()
static readonly DataObject LastInSet
virtual IEnumerable< int > AddRange(int start, int end, IEnumerable< int > input)
RangeFieldOffset
The absolute offset of a field in a range of a selection.
override void Dispose(bool disposing)
CollatedSearchIndex(ITable table, int columnOffset)
RangeFieldOffset StartOffset
Gets the offset of the first value of the range.