Exemplo n.º 1
0
 public static string WarewolfAtomToString(DataASTMutable.WarewolfAtom a)
 {
     if (a == null)
     {
         return("");
     }
     return(a.ToString());
 }
Exemplo n.º 2
0
 public static string WarewolfAtomToString(DataASTMutable.WarewolfAtom a)
 {
     if (a == null)
     {
         return("");
     }
     return(PublicFunctions.AtomtoString(a));
 }
Exemplo n.º 3
0
 public static string WarewolfAtomToStringErrorIfNull(DataASTMutable.WarewolfAtom a)
 {
     if (a == null)
     {
         return("");
     }
     if (a.IsNothing)
     {
         throw new NullValueInVariableException("Variable is null", "");
     }
     return(a.ToString());
 }
Exemplo n.º 4
0
 public string GetNextValue()
 {
     _currentValue++;
     if (_listResult != null)
     {
         if (_listResult.MoveNext())
         {
             _currentResult = _listResult.Current;
             return(ExecutionEnvironment.WarewolfAtomToString(_listResult.Current));
         }
         return(ExecutionEnvironment.WarewolfAtomToString(_currentResult));
     }
     return(null);
 }
Exemplo n.º 5
0
 public string GetNextValue()
 {
     _currentValue++;
     if (_listResult != null)
     {
         if (_listResult.MoveNext())
         {
             _currentResult = _listResult.Current;
             return ExecutionEnvironment.WarewolfAtomToStringNullAsNothing(_listResult.Current);
         }
         return ExecutionEnvironment.WarewolfAtomToStringNullAsNothing(_currentResult);
     }
     return null;
 }
Exemplo n.º 6
0
 public static string WarewolfAtomToStringNullAsNothing(DataASTMutable.WarewolfAtom a)
 {
     return(a == null ? null : (a.IsNothing ? null : a.ToString()));
 }
Exemplo n.º 7
0
        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);
        }