/// <summary> Constructor for a new instance of the Title_Info class </summary>
        /// <param name="Title">Text for this title</param>
        /// <param name="Type">Title type</param>
        public Title_Info(string Title, Title_Type_Enum Type)
        {
            titleType = Type;
            title = Title;

            partNames = new List<string>();
            partNumbers = new List<string>();
        }
        /// <summary> Constructor for a new instance of the Title_Info class </summary>
        /// <param name="Title">Text for this title</param>
        /// <param name="Type">Title type</param>
        public Title_Info(string Title, Title_Type_Enum Type)
        {
            titleType = Type;
            title     = Title;

            partNames   = new List <string>();
            partNumbers = new List <string>();
        }
 /// <summary> Clear all the information about this title object  </summary>
 public void Clear()
 {
     titleType    = Title_Type_Enum.UNSPECIFIED;
     authority    = null;
     displayLabel = null;
     language     = null;
     title        = null;
     subtitle     = null;
     nonSort      = null;
     if (partNames != null)
     {
         partNames.Clear();
     }
     if (partNumbers != null)
     {
         partNumbers.Clear();
     }
 }
        private static void Add_Main_Title(Bibliographic_Info thisBibInfo, MARC_Record record, int tag, Title_Type_Enum type, int non_filling_type, int title_type)
        {
            // Step through each instance of this tag
            foreach (MARC_Field thisRecord in record[tag])
            {
                // Declare new title
                Title_Info newTitle = new Title_Info();
                newTitle.Title_Type = type;

                switch (non_filling_type)
                {
                    case 0:
                        newTitle.Title = Remove_Trailing_Punctuation(thisRecord['a']);
                        break;

                    case 1:
                        int non_filling_chars1 = 0;
                        try
                        {
                            non_filling_chars1 = Convert.ToInt16(thisRecord.Indicator1) - 48;
                        }
                        catch
                        {
                        }

                        if (non_filling_chars1 == 0)
                        {
                            newTitle.Title = Remove_Trailing_Punctuation(thisRecord['a']);
                        }
                        else
                        {
                            string complete_title = thisRecord['a'];
                            newTitle.NonSort = complete_title.Substring(0, non_filling_chars1);
                            newTitle.Title = Remove_Trailing_Punctuation(complete_title.Substring(non_filling_chars1));
                        }
                        break;

                    case 2:
                        int non_filling_chars2 = 0;
                        try
                        {
                            non_filling_chars2 = Convert.ToInt16(thisRecord.Indicator2) - 48;
                        }
                        catch
                        {
                        }

                        if (non_filling_chars2 == 0)
                        {
                            newTitle.Title = Remove_Trailing_Punctuation(thisRecord['a']);
                        }
                        else
                        {
                            string complete_title = thisRecord['a'];
                            newTitle.NonSort = complete_title.Substring(0, non_filling_chars2);
                            newTitle.Title = Remove_Trailing_Punctuation(complete_title.Substring(non_filling_chars2));
                        }
                        break;
                }

                newTitle.Title = newTitle.Title.Replace("âE", "É");

                if (thisRecord.has_Subfield('b'))
                    newTitle.Subtitle = Remove_Trailing_Punctuation(thisRecord['b'].Replace("/", ""));
                if (thisRecord.has_Subfield('n'))
                    newTitle.Add_Part_Number(thisRecord['n']);
                if (thisRecord.has_Subfield('p'))
                    newTitle.Add_Part_Name(thisRecord['p']);
                if (thisRecord.has_Subfield('y'))
                    newTitle.Language = thisRecord['y'];
                if (tag >= 700)
                    newTitle.Display_Label = "Uncontrolled";
                if (tag < 200)
                    newTitle.Display_Label = "Main Entry";
                if (tag == 246)
                {
                    switch (thisRecord.Indicator2)
                    {
                        case '0':
                            newTitle.Display_Label = "Portion of title";
                            break;

                        case '1':
                            newTitle.Display_Label = "Parallel title";
                            break;

                        case '2':
                            newTitle.Display_Label = "Distinctive title";
                            break;

                        case '3':
                            newTitle.Display_Label = "Other title";
                            break;

                        case '4':
                            newTitle.Display_Label = "Cover title";
                            break;

                        case '5':
                            newTitle.Display_Label = "Added title page title";
                            break;

                        case '6':
                            newTitle.Display_Label = "Caption title";
                            break;

                        case '7':
                            newTitle.Display_Label = "Running title";
                            break;

                        case '8':
                            newTitle.Display_Label = "Spine title";
                            break;

                        default:
                            newTitle.Display_Label = "Alternate title";
                            break;
                    }
                }
                if (thisRecord.has_Subfield('i'))
                    newTitle.Display_Label = thisRecord['i'].Replace(":", "");

                switch (title_type)
                {
                    case 1:
                        thisBibInfo.Main_Title = newTitle;
                        break;

                    case 2:
                        thisBibInfo.Add_Other_Title(newTitle);
                        break;

                    case 3:
                        thisBibInfo.SeriesTitle = newTitle;
                        break;

                    case 4:
                        Subject_Info_TitleInfo newTitleSubj = new Subject_Info_TitleInfo();
                        newTitleSubj.Set_Internal_Title(newTitle);
                        if (thisRecord.has_Subfield('v'))
                            newTitleSubj.Add_Genre(Remove_Trailing_Punctuation(thisRecord['v']));
                        if (thisRecord.has_Subfield('x'))
                            newTitleSubj.Add_Topic(Remove_Trailing_Punctuation(thisRecord['x']));
                        if (thisRecord.has_Subfield('y'))
                            newTitleSubj.Add_Temporal(Remove_Trailing_Punctuation(thisRecord['y']));
                        if (thisRecord.has_Subfield('z'))
                            newTitleSubj.Add_Geographic(Remove_Trailing_Punctuation(thisRecord['z']));
                        if (thisRecord.has_Subfield('2'))
                            newTitleSubj.Authority = thisRecord['2'];
                        switch (thisRecord.Indicator2)
                        {
                            case '0':
                                newTitleSubj.Authority = "lcsh";
                                break;

                            case '1':
                                newTitleSubj.Authority = "lcshac";
                                break;

                            case '2':
                                newTitleSubj.Authority = "mesh";
                                break;

                            case '3':
                                newTitleSubj.Authority = "nal";
                                break;

                            case '5':
                                newTitleSubj.Authority = "csh";
                                break;

                            case '6':
                                newTitleSubj.Authority = "rvm";
                                break;
                        }
                        thisBibInfo.Add_Subject(newTitleSubj);
                        break;
                }
            }
        }
 /// <summary> Constructor for a new instance of the Title_Info class </summary>
 public Title_Info()
 {
     titleType = Title_Type_Enum.UNSPECIFIED;
 }
 /// <summary> Clear all the information about this title object  </summary>
 public void Clear()
 {
     titleType = Title_Type_Enum.UNSPECIFIED;
     authority = null;
     displayLabel = null;
     language = null;
     title = null;
     subtitle = null;
     nonSort = null;
     if (partNames != null) partNames.Clear();
     if (partNumbers != null) partNumbers.Clear();
 }
        /// <summary> Adds a new title to this item  </summary>
        /// <param name="Title">String for this title</param>
        /// <param name="Type">Type of title</param>
        /// <returns>Built title object for any other additiona</returns>
        public Title_Info Add_Other_Title(string Title, Title_Type_Enum Type)
        {
            if (otherTitles == null)
                otherTitles = new List<Title_Info>();

            // Make sure this doesn't already exist as the main title
            if (String.Compare(mainTitle.Title, Title, StringComparison.OrdinalIgnoreCase) == 0)
                return mainTitle;

            // Make sure this doesn't already exist as an other title
            foreach (Title_Info thisOtherTitle in otherTitles)
            {
                if (String.Compare(thisOtherTitle.Title, Title, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    thisOtherTitle.Title_Type = Type;
                    return thisOtherTitle;
                }
            }

            Title_Info newTitle = new Title_Info(Title, Type);
            otherTitles.Add(newTitle);
            return newTitle;
        }
 /// <summary> Constructor for a new instance of the Title_Info class </summary>
 public Title_Info()
 {
     titleType = Title_Type_Enum.UNSPECIFIED;
 }
        /// <summary> Adds a new title to this item  </summary>
        /// <param name="Title">String for this title</param>
        /// <param name="Type">Type of title</param>
        /// <returns>Built title object for any other additiona</returns>
        public Title_Info Add_Other_Title(string Title, Title_Type_Enum Type)
        {
            if (otherTitles == null)
                otherTitles = new List<Title_Info>();

            Title_Info newTitle = new Title_Info(Title, Type);
            otherTitles.Add(newTitle);
            return newTitle;
        }