コード例 #1
0
 private static string GetExceptionMessage(IShred30Contact shred30Contact)
 {
     return(string.Format(
                "{0} was marked as being a same side variant, but {0} does not have a same side variant",
                shred30Contact.Name
                ));
 }
コード例 #2
0
        /// <summary>Validates the contacts.</summary>
        /// <param name="shred30Contacts">The shred30 contacts.</param>
        /// <exception cref="SurfacesDoNotLineUpException"></exception>
        public void ValidateContacts(IEnumerable <IShred30Contact> shred30Contacts)
        {
            if (shred30Contacts.Count() <= 1)
            {
                return;
            }

            foreach (Shred30ContactPair shred30ContactPair in shred30Contacts.GetCollection().GetPairCollection())
            {
                IShred30Contact firstContact  = shred30ContactPair.FirstContact;
                IShred30Contact secondContact = shred30ContactPair.SecondContact;

                // drops don't have surfaces, so it is automatically a valid surface pair
                if (firstContact.IsDrop || secondContact.IsDrop)
                {
                    continue;
                }

                SurfaceType firstContactEndSurface    = firstContact.FootbagTrick.EndDelay.Surface;
                SurfaceType secondContactStartSurface = secondContact.FootbagTrick.StartDelay.Surface;

                bool surfacesLineUpExactly = firstContactEndSurface == secondContactStartSurface;
                bool secondTrickCanStartFromEitherSurface = secondContactStartSurface == SurfaceType.Either;

                if (!(surfacesLineUpExactly || secondTrickCanStartFromEitherSurface))
                {
                    throw new SurfacesDoNotLineUpException(shred30ContactPair);
                }
            }
        }
コード例 #3
0
 /// <summary>Gets the adds for a single contact.</summary>
 /// <param name="shred30Contact">The shred30 contact.</param>
 public int GetAdds(IShred30Contact shred30Contact)
 {
     if (shred30Contact.UseXDex)
     {
         return(shred30Contact.Adds - 1);
     }
     else
     {
         return(shred30Contact.Adds);
     }
 }
コード例 #4
0
        /// <summary>Validates the contacts.</summary>
        /// <param name="shred30Contacts">The shred30 contacts.</param>
        /// <exception cref="TrickAfterDropDoesNotSpecifySideException"></exception>
        public void ValidateContacts(IEnumerable <IShred30Contact> shred30Contacts)
        {
            foreach (Shred30ContactPair shred30ContactPair in shred30Contacts.GetCollection().GetPairCollection())
            {
                IShred30Contact firstContact  = shred30ContactPair.FirstContact;
                IShred30Contact secondContact = shred30ContactPair.SecondContact;

                bool trickFollowsDrop = firstContact.IsDrop && !secondContact.IsDrop;

                if (trickFollowsDrop)
                {
                    if (secondContact.StartSide != OrdinalSideType.None)
                    {
                        continue;
                    }
                    else
                    {
                        throw new TrickAfterDropDoesNotSpecifySideException(secondContact);
                    }
                }
            }
        }
コード例 #5
0
        /// <summary>Sets the ordinal sides for each contact.</summary>
        /// <param name="shred30Contacts">The shred30 contacts.</param>
        public IEnumerable <IShred30Contact> ArrangeContacts(IEnumerable <IShred30Contact> shred30Contacts)
        {
            if (shred30Contacts.Count() <= 1)
            {
                return(shred30Contacts);
            }

            foreach (Shred30ContactPair shred30ContactPair in shred30Contacts.GetCollection().GetPairCollection())
            {
                IShred30Contact firstContact  = shred30ContactPair.FirstContact;
                IShred30Contact secondContact = shred30ContactPair.SecondContact;

                if (firstContact.IsDrop || secondContact.IsDrop)
                {
                    continue;
                }

                secondContact.StartSide = firstContact.GetEndSide();
            }

            return(shred30Contacts);
        }
コード例 #6
0
 /// <summary>Determines whether [is instace of contact unique] [the specified shred30 contacts].</summary>
 /// <param name="shred30Contacts">The shred30 contacts.</param>
 /// <param name="shred30Contact">The shred30 contact.</param>
 public bool IsInstaceOfContactUnique(IEnumerable <IShred30Contact> shred30Contacts, IShred30Contact shred30Contact)
 {
     return(this
            .GetUniqueContacts(shred30Contacts)
            .Any(uniqueContact => uniqueContact.UniqueId == shred30Contact.UniqueId));
 }
コード例 #7
0
 public SameSideVariantMismatchException(IShred30Contact shred30Contact)
     : base(GetExceptionMessage(shred30Contact))
 {
 }
コード例 #8
0
 public NotAllTricksSpecifySidesException(IShred30Contact shred30Contact)
     : base(GetExceptionMessage(shred30Contact))
 {
 }
コード例 #9
0
 private static string GetExceptionMessage(IShred30Contact shred30Contact)
 {
     return(string.Format("Could not figure out side for trick '{0}'", shred30Contact.Name));
 }
コード例 #10
0
 /// <summary>Gets the adds for a single contact.</summary>
 /// <param name="shred30Contact">The shred30 contact.</param>
 public int GetAdds(IShred30Contact shred30Contact)
 {
     return(shred30Contact.Adds);
 }
コード例 #11
0
 public TrickAfterDropDoesNotSpecifySideException(IShred30Contact shred30Contact)
     : base(GetExceptionMessage(shred30Contact))
 {
 }
コード例 #12
0
 private static string GetExceptionMessage(IShred30Contact shred30Contact)
 {
     return(string.Format("'{0}' must specify a starting side because it comes after a drop.", shred30Contact.Name));
 }