static bool RunBetween(IEnumerable<DataASTMutable.WarewolfAtom> warewolfAtoms, IEnumerable<DataASTMutable.WarewolfAtom> tovals, DataASTMutable.WarewolfAtom a)
{
WarewolfListIterator iterator = new WarewolfListIterator();
var from = new WarewolfAtomIterator(warewolfAtoms);
var to = new WarewolfAtomIterator(tovals);
iterator.AddVariableToIterateOn(@from);
iterator.AddVariableToIterateOn(to);
while(iterator.HasMoreData())
{
var fromval = iterator.FetchNextValue(@from);
var toVal = iterator.FetchNextValue(to);
DateTime fromDt;
if(DateTime.TryParse(fromval, out fromDt))
{
DateTime toDt;
if(!DateTime.TryParse(toVal, out toDt))
{
throw new InvalidDataException("IsBetween Numeric and DateTime mis-match");
}
DateTime recDateTime;
if(DateTime.TryParse(a.ToString(), out recDateTime))
{
if(recDateTime > fromDt && recDateTime < toDt)
{
return true;
}
}
}
double fromNum;
if(double.TryParse(fromval, out fromNum))
{
double toNum;
if(!double.TryParse(toVal, out toNum))
{
return false;
}
double recNum;
if(!double.TryParse(a.ToString(), out recNum))
{
continue;
}
if(recNum > fromNum && recNum < toNum)
{
return true;
}
}
}
return false;
}