//============================================================================*
        // CompareTo()
        //============================================================================*

        public int CompareTo(cFirearmCOL FirearmCOL)
        {
            if (FirearmCOL == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Compare Bullet
            //----------------------------------------------------------------------------*

            int rc = m_Bullet.CompareTo(FirearmCOL.m_Bullet);

            //----------------------------------------------------------------------------*
            // Compare COL
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                rc = m_COL.CompareTo(FirearmCOL.m_COL);

                //----------------------------------------------------------------------------*
                // Compare Ogive OAL
                //----------------------------------------------------------------------------*

                if (rc == 0)
                {
                    rc = m_OgiveOAL.CompareTo(FirearmCOL.m_OgiveOAL);
                }
            }

            return(rc);
        }
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public int CompareTo(cFirearmBullet FirearmBullet)
        {
            if (FirearmBullet == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Compare Caliber
            //----------------------------------------------------------------------------*

            int rc = m_Caliber.CompareTo(FirearmBullet.m_Caliber);

            //----------------------------------------------------------------------------*
            // Compare Bullet
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                rc = m_Bullet.CompareTo(FirearmBullet.m_Bullet);
            }

            return(rc);
        }
Beispiel #3
0
        //============================================================================*
        // Comparer()
        //============================================================================*

        public static int Comparer(cBullet Bullet1, cBullet Bullet2)
        {
            if (Bullet1 == null)
            {
                if (Bullet2 != null)
                {
                    return(-1);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                if (Bullet2 == null)
                {
                    return(1);
                }
            }

            return(Bullet1.CompareTo(Bullet2));
        }
Beispiel #4
0
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public int CompareTo(Object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            cLoad Load = (cLoad)obj;

            //----------------------------------------------------------------------------*
            // FirearmType
            //----------------------------------------------------------------------------*

            int rc = m_eFirearmType.CompareTo(Load.m_eFirearmType);

            //----------------------------------------------------------------------------*
            // Caliber
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                if (m_Caliber == null)
                {
                    rc = -1;
                }
                else
                {
                    rc = m_Caliber.CompareTo(Load.m_Caliber);
                }

                //----------------------------------------------------------------------------*
                // Bullet
                //----------------------------------------------------------------------------*

                if (rc == 0)
                {
                    if (m_Bullet == null)
                    {
                        rc = -1;
                    }
                    else
                    {
                        rc = m_Bullet.CompareTo(Load.m_Bullet);
                    }

                    //----------------------------------------------------------------------------*
                    // Powder
                    //----------------------------------------------------------------------------*

                    if (rc == 0)
                    {
                        if (m_Powder == null)
                        {
                            rc = -1;
                        }
                        else
                        {
                            rc = m_Powder.CompareTo(Load.m_Powder);
                        }

                        //----------------------------------------------------------------------------*
                        // Case
                        //----------------------------------------------------------------------------*

                        if (rc == 0)
                        {
                            if (m_Case == null)
                            {
                                rc = -1;
                            }
                            else
                            {
                                rc = m_Case.CompareTo(Load.m_Case);
                            }

                            //----------------------------------------------------------------------------*
                            // Primer
                            //----------------------------------------------------------------------------*

                            if (rc == 0)
                            {
                                if (m_Primer == null)
                                {
                                    rc = -1;
                                }
                                else
                                {
                                    rc = m_Primer.CompareTo(Load.m_Primer);
                                }
                            }
                        }
                    }
                }
            }

            return(rc);
        }