Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CatalogItemVariation other &&
                   ((ItemId == null && other.ItemId == null) || (ItemId?.Equals(other.ItemId) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Sku == null && other.Sku == null) || (Sku?.Equals(other.Sku) == true)) &&
                   ((Upc == null && other.Upc == null) || (Upc?.Equals(other.Upc) == true)) &&
                   ((Ordinal == null && other.Ordinal == null) || (Ordinal?.Equals(other.Ordinal) == true)) &&
                   ((PricingType == null && other.PricingType == null) || (PricingType?.Equals(other.PricingType) == true)) &&
                   ((PriceMoney == null && other.PriceMoney == null) || (PriceMoney?.Equals(other.PriceMoney) == true)) &&
                   ((LocationOverrides == null && other.LocationOverrides == null) || (LocationOverrides?.Equals(other.LocationOverrides) == true)) &&
                   ((TrackInventory == null && other.TrackInventory == null) || (TrackInventory?.Equals(other.TrackInventory) == true)) &&
                   ((InventoryAlertType == null && other.InventoryAlertType == null) || (InventoryAlertType?.Equals(other.InventoryAlertType) == true)) &&
                   ((InventoryAlertThreshold == null && other.InventoryAlertThreshold == null) || (InventoryAlertThreshold?.Equals(other.InventoryAlertThreshold) == true)) &&
                   ((UserData == null && other.UserData == null) || (UserData?.Equals(other.UserData) == true)) &&
                   ((ServiceDuration == null && other.ServiceDuration == null) || (ServiceDuration?.Equals(other.ServiceDuration) == true)) &&
                   ((AvailableForBooking == null && other.AvailableForBooking == null) || (AvailableForBooking?.Equals(other.AvailableForBooking) == true)) &&
                   ((ItemOptionValues == null && other.ItemOptionValues == null) || (ItemOptionValues?.Equals(other.ItemOptionValues) == true)) &&
                   ((MeasurementUnitId == null && other.MeasurementUnitId == null) || (MeasurementUnitId?.Equals(other.MeasurementUnitId) == true)) &&
                   ((TeamMemberIds == null && other.TeamMemberIds == null) || (TeamMemberIds?.Equals(other.TeamMemberIds) == true)));
        }
        /// <summary>
        /// Reports the zero-based index of the last occurrence of the specified <paramref name="value"/> in the current <paramref name="span"/>.
        /// <param name="span">The source span.</param>
        /// <param name="value">The value to seek within the source span.</param>
        /// <param name="comparisonType">One of the enumeration values that determines how the <paramref name="span"/> and <paramref name="value"/> are compared.</param>
        /// </summary>
        public static int LastIndexOf(this ReadOnlySpan <char> span, ReadOnlySpan <char> value, StringComparison comparisonType)
        {
            string.CheckStringComparison(comparisonType);

            if (comparisonType == StringComparison.Ordinal)
            {
                return(SpanHelpers.LastIndexOf(
                           ref MemoryMarshal.GetReference(span),
                           span.Length,
                           ref MemoryMarshal.GetReference(value),
                           value.Length));
            }

            switch (comparisonType)
            {
            case StringComparison.CurrentCulture:
            case StringComparison.CurrentCultureIgnoreCase:
                return(CultureInfo.CurrentCulture.CompareInfo.LastIndexOf(span, value, string.GetCaseCompareOfComparisonCulture(comparisonType)));

            case StringComparison.InvariantCulture:
            case StringComparison.InvariantCultureIgnoreCase:
                return(CompareInfo.Invariant.LastIndexOf(span, value, string.GetCaseCompareOfComparisonCulture(comparisonType)));

            default:
                Debug.Assert(comparisonType == StringComparison.OrdinalIgnoreCase);
                return(Ordinal.LastIndexOfOrdinalIgnoreCase(span, value));
            }
        }
Ejemplo n.º 3
0
        public bool ShowViewModel(DialogViewModel viewModel, Func <AuthenticationDialogWindow> windowCreator)
        {
            if (!TryGetNext(out CapturedGuiOperation operation))
            {
                throw new ReplayNotFoundException($"Failed to find next `{nameof(CapturedGuiOperation)}`.");
            }
            if (!Ordinal.Equals(viewModel?.GetType().FullName, operation.DialogType))
            {
                throw new ReplayInputTypeException($"Expected `{viewModel?.GetType().FullName}` vs. Actual `{operation.DialogType}`.");
            }

            _context.Trace.WriteLine($"replay {nameof(ShowViewModel)}.");

            viewModel.IsValid = operation.Output.IsValid;
            viewModel.Result  = (AuthenticationDialogResult)operation.Output.Result;

            switch (viewModel)
            {
            case CredentialsViewModel cvm:
            {
                cvm.Login    = operation.Output.Login;
                cvm.Password = operation.Output.Password;
            }
            break;

            case OAuthViewModel oavm:
                break;
            }

            return(operation.Output.Success);
        }
Ejemplo n.º 4
0
        private List <string> OrdinalNumber(Treatment treatment)
        {
            Number ordinal = new Ordinal("Ordinal");

            try
            {
                ordinal.Translate(treatment);
            }
            catch (InvalidNumber ex)
            {
                return(new List <string> {
                    "Error", ex.Message
                });
            }
            List <string> list = ordinal.GetResults();

            if (list.Count.Equals(2))
            {
                list[0] = list[0];
                list[1] = list[1];
            }
            else if (list.Count.Equals(1))
            {
                list[0] = list[0];
            }
            if (list.Count > 0)
            {
                list.Insert(0, "2");
            }
            return(list);
        }
Ejemplo n.º 5
0
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"Name = {(Name == null ? "null" : Name == string.Empty ? "" : Name)}");
     toStringOutput.Add($"PriceMoney = {(PriceMoney == null ? "null" : PriceMoney.ToString())}");
     toStringOutput.Add($"Ordinal = {(Ordinal == null ? "null" : Ordinal.ToString())}");
     toStringOutput.Add($"ModifierListId = {(ModifierListId == null ? "null" : ModifierListId == string.Empty ? "" : ModifierListId)}");
 }
Ejemplo n.º 6
0
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"Name = {(Name == null ? "null" : Name == string.Empty ? "" : Name)}");
     toStringOutput.Add($"Ordinal = {(Ordinal == null ? "null" : Ordinal.ToString())}");
     toStringOutput.Add($"SelectionType = {(SelectionType == null ? "null" : SelectionType.ToString())}");
     toStringOutput.Add($"Modifiers = {(Modifiers == null ? "null" : $"[{ string.Join(", ", Modifiers)} ]")}");
 }
Ejemplo n.º 7
0
 /// <summary>
 /// The constructor.
 /// </summary>
 public DatabaseModel(Ordinal ordinal, SqlDataReader r)
 {
     Name          = r.Field <string>(ordinal.Database_Name);
     Status        = DatabaseStatus.Default;
     HasAccess     = false;
     NeuroxContext = null;
 }
Ejemplo n.º 8
0
        private static Ordinal Map(this DV_ORDINAL model)
        {
            var ordinal = new Ordinal(model.value);

            if (model.normal_status != null)
            {
                ordinal.NormalStatus = model.normal_status.Map();
            }
            if (model.normal_range != null)
            {
                ordinal.NormalRange = model.normal_range.Map <Ordinal>();
            }
            if (model.symbol != null)
            {
                ordinal.Symbol = model.symbol.Map();
            }

            if (model.other_reference_ranges != null)
            {
                foreach (REFERENCE_RANGE range in model.other_reference_ranges)
                {
                    ordinal.OtherReferenceRanges.Add(range.Map <Ordinal>());
                }
            }
            return(ordinal);
        }
Ejemplo n.º 9
0
        public bool Equals(SecureData lhs, SecureData rhs)
        {
            if (lhs.Data?.Length != rhs.Data?.Length ||
                !Ordinal.Equals(lhs.Key, rhs.Key) ||
                !Ordinal.Equals(lhs.Name, rhs.Name))
            {
                return(false);
            }

            if (lhs.Data is null && rhs.Data is null)
            {
                return(true);
            }

            if (lhs.Data is null || rhs.Data is null)
            {
                return(false);
            }

            for (int i = 0; i < lhs.Data.Length; i += 1)
            {
                if (lhs.Data[i] != rhs.Data[i])
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 10
0
        public override int GetHashCode()
        {
            int hashCode = 858792878;

            if (Name != null)
            {
                hashCode += Name.GetHashCode();
            }

            if (PriceMoney != null)
            {
                hashCode += PriceMoney.GetHashCode();
            }

            if (Ordinal != null)
            {
                hashCode += Ordinal.GetHashCode();
            }

            if (ModifierListId != null)
            {
                hashCode += ModifierListId.GetHashCode();
            }

            return(hashCode);
        }
        /// <summary>
        /// Compares the specified <paramref name="span"/> and <paramref name="other"/> using the specified <paramref name="comparisonType"/>,
        /// and returns an integer that indicates their relative position in the sort order.
        /// <param name="span">The source span.</param>
        /// <param name="other">The value to compare with the source span.</param>
        /// <param name="comparisonType">One of the enumeration values that determines how the <paramref name="span"/> and <paramref name="other"/> are compared.</param>
        /// </summary>
        public static int CompareTo(this ReadOnlySpan <char> span, ReadOnlySpan <char> other, StringComparison comparisonType)
        {
            string.CheckStringComparison(comparisonType);

            switch (comparisonType)
            {
            case StringComparison.CurrentCulture:
            case StringComparison.CurrentCultureIgnoreCase:
                return(CultureInfo.CurrentCulture.CompareInfo.Compare(span, other, string.GetCaseCompareOfComparisonCulture(comparisonType)));

            case StringComparison.InvariantCulture:
            case StringComparison.InvariantCultureIgnoreCase:
                return(CompareInfo.Invariant.Compare(span, other, string.GetCaseCompareOfComparisonCulture(comparisonType)));

            case StringComparison.Ordinal:
                if (span.Length == 0 || other.Length == 0)
                {
                    return(span.Length - other.Length);
                }
                return(string.CompareOrdinal(span, other));

            default:
                Debug.Assert(comparisonType == StringComparison.OrdinalIgnoreCase);
                return(Ordinal.CompareStringIgnoreCase(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length));
            }
        }
 /// <summary>Gets the hash code for the specified string.</summary>
 /// <param name="obj">A string.</param>
 /// <returns>A 32-bit signed hash code calculated from the value of the <paramref name="obj">obj</paramref> parameter.</returns>
 /// <exception cref="T:System.ArgumentException">Not enough memory is available to allocate the buffer that is required to compute the hash code.</exception>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="obj">obj</paramref> is null.</exception>
 public override int GetHashCode(string obj)
 {
     if (!Validate(obj))
     {
         throw new ArgumentOutOfRangeException(nameof(obj), "The value is not a valid component name.");
     }
     return(Ordinal.GetHashCode(obj));
 }
Ejemplo n.º 13
0
        public static void StaticEqualsComparer_SomeSome(NonEmptyString leftSome, NonEmptyString rightSome)
        {
            var left  = Option.From(leftSome.Get);
            var right = Option.From(rightSome.Get);

            Assert.Equal(Ordinal.Equals(leftSome.Get, rightSome.Get), Option.Equals(left, right, Ordinal));
            Assert.Equal(Ordinal.Equals(rightSome.Get, leftSome.Get), Option.Equals(right, left, Ordinal));
        }
Ejemplo n.º 14
0
        public static int Compare(string?strA, int indexA, string?strB, int indexB, int length, StringComparison comparisonType)
        {
            CheckStringComparison(comparisonType);

            if (strA == null || strB == null)
            {
                if (object.ReferenceEquals(strA, strB))
                {
                    // They're both null
                    return(0);
                }

                return(strA == null ? -1 : 1);
            }

            if (length < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_NegativeLength);
            }

            if (indexA < 0 || indexB < 0)
            {
                string paramName = indexA < 0 ? nameof(indexA) : nameof(indexB);
                throw new ArgumentOutOfRangeException(paramName, SR.ArgumentOutOfRange_Index);
            }

            if (strA.Length - indexA < 0 || strB.Length - indexB < 0)
            {
                string paramName = strA.Length - indexA < 0 ? nameof(indexA) : nameof(indexB);
                throw new ArgumentOutOfRangeException(paramName, SR.ArgumentOutOfRange_Index);
            }

            if (length == 0 || (object.ReferenceEquals(strA, strB) && indexA == indexB))
            {
                return(0);
            }

            int lengthA = Math.Min(length, strA.Length - indexA);
            int lengthB = Math.Min(length, strB.Length - indexB);

            switch (comparisonType)
            {
            case StringComparison.CurrentCulture:
            case StringComparison.CurrentCultureIgnoreCase:
                return(CultureInfo.CurrentCulture.CompareInfo.Compare(strA, indexA, lengthA, strB, indexB, lengthB, GetCaseCompareOfComparisonCulture(comparisonType)));

            case StringComparison.InvariantCulture:
            case StringComparison.InvariantCultureIgnoreCase:
                return(CompareInfo.Invariant.Compare(strA, indexA, lengthA, strB, indexB, lengthB, GetCaseCompareOfComparisonCulture(comparisonType)));

            case StringComparison.Ordinal:
                return(CompareOrdinalHelper(strA, indexA, lengthA, strB, indexB, lengthB));

            default:
                Debug.Assert(comparisonType == StringComparison.OrdinalIgnoreCase);     // CheckStringComparison validated these earlier
                return(Ordinal.CompareStringIgnoreCase(ref Unsafe.Add(ref strA.GetRawStringData(), indexA), lengthA, ref Unsafe.Add(ref strB.GetRawStringData(), indexB), lengthB));
            }
        }
Ejemplo n.º 15
0
        public override int GetHashCode()
        {
            var hashCode = -707644969;

            hashCode = hashCode * -1521134295 + EqualityComparer <MyType> .Default.GetHashCode(Type);

            hashCode = hashCode * -1521134295 + Ordinal.GetHashCode();
            return(hashCode);
        }
Ejemplo n.º 16
0
 public void DefaultPropertiesShouldBeCorrect()
 {
     var ordinal1 = new Ordinal(0);
     Assert.IsNotNull(ordinal1.GetLimits());
     Ordinal ordinal2 = null;
     var ordinal3 = new Ordinal(0);
     Assert.IsFalse(ordinal1.IsStrictlyComparableTo(ordinal2));
     Assert.IsTrue(ordinal1.IsStrictlyComparableTo(ordinal3));
 }
        // compare
        public int CompareTo(ACsEnum <T, U, V> other)
        {
            if (other.GetType() != typeof(T))
            {
                return(-1);
            }

            return(Ordinal.CompareTo(other.Ordinal));
        }
        protected override Task <ICollection <ResultProperty> > GetPropertiesAsync(CancellationToken token)
        {
            var props = new Collection <ResultProperty>()
            {
                new ResultProperty("Ordinal", Ordinal.ToString()),
                new ResultProperty("Species", Species)
            };

            return(Task.FromResult <ICollection <ResultProperty> >(props));
        }
Ejemplo n.º 19
0
        public void CompareShouldbeCorrect()
        {
            var ordinal1 = new Ordinal(1);
            var ordinal2 = new Ordinal(2);
            var ordinal3 = new Ordinal(2);

            Assert.AreEqual(0, ordinal2.CompareTo(ordinal3));
            Assert.AreEqual(-1, ordinal1.CompareTo(ordinal2));
            Assert.AreEqual(1, ordinal2.CompareTo(ordinal1));
        }
Ejemplo n.º 20
0
        public override string ToString()
        {
            var prefix = Module == null ? string.Empty : Module.Name + "!";

            if (IsImportByOrdinal)
            {
                return(prefix + '#' + Ordinal.ToString("X"));
            }
            return(prefix + HintName.Name);
        }
Ejemplo n.º 21
0
        public void CompareShouldbeCorrect()
        {
            var ordinal1 = new Ordinal(1);
            var ordinal2 = new Ordinal(2);
            var ordinal3 = new Ordinal(2);

            Assert.AreEqual(0, ordinal2.CompareTo(ordinal3));
            Assert.AreEqual(-1, ordinal1.CompareTo(ordinal2));
            Assert.AreEqual(1, ordinal2.CompareTo(ordinal1));
        }
Ejemplo n.º 22
0
        public override void Select(MainForm frm)
        {
            base.Select(frm);

            foreach (var tabpage in frm.MainTabEventCollectionTypes.TabPages.Cast <TabPage>().Where(tabpage => tabpage != frm.tabEventCollectionAbduction))
            {
                frm.MainTabEventCollectionTypes.TabPages.Remove(tabpage);
            }
            if (!frm.MainTabEventCollectionTypes.TabPages.Contains(frm.tabEventCollectionAbduction))
            {
                frm.MainTabEventCollectionTypes.TabPages.Add(frm.tabEventCollectionAbduction);
            }

            frm.lblAbductionRegion.Data   = Subregion;
            frm.lblAbductionSite.Data     = Site;
            frm.lblAbductionCoords.Data   = new Coordinate(Coords);
            frm.lblAbductionAttacker.Data = AttackingEn;
            frm.lblAbductionDefender.Data = DefendingEn;
            frm.lblAbductionParent.Data   = ParentEventCol;
            if (StartTime != null || EndTime != null)
            {
                frm.lblAbductionTime.Text     = string.Format("{0} - {1}", StartTime, EndTime);
                frm.lblAbductionDuration.Text = WorldTime.Duration(EndTime, StartTime);
            }
            else
            {
                frm.lblAbductionTime.Text     = "";
                frm.lblAbductionDuration.Text = "";
            }
            frm.lblAbductionOrdinal.Text = Ordinal.ToString();

            frm.lstAbductionEvents.Items.Clear();
            if (Event != null)
            {
                frm.lstAbductionEvents.Items.AddRange(Event.ToArray());
            }

            frm.grpAbductionEvents.Visible = frm.lstAbductionEvents.Items.Count > 0;

            if (frm.lstAbductionEvents.Items.Count > 0)
            {
                frm.lstAbductionEvents.SelectedIndex = 0;
            }

            frm.lstAbductionEventCols.Items.Clear();
            if (EventCol != null)
            {
                frm.lstAbductionEventCols.Items.AddRange(EventCol.ToArray());
            }

            frm.grpAbductionEventCols.Visible = frm.lstAbductionEventCols.Items.Count > 0;

            SelectTab(frm);
        }
Ejemplo n.º 23
0
        public override int GetHashCode(string obj)
        {
            Split(obj, out string section, out string scope, out string property);

            int code = OrdinalIgnoreCase.GetHashCode(section) ^
                       OrdinalIgnoreCase.GetHashCode(property);

            return(scope is null
                ? code
                : code ^ Ordinal.GetHashCode(scope));
        }
Ejemplo n.º 24
0
        public void DefaultPropertiesShouldBeCorrect()
        {
            var ordinal1 = new Ordinal(0);

            Assert.IsNotNull(ordinal1.GetLimits());
            Ordinal ordinal2 = null;
            var     ordinal3 = new Ordinal(0);

            Assert.IsFalse(ordinal1.IsStrictlyComparableTo(ordinal2));
            Assert.IsTrue(ordinal1.IsStrictlyComparableTo(ordinal3));
        }
Ejemplo n.º 25
0
        private void Test(
            string result,
            OrdinalStringForm form,
            uint ordinal,
            Plural plural = Plural.One,
            Gender gender = Gender.Neutral)
        {
            var str = Ordinal.Format(form, ordinal, plural, gender);

            Assert.IsTrue(result == str);
        }
Ejemplo n.º 26
0
        public static void StaticCompareComparer_SomeSome(NonEmptyString leftSome, NonEmptyString rightSome)
        {
            var left  = Option.From(leftSome.Get);
            var right = Option.From(rightSome.Get);

            // note(cosborn) Normalize the return value of `Ordinal.Compare`.
            int OrdinalCompare(string x, string y) => Ordinal.Compare(x, y).Pipe(Math.Sign);

            Assert.Equal(OrdinalCompare(leftSome.Get, rightSome.Get), Option.Compare(left, right, Ordinal));
            Assert.Equal(OrdinalCompare(rightSome.Get, leftSome.Get), Option.Compare(right, left, Ordinal));
        }
Ejemplo n.º 27
0
        public int CompareTo(object target)
        {
            var typedTarget = target as PolymorphicEnum <T, TEnum>;

            if (typedTarget == null)
            {
                throw new ArgumentException(@"Comparison can only occur between compatible enums.", nameof(target));
            }

            return(Ordinal.CompareTo(typedTarget.Ordinal));
        }
        public void OrdinalTypeNameMatchesPropertyName()
        {
            var properties = typeof(CloudEventAttributeType)
                             .GetProperties(BindingFlags.Public | BindingFlags.Static)
                             .Where(prop => prop.PropertyType == typeof(CloudEventAttributeType));

            foreach (var property in properties)
            {
                var type = (CloudEventAttributeType)property.GetValue(null) !;
                Assert.Equal(property.Name, type !.Ordinal.ToString());
            }
        }
 /// <summary>
 /// Compares two string values and returns a value indicating sort order.
 /// </summary>
 /// <param name="x">The first value to compare.</param>
 /// <param name="y">The second value to compare.</param>
 /// <returns></returns>
 public override int Compare(string x, string y)
 {
     if (!Validate(x))
     {
         throw new ArgumentOutOfRangeException(nameof(x), "The value is not a valid component name.");
     }
     if (!Validate(y))
     {
         throw new ArgumentOutOfRangeException(nameof(y), "The value is not a valid component name.");
     }
     return(Ordinal.Compare(x, y));
 }
 internal static bool EqualsOrdinalIgnoreCase(this ReadOnlySpan <char> span, ReadOnlySpan <char> value)
 {
     if (span.Length != value.Length)
     {
         return(false);
     }
     if (value.Length == 0)  // span.Length == value.Length == 0
     {
         return(true);
     }
     return(Ordinal.EqualsIgnoreCase(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), span.Length));
 }
Ejemplo n.º 31
0
        public override void Select(MainForm frm)
        {
            base.Select(frm);

            foreach (var tabpage in frm.MainTabEventCollectionTypes.TabPages.Cast <TabPage>().Where(tabpage => tabpage != frm.tabEventCollectionTheft))
            {
                frm.MainTabEventCollectionTypes.TabPages.Remove(tabpage);
            }
            if (!frm.MainTabEventCollectionTypes.TabPages.Contains(frm.tabEventCollectionTheft))
            {
                frm.MainTabEventCollectionTypes.TabPages.Add(frm.tabEventCollectionTheft);
            }

            frm.lblTheftSite.Data     = Site;
            frm.lblTheftCoords.Data   = Site != null ? new Coordinate(Site.Coords) : null;
            frm.lblTheftAttacker.Data = AttackingEn;
            frm.lblTheftDefender.Data = DefendingEn;
            frm.lblTheftWar.Data      = WarEventCol;
            if (StartTime != null || EndTime != null)
            {
                frm.lblTheftTime.Text     = $"{StartTime} - {EndTime}";
                frm.lblTheftDuration.Text = WorldTime.Duration(EndTime, StartTime);
            }
            else
            {
                frm.lblTheftTime.Text     = "";
                frm.lblTheftDuration.Text = "";
            }
            frm.lblTheftOrdinal.Text = Ordinal.ToString();

            frm.lstTheftEvents.Items.Clear();
            if (Event != null)
            {
                frm.lstTheftEvents.Items.AddRange(Event.ToArray());
            }

            frm.grpTheftEvents.Visible = frm.lstTheftEvents.Items.Count > 0;

            if (frm.lstTheftEvents.Items.Count > 0)
            {
                frm.lstTheftEvents.SelectedIndex = 0;
            }

            frm.lstTheftEventCols.Items.Clear();
            if (EventCol != null)
            {
                frm.lstTheftEventCols.Items.AddRange(EventCol.ToArray());
            }

            frm.grpTheftEventCols.Visible = frm.lstTheftEventCols.Items.Count > 0;

            SelectTab(frm);
        }
Ejemplo n.º 32
0
        public static Ordinal Rotate(this Ordinal ordinal, int degrees, RotationDirection direction = RotationDirection.Clockwise)
        {
            if (degrees % 90 != 0)
            {
                throw new NotImplementedException(
                          "Ordinal Rotation is only supported in intervals of 90 degrees. For more accurate turns, use vectors and not ordinals :)");
            }

            var baseTurn = direction == RotationDirection.Clockwise ? Rotation.Right90 : Rotation.Left90;

            return(Enumerable.Range(0, degrees / 90).Aggregate(ordinal, (ord, i) => ord.Rotate(baseTurn)));
        }
        /// <summary>
        /// Gets the ordinal cron value string.
        /// </summary>
        /// <param name="ordinal">The ordinal.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">Invalid Ordinal Value</exception>
        private string GetOrdinalCronValue(Ordinal ordinal)
        {
            string ordinalValue = null;

            switch (ordinal)
            {
                case Ordinal.First:
                    ordinalValue = "#1";
                    break;
                case Ordinal.Second:
                    ordinalValue = "#2";
                    break;
                case Ordinal.Third:
                    ordinalValue = "#3";
                    break;
                case Ordinal.Fourth:
                    ordinalValue = "#4";
                    break;
                case Ordinal.Fifth:
                    ordinalValue = "#5";
                    break;
                case Ordinal.Last:
                    ordinalValue = "L";
                    break;
                default:
                    throw new Exception("Invalid Ordinal Value");
                //break;
            }

            return ordinalValue;
        }