예제 #1
0
        static public bool IsNotDefault(this Syncronizer.Interval item)
        {
            if (item.IsDefault() == false)
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        static public Syncronizer.Interval GetMax(this Syncronizer.Interval item, Syncronizer.Interval other)
        {
            if (item > other)
            {
                return(item);
            }

            return(other);
        }
예제 #3
0
        static public bool IsDefault(this Syncronizer.Interval item)
        {
            if (item == Syncronizer.Interval.Default)
            {
                return(true);
            }

            return(false);
        }
예제 #4
0
        static public Syncronizer.Interval ResolveDefault(this Syncronizer.Interval item, Syncronizer.Interval alternative)
        {
            if (item.IsNotDefault())
            {
                return(item);
            }

            return(alternative);
        }
예제 #5
0
        static public Duration GetDuration(this Syncronizer.Interval item)
        {
            switch (item)
            {
            case Syncronizer.Interval.EveryHour: return(Duration.Hours(1.0f));

            case Syncronizer.Interval.EveryHalfHour: return(Duration.Hours(0.5f));

            case Syncronizer.Interval.EveryQuarterHour: return(Duration.Hours(0.25f));

            case Syncronizer.Interval.EveryTenMinutes: return(Duration.Minutes(10.0f));

            case Syncronizer.Interval.EveryFiveMinutes: return(Duration.Minutes(5.0f));

            case Syncronizer.Interval.EveryTwoMinutes: return(Duration.Minutes(2.0f));

            case Syncronizer.Interval.EveryMinute: return(Duration.Minutes(1.0f));

            case Syncronizer.Interval.EveryThirtySeconds: return(Duration.Seconds(30.0f));

            case Syncronizer.Interval.EveryTwentySeconds: return(Duration.Seconds(20.0f));

            case Syncronizer.Interval.EveryTenSeconds: return(Duration.Seconds(10.0f));

            case Syncronizer.Interval.EveryFiveSeconds: return(Duration.Seconds(5.0f));

            case Syncronizer.Interval.EveryTwoSeconds: return(Duration.Seconds(2.0f));

            case Syncronizer.Interval.EverySecond: return(Duration.Seconds(1.0f));

            case Syncronizer.Interval.TwoTimesASecond: return(Duration.Hertz(2.0f));

            case Syncronizer.Interval.FiveTimesASecond: return(Duration.Hertz(5.0f));

            case Syncronizer.Interval.TenTimesASecond: return(Duration.Hertz(10.0f));

            case Syncronizer.Interval.TwentyTimesASecond: return(Duration.Hertz(20.0f));

            case Syncronizer.Interval.ThirtyTimesASecond: return(Duration.Hertz(30.0f));
            }

            throw new UnaccountedBranchException("item", item);
        }
예제 #6
0
 static public long GetWholeMilliseconds(this Syncronizer.Interval item, Syncronizer.Interval alternative)
 {
     return(item.GetDuration(alternative).GetWholeMilliseconds());
 }
예제 #7
0
 static public Duration GetDuration(this Syncronizer.Interval item, Syncronizer.Interval alternative)
 {
     return(item.ResolveDefault(alternative).GetDuration());
 }