DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Properties | Private Member Functions | List of all members
Deveel.Data.Index.CollatedSearchIndex Class Referenceabstract
Inheritance diagram for Deveel.Data.Index.CollatedSearchIndex:
Deveel.Data.Index.ColumnIndex Deveel.Data.Index.InsertSearchIndex

Public Member Functions

override void Insert (int rowNumber)
 
override void Remove (int rowNumber)
 
override IEnumerable< int > SelectAll ()
 
override IEnumerable< int > SelectRange (IndexRange[] ranges)
 
- Public Member Functions inherited from Deveel.Data.Index.ColumnIndex
abstract ColumnIndex Copy (ITable table, bool readOnly)
 
void Dispose ()
 
IIndex< int > Order (IEnumerable< int > rows)
 
IEnumerable< int > SelectRange (IndexRange range)
 
virtual IEnumerable< int > SelectFirst ()
 
IEnumerable< int > SelectNotFirst ()
 
IEnumerable< int > SelectLast ()
 
IEnumerable< int > SelectNotLast ()
 
IEnumerable< int > SelectAllNonNull ()
 
IEnumerable< int > SelectEqual (DataObject ob)
 
IEnumerable< int > SelectNotEqual (DataObject ob)
 
IEnumerable< int > SelectGreater (DataObject ob)
 
IEnumerable< int > SelectLess (DataObject ob)
 
IEnumerable< int > SelectGreaterOrEqual (DataObject ob)
 
IEnumerable< int > SelectLessOrEqual (DataObject ob)
 
IEnumerable< int > SelectBetween (DataObject ob1, DataObject ob2)
 
IEnumerable< int > SelectLike (DataObject value)
 
virtual ColumnIndex GetSubset (ITable subsetTable, int subsetColumn)
 

Protected Member Functions

 CollatedSearchIndex (ITable table, int columnOffset)
 
override void Dispose (bool disposing)
 
abstract int SearchFirst (DataObject value)
 
abstract int SearchLast (DataObject value)
 
virtual IEnumerable< int > AddRange (int start, int end, IEnumerable< int > input)
 
- Protected Member Functions inherited from Deveel.Data.Index.ColumnIndex
 ColumnIndex (ITable table, int columnOffset)
 
DataObject GetValue (long row)
 
virtual IEnumerable< int > SearchText (DataObject value)
 
virtual ColumnIndex CreateSubset (ITable table, int column, IEnumerable< int > rows)
 

Properties

virtual int Count [get]
 
virtual DataObject First [get]
 
virtual DataObject Last [get]
 
- Properties inherited from Deveel.Data.Index.ColumnIndex
ITable Table [get, private set]
 
int ColumnOffset [get, private set]
 
virtual bool IsReadOnly [get]
 
virtual bool HandlesTextSearch [get]
 
abstract string IndexType [get]
 

Private Member Functions

void AssertNotReadOnly ()
 
IEnumerable< int > AddRange (IndexRange range, IEnumerable< int > list)
 
int PositionOfRangePoint (RangeFieldOffset position, DataObject val)
 

Detailed Description

Definition at line 24 of file CollatedSearchIndex.cs.

Constructor & Destructor Documentation

Deveel.Data.Index.CollatedSearchIndex.CollatedSearchIndex ( ITable  table,
int  columnOffset 
)
inlineprotected

Definition at line 25 of file CollatedSearchIndex.cs.

26  : base(table, columnOffset) {
27  }

Member Function Documentation

virtual IEnumerable<int> Deveel.Data.Index.CollatedSearchIndex.AddRange ( int  start,
int  end,
IEnumerable< int >  input 
)
inlineprotectedvirtual

Reimplemented in Deveel.Data.Index.InsertSearchIndex.

Definition at line 61 of file CollatedSearchIndex.cs.

61  {
62  var list = new List<int>((end - start) + 2);
63  if (input != null)
64  list.AddRange(input);
65 
66  for (int i = start; i <= end; ++i) {
67  list.Add(i);
68  }
69 
70  return list;
71  }
IEnumerable<int> Deveel.Data.Index.CollatedSearchIndex.AddRange ( IndexRange  range,
IEnumerable< int >  list 
)
inlineprivate

Definition at line 73 of file CollatedSearchIndex.cs.

73  {
74  // Select the range specified.
75  var startFlag = range.StartOffset;
76  var start = range.StartValue;
77  var endFlag = range.EndOffset;
78  var end = range.EndValue;
79 
80  int r1 = PositionOfRangePoint(startFlag, start);
81  int r2 = PositionOfRangePoint(endFlag, end);
82 
83  if (r2 < r1)
84  return list;
85 
86  // Add the range to the set
87  return AddRange(r1, r2, list);
88 
89  }
int PositionOfRangePoint(RangeFieldOffset position, DataObject val)
virtual IEnumerable< int > AddRange(int start, int end, IEnumerable< int > input)
void Deveel.Data.Index.CollatedSearchIndex.AssertNotReadOnly ( )
inlineprivate

Definition at line 41 of file CollatedSearchIndex.cs.

41  {
42  if (IsReadOnly)
43  throw new InvalidOperationException("The index is read-only");
44  }
override void Deveel.Data.Index.CollatedSearchIndex.Dispose ( bool  disposing)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Index.ColumnIndex.

Reimplemented in Deveel.Data.Index.InsertSearchIndex.

Definition at line 54 of file CollatedSearchIndex.cs.

54  {
55  }
override void Deveel.Data.Index.CollatedSearchIndex.Insert ( int  rowNumber)
inlinevirtual
int Deveel.Data.Index.CollatedSearchIndex.PositionOfRangePoint ( RangeFieldOffset  position,
DataObject  val 
)
inlineprivate

Definition at line 111 of file CollatedSearchIndex.cs.

111  {
112  int p;
113  DataObject cell;
114 
115  switch (position) {
116 
117  case RangeFieldOffset.FirstValue:
118  if (val.Equals(IndexRange.FirstInSet)) {
119  return 0;
120  }
121  if (val.Equals(IndexRange.LastInSet)) {
122  // Get the last value and search for the first instance of it.
123  cell = Last;
124  } else {
125  cell = val;
126  }
127 
128  p = SearchFirst(cell);
129 
130  // (If value not found)
131  if (p < 0)
132  return -(p + 1);
133 
134  return p;
135 
136  case RangeFieldOffset.LastValue:
137  if (val.Equals(IndexRange.LastInSet))
138  return Count - 1;
139 
140  if (val.Equals(IndexRange.FirstInSet)) {
141  // Get the first value.
142  cell = First;
143  } else {
144  cell = val;
145  }
146 
147  p = SearchLast(cell);
148 
149  // (If value not found)
150  if (p < 0) {
151  return -(p + 1) - 1;
152  }
153  return p;
154 
155  case RangeFieldOffset.BeforeFirstValue:
156  if (val.Equals(IndexRange.FirstInSet))
157  return -1;
158 
159  if (val.Equals(IndexRange.LastInSet)) {
160  // Get the last value and search for the first instance of it.
161  cell = Last;
162  } else {
163  cell = val;
164  }
165 
166  p = SearchFirst(cell);
167  // (If value not found)
168  if (p < 0) {
169  return -(p + 1) - 1;
170  }
171  return p - 1;
172 
173  case RangeFieldOffset.AfterLastValue:
174  if (val.Equals(IndexRange.LastInSet)) {
175  return Count;
176  }
177  if (val.Equals(IndexRange.FirstInSet)) {
178  // Get the first value.
179  cell = First;
180  } else {
181  cell = val;
182  }
183  p = SearchLast(cell);
184  // (If value not found)
185  if (p < 0) {
186  return -(p + 1);
187  }
188  return p + 1;
189 
190  default:
191  throw new InvalidOperationException("Unrecognised position.");
192  }
193 
194  }
abstract int SearchLast(DataObject value)
abstract int SearchFirst(DataObject value)
RangeFieldOffset
The absolute offset of a field in a range of a selection.
override void Deveel.Data.Index.CollatedSearchIndex.Remove ( int  rowNumber)
inlinevirtual
abstract int Deveel.Data.Index.CollatedSearchIndex.SearchFirst ( DataObject  value)
protectedpure virtual
abstract int Deveel.Data.Index.CollatedSearchIndex.SearchLast ( DataObject  value)
protectedpure virtual
override IEnumerable<int> Deveel.Data.Index.CollatedSearchIndex.SelectAll ( )
inlinevirtual

Reimplemented from Deveel.Data.Index.ColumnIndex.

Definition at line 91 of file CollatedSearchIndex.cs.

91  {
92  return AddRange(0, Count - 1, null);
93  }
virtual IEnumerable< int > AddRange(int start, int end, IEnumerable< int > input)
override IEnumerable<int> Deveel.Data.Index.CollatedSearchIndex.SelectRange ( IndexRange[]  ranges)
inlinevirtual

Implements Deveel.Data.Index.ColumnIndex.

Definition at line 95 of file CollatedSearchIndex.cs.

95  {
96  // If no items in the set return an empty set
97  if (Count == 0)
98  return new List<int>(0);
99 
100  IEnumerable<int> list = null;
101  foreach (var range in ranges) {
102  list = AddRange(range, list);
103  }
104 
105  if (list == null)
106  return new List<int>(0);
107 
108  return list;
109  }
virtual IEnumerable< int > AddRange(int start, int end, IEnumerable< int > input)

Property Documentation

virtual int Deveel.Data.Index.CollatedSearchIndex.Count
getprotected

Definition at line 29 of file CollatedSearchIndex.cs.

virtual DataObject Deveel.Data.Index.CollatedSearchIndex.First
getprotected

Definition at line 33 of file CollatedSearchIndex.cs.

virtual DataObject Deveel.Data.Index.CollatedSearchIndex.Last
getprotected

Definition at line 37 of file CollatedSearchIndex.cs.


The documentation for this class was generated from the following file: