public override IEnumerable<long> GetMultipleIndexValues(IMultipleValueIndex<IComparable, long> myMultipleValueIndex, IComparable myIComparable) { foreach (var aVertexIDSet in myMultipleValueIndex.Where(kv => kv.Key.CompareTo(myIComparable) != 0).Select(kv => kv.Value)) { foreach (var aVertexID in aVertexIDSet) { yield return aVertexID; } } yield break; }
public override IEnumerable<long> GetMultipleIndexValues(IMultipleValueIndex<IComparable, long> myMultipleValueIndex, IComparable myIComparable) { if (myMultipleValueIndex is IRangeIndex<IComparable, long>) { //use the range funtionality foreach (var aVertexIDSet in ((IMultipleValueRangeIndex<IComparable, long>)myMultipleValueIndex).LowerThan(myIComparable, false)) { foreach (var aVertexID in aVertexIDSet) { yield return aVertexID; } } } else { //stupid, but works foreach (var aVertexIDSet in myMultipleValueIndex.Where(kv => kv.Key.CompareTo(myIComparable) < 0).Select(kv => kv.Value)) { foreach (var aVertexID in aVertexIDSet) { yield return aVertexID; } } } yield break; }
/// <summary> /// Extract values from a multiple value index /// </summary> /// <param name="mySingleValueIndex">The interesting index</param> /// <param name="myConstant">The interesting range</param> /// <returns>An enumerable of vertexIDs</returns> private IEnumerable<long> GetMultipleIndexValues(IMultipleValueIndex<IComparable, long> myMultipleValueIndex, RangeLiteralExpression myConstant) { if (myMultipleValueIndex is IRangeIndex<IComparable, long>) { //use the range funtionality foreach (var aVertexIDSet in ((IMultipleValueRangeIndex<IComparable, long>)myMultipleValueIndex) .InRange(myConstant.Lower, myConstant.Upper, myConstant.IncludeBorders, myConstant.IncludeBorders)) { foreach (var aVertexID in aVertexIDSet) { yield return aVertexID; } } } else { //stupid, but works if (myConstant.IncludeBorders) { foreach (var aVertexIDSet in myMultipleValueIndex .Where(kv => (kv.Key.CompareTo(myConstant.Lower) >= 0) && (kv.Key.CompareTo(myConstant.Upper) <= 0)) .Select(kv => kv.Value)) { foreach (var aVertexID in aVertexIDSet) { yield return aVertexID; } } } else { foreach (var aVertexIDSet in myMultipleValueIndex .Where(kv => (kv.Key.CompareTo(myConstant.Lower) > 0) && (kv.Key.CompareTo(myConstant.Upper) < 0)) .Select(kv => kv.Value)) { foreach (var aVertexID in aVertexIDSet) { yield return aVertexID; } } } } yield break; }