public override bool IsDataOk(ParadoxRecord dataRec) { var val = dataRec.DataValues[this.DataFieldIndex]; var comp = Comparer.Default.Compare(val, this.Value); switch (Operator) { case ParadoxCompareOperator.Equal: return(comp == 0); case ParadoxCompareOperator.NotEqual: return(comp != 0); case ParadoxCompareOperator.Greater: return(comp > 0); case ParadoxCompareOperator.GreaterOrEqual: return(comp >= 0); case ParadoxCompareOperator.Less: return(comp < 0); case ParadoxCompareOperator.LessOrEqual: return(comp <= 0); default: throw new NotSupportedException(); } }
public override bool IsIndexPossible(ParadoxRecord indexRec, ParadoxRecord nextRec) { var val1 = indexRec.DataValues[this.DataFieldIndex]; var comp1 = Comparer.Default.Compare(val1, this.Value); int comp2; if (nextRec != null) { var val2 = nextRec.DataValues[this.DataFieldIndex]; comp2 = Comparer.Default.Compare(val2, this.Value); } else { comp2 = 1; // last index range ends in infinite } switch (Operator) { case ParadoxCompareOperator.Equal: return(comp1 <= 0 && comp2 >= 0); case ParadoxCompareOperator.NotEqual: return(comp1 > 0 || comp2 < 0); case ParadoxCompareOperator.Greater: return(comp2 > 0); case ParadoxCompareOperator.GreaterOrEqual: return(comp2 >= 0); case ParadoxCompareOperator.Less: return(comp1 < 0); case ParadoxCompareOperator.LessOrEqual: return(comp1 <= 0); default: throw new NotSupportedException(); } }
public abstract bool IsIndexPossible(ParadoxRecord indexRec, ParadoxRecord nextRec);
public abstract bool IsDataOk(ParadoxRecord dataRec);
public override bool IsIndexPossible(ParadoxRecord indexRec, ParadoxRecord nextRec) { return(this.Test(c => c.IsIndexPossible(indexRec, nextRec))); }
public override bool IsDataOk(ParadoxRecord dataRec) { return(this.Test(c => c.IsDataOk(dataRec))); }