示例#1
0
 /// <inheritdoc />
 protected bool Equals(Orbit other)
 {
     return(MeanAnomoly.Equals(other.MeanAnomoly) && AscendingNode.Equals(other.AscendingNode) &&
            ArgumentPerigee.Equals(other.ArgumentPerigee) && MeanMotion.Equals(other.MeanMotion) &&
            RecoveredSemiMajorAxis.Equals(other.RecoveredSemiMajorAxis) &&
            RecoveredMeanMotion.Equals(other.RecoveredMeanMotion) && Perigee.Equals(other.Perigee) &&
            Apogee.Equals(other.Apogee) && Period.Equals(other.Period) && Epoch.Equals(other.Epoch) &&
            BStar.Equals(other.BStar) && Eccentricity.Equals(other.Eccentricity) &&
            Inclination.Equals(other.Inclination));
 }
示例#2
0
        /// <summary>
        /// Get the significant details of what needs approval
        /// </summary>
        /// <returns>A list of strings</returns>
        public override IDictionary <string, string> SignificantDetails()
        {
            IDictionary <string, string> returnList = base.SignificantDetails();

            returnList.Add("Celestial Orientation", OrientationType.ToString());
            returnList.Add("Apogee", Apogee.ToString());
            returnList.Add("Perigree", Perigree.ToString());
            returnList.Add("Velocity", Velocity.ToString());
            returnList.Add("Luminosity", Luminosity.ToString());

            return(returnList);
        }
        public void Apogee()
        {
            //Deserialize
            using (StreamReader streamReader = new StreamReader("CelestialData\\Apogee.txt"))
            {
                BinaryFormatter binaryFormatter = new BinaryFormatter();
                Apogee          ev = (Apogee)binaryFormatter.Deserialize(streamReader.BaseStream);

                PerigeeApogee lE1 = ev.LastApogee;
                PerigeeApogee nE1 = ev.NextApogee;
                PerigeeApogee lE2 = data.Apogee.LastApogee;
                PerigeeApogee nE2 = data.Apogee.NextApogee;

                PropertyInfo[] properties = typeof(PerigeeApogee).GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    var l1 = property.GetValue(lE1);
                    var l2 = property.GetValue(lE2);
                    var n1 = property.GetValue(nE1);
                    var n2 = property.GetValue(nE2);

                    Assert.AreEqual(l1.ToString(), l2.ToString(), $"Last Apogee: {l2} not expected.");
                    if (l1.GetType() == typeof(Distance) && l2.GetType() == typeof(Distance))
                    {
                        PropertyInfo[] propertiesSub = typeof(Distance).GetProperties();
                        foreach (PropertyInfo propertySub in propertiesSub)
                        {
                            var l1Sub = propertySub.GetValue(l1);
                            var l2Sub = propertySub.GetValue(l2);
                            Assert.AreEqual(l1Sub.ToString(), l2Sub.ToString(), $"Last Apogee {propertySub.Name}: {l2Sub} not expected.");
                        }
                    }
                    Assert.AreEqual(n1.ToString(), n2.ToString(), $"Next Apogee: {l2} not expected.");
                    if (n1.GetType() == typeof(Distance) && n2.GetType() == typeof(Distance))
                    {
                        PropertyInfo[] propertiesSub = typeof(Distance).GetProperties();
                        foreach (PropertyInfo propertySub in propertiesSub)
                        {
                            var n1Sub = propertySub.GetValue(n1);
                            var n2Sub = propertySub.GetValue(n2);
                            Assert.AreEqual(n1Sub.ToString(), n2Sub.ToString(), $"Next Apogee {propertySub.Name}: {n2Sub} not expected.");
                        }
                    }
                }
            }
        }
示例#4
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MeanAnomoly.GetHashCode();
         hashCode = (hashCode * 397) ^ AscendingNode.GetHashCode();
         hashCode = (hashCode * 397) ^ ArgumentPerigee.GetHashCode();
         hashCode = (hashCode * 397) ^ MeanMotion.GetHashCode();
         hashCode = (hashCode * 397) ^ RecoveredSemiMajorAxis.GetHashCode();
         hashCode = (hashCode * 397) ^ RecoveredMeanMotion.GetHashCode();
         hashCode = (hashCode * 397) ^ Perigee.GetHashCode();
         hashCode = (hashCode * 397) ^ Apogee.GetHashCode();
         hashCode = (hashCode * 397) ^ Period.GetHashCode();
         hashCode = (hashCode * 397) ^ Epoch.GetHashCode();
         hashCode = (hashCode * 397) ^ BStar.GetHashCode();
         hashCode = (hashCode * 397) ^ Eccentricity.GetHashCode();
         hashCode = (hashCode * 397) ^ Inclination.GetHashCode();
         return(hashCode);
     }
 }
        public bool Check_Apogee()
        {
            IFormatter formatter = new BinaryFormatter();

            //Deserialize
            using (StreamReader streamReader = new StreamReader("CelestialData\\Apogee.txt"))
            {
                BinaryFormatter binaryFormatter = new BinaryFormatter();
                Apogee          ev = (Apogee)binaryFormatter.Deserialize(streamReader.BaseStream);

                PerigeeApogee lE1 = ev.LastApogee;
                PerigeeApogee nE1 = ev.NextApogee;
                PerigeeApogee lE2 = this.Apogee.LastApogee;
                PerigeeApogee nE2 = this.Apogee.NextApogee;

                PropertyInfo[] properties = typeof(PerigeeApogee).GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    var l1 = property.GetValue(lE1);
                    var l2 = property.GetValue(lE2);
                    var n1 = property.GetValue(nE1);
                    var n2 = property.GetValue(nE2);

                    if (l1.ToString() != l2.ToString())
                    {
                        return(false);
                    }
                    if (l1.GetType() == typeof(Distance) && l2.GetType() == typeof(Distance))
                    {
                        PropertyInfo[] propertiesSub = typeof(Distance).GetProperties();
                        foreach (PropertyInfo propertySub in propertiesSub)
                        {
                            var l1Sub = propertySub.GetValue(l1);
                            var l2Sub = propertySub.GetValue(l2);
                            if (l1Sub.ToString() != l2Sub.ToString())
                            {
                                return(false);
                            }
                        }
                    }
                    if (n1.ToString() != n2.ToString())
                    {
                        return(false);
                    }
                    if (n1.GetType() == typeof(Distance) && n2.GetType() == typeof(Distance))
                    {
                        PropertyInfo[] propertiesSub = typeof(Distance).GetProperties();
                        foreach (PropertyInfo propertySub in propertiesSub)
                        {
                            var n1Sub = propertySub.GetValue(n1);
                            var n2Sub = propertySub.GetValue(n2);
                            if (n1Sub.ToString() != n2Sub.ToString())
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
            return(true);
        }