public int CompareTo(Location other) { if (ReferenceEquals(this, other)) { return(0); } if (ReferenceEquals(null, other)) { return(1); } var bookNumberComparison = BookNumber.CompareTo(other.BookNumber); if (bookNumberComparison != 0) { return(bookNumberComparison); } var sectionNumberComparison = SectionNumber.CompareTo(other.SectionNumber); if (sectionNumberComparison != 0) { return(sectionNumberComparison); } // Non-exact locations sort after exact ones if (!other.Exact) { return(1); } if (!Exact) { return(-1); } var groupNumberComparison = GroupNumber.CompareTo(other.GroupNumber); if (groupNumberComparison != 0) { return(groupNumberComparison); } return(WordNumber.CompareTo(other.WordNumber)); }
/// <summary> /// A Section is equal to annother if all of its data has the same value as the other /// </summary> /// <param name="obj">the object to compare</param> /// <returns>true if equal</returns> public override bool Equals(object obj) { if (obj.GetType() == GetType()) { Section s = (Section)obj; return(Course.Equals(s.Course) && SectionNumber.Equals(s.SectionNumber) && Instructor.Equals(s.Instructor) && Consent.Equals(s.Consent) && EnrollmentCap == s.EnrollmentCap && TopicDescription.Equals(s.TopicDescription) && MeetingStartDate.Equals(s.MeetingStartDate) && MeetingEndDate.Equals(s.MeetingEndDate) && Facility.Equals(s.Facility) && MeetingTimeStart.Equals(s.MeetingTimeStart) && MeetingTimeEnd.Equals(s.MeetingTimeEnd) && UnitsMin == s.UnitsMin && UnitsMax == s.UnitsMax && ClassAssnComponent == s.ClassAssnComponent); } return(base.Equals(obj)); }
public SYMBOL_TABLE(BinaryReader br) { this.NameArray = br.ReadBytes(8); if (this.NameArray[0] == 0 && this.NameArray[1] == 0 && this.NameArray[2] == 0 && this.NameArray[3] == 0) { // Per specification, if the high DWORD is 0, then then low DWORD is an index into the string table this.Name = "/" + BitConverter.ToInt32(NameArray, 4).ToString(); } else { this.Name = Encoding.UTF8.GetString(NameArray).Trim(((char)0)); } this.Value = br.ReadUInt32(); this.SectionNumber = (SectionNumber)br.ReadInt16(); this.Type = (TypeClass)br.ReadInt16(); if ((((int)this.Type) & 0xff00) == 0) { this.Type = (TypeClass)Enum.Parse(typeof(TypeClass), ((int)this.Type | 0x400).ToString()); } this.StorageClass = (StorageClass)br.ReadByte(); this.NumberOfAuxSymbols = br.ReadByte(); }
public string GetReference() { return((Header?.Type == ContractType.Purchase ? "P" : "S") + Header?.ContractNumber.ToString("00000", CultureInfo.InvariantCulture) + SectionNumber.ToString()); }
public override string ToString() { return(CatalogCourse.ToString() + SectionNumber.ToString("D2")); }