Esempio n. 1
0
        private static SortedSet <int> ComputeValues(Object unitParameter, ScheduleUnit unit)
        {
            if (unitParameter.IsInt())
            {
                var resultSet = new SortedSet <int>();
                resultSet.Add(unitParameter.AsInt());
                return(resultSet);
            }

            // cron parameters not handled as number sets
            if (unitParameter is CronParameter)
            {
                return(null);
            }

            var numberSet = (NumberSetParameter)unitParameter;

            if (numberSet.IsWildcard(unit.Min(), unit.Max()))
            {
                return(null);
            }

            var result       = numberSet.GetValuesInRange(unit.Min(), unit.Max());
            var resultSorted = new SortedSet <int>();

            resultSorted.AddAll(result);

            return(resultSorted);
        }
Esempio n. 2
0
        private static ICollection<int> ComputeValues(
            object unitParameter,
            ScheduleUnit unit)
        {
            ICollection<int> result;
            if (unitParameter is int) {
                result = new SortedSet<int>();
                result.Add((int) unitParameter);
                return result;
            }

            // cron parameters not handled as number sets
            if (unitParameter is CronParameter) {
                return null;
            }

            var numberSet = (NumberSetParameter) unitParameter;
            if (numberSet.IsWildcard(unit.Min(), unit.Max())) {
                return null;
            }

            result = numberSet.GetValuesInRange(unit.Min(), unit.Max());
            var resultSorted = new SortedSet<int>();
            resultSorted.AddAll(result);

            return resultSorted;
        }