Inheritance: IPaComplexFormInfo
Esempio n. 1
0
		/// ------------------------------------------------------------------------------------
		internal static PaComplexFormInfo Create(ILexEntryRef lxEntryRef)
		{
			if (lxEntryRef.RefType != LexEntryRefTags.krtComplexForm)
				return null;

			var pcfi = new PaComplexFormInfo();
			pcfi.xComplexFormComment = PaMultiString.Create(lxEntryRef.Summary, lxEntryRef.Cache.ServiceLocator);
			pcfi.xComplexFormType = lxEntryRef.ComplexEntryTypesRS.Select(x => PaCmPossibility.Create(x)).ToList();

			foreach (var component in lxEntryRef.ComponentLexemesRS)
			{
				if (component is ILexEntry)
					pcfi.xComponents.Add(((ILexEntry)component).HeadWord.Text);
				else if (component is ILexSense)
				{
					var lxSense = (ILexSense)component;
					var text = lxSense.Entry.HeadWord.Text;
					if (lxSense.Entry.SensesOS.Count > 1)
						text += string.Format(" {0}", lxSense.IndexInOwner + 1);

					pcfi.xComponents.Add(text);
				}
			}

			return pcfi;
		}
Esempio n. 2
0
        /// ------------------------------------------------------------------------------------
        internal static PaComplexFormInfo Create(ILexEntryRef lxEntryRef)
        {
            if (lxEntryRef.RefType != LexEntryRefTags.krtComplexForm)
            {
                return(null);
            }

            var pcfi = new PaComplexFormInfo();

            pcfi.xComplexFormComment = PaMultiString.Create(lxEntryRef.Summary, lxEntryRef.Cache.ServiceLocator);
            pcfi.xComplexFormType    = lxEntryRef.ComplexEntryTypesRS.Select(x => PaCmPossibility.Create(x)).ToList();

            foreach (var component in lxEntryRef.ComponentLexemesRS)
            {
                if (component is ILexEntry)
                {
                    pcfi.xComponents.Add(((ILexEntry)component).HeadWord.Text);
                }
                else if (component is ILexSense)
                {
                    var lxSense = (ILexSense)component;
                    var text    = lxSense.Entry.HeadWord.Text;
                    if (lxSense.Entry.SensesOS.Count > 1)
                    {
                        text += string.Format(" {0}", lxSense.IndexInOwner + 1);
                    }

                    pcfi.xComponents.Add(text);
                }
            }

            return(pcfi);
        }
Esempio n. 3
0
        /// ------------------------------------------------------------------------------------
        internal PaLexEntry(ILexEntry lxEntry)
        {
            var svcloc = lxEntry.Cache.ServiceLocator;

            DateCreated  = lxEntry.DateCreated;
            DateModified = lxEntry.DateModified;
            //ExcludeAsHeadword = lxEntry.ExcludeAsHeadword; remove
            ExcludeAsHeadword = false;             // MDL: remove when IPaLexEntry is updated
            // ShowMainEntryIn = lxEntry.ShowMainEntryIn.Select(x => new PaLexShowMainEntryIn(x)).ToList(); // MDL: uncomment when IPaLexEntry is updated

            ImportResidue = lxEntry.ImportResidue.Text;

            xPronunciations = lxEntry.PronunciationsOS.Select(x => new PaLexPronunciation(x)).ToList();
            xSenses         = lxEntry.SensesOS.Select(x => new PaLexSense(x)).ToList();
            xComplexForms   = lxEntry.ComplexFormEntries.Where(x => x.LexemeFormOA != null).Select(x => PaMultiString.Create(x.LexemeFormOA.Form, svcloc)).ToList();
            xAllomorphs     = lxEntry.AllAllomorphs.Select(x => PaMultiString.Create(x.Form, svcloc)).ToList();

            xLexemeForm = lxEntry.LexemeFormOA != null?PaMultiString.Create(lxEntry.LexemeFormOA.Form, svcloc) : null;

            xMorphType         = PaCmPossibility.Create(lxEntry.PrimaryMorphType);
            xCitationForm      = PaMultiString.Create(lxEntry.CitationForm, svcloc);
            xNote              = PaMultiString.Create(lxEntry.Comment, svcloc);
            xLiteralMeaning    = PaMultiString.Create(lxEntry.LiteralMeaning, svcloc);
            xBibliography      = PaMultiString.Create(lxEntry.Bibliography, svcloc);
            xRestrictions      = PaMultiString.Create(lxEntry.Restrictions, svcloc);
            xSummaryDefinition = PaMultiString.Create(lxEntry.SummaryDefinition, svcloc);
            xVariantOfInfo     = lxEntry.VariantEntryRefs.Select(x => new PaVariantOfInfo(x)).ToList();
            xVariants          = lxEntry.VariantFormEntryBackRefs.Select(x => new PaVariant(x)).ToList();
            xGuid              = lxEntry.Guid;

            // append all etymology forms together separated by commas
            if (lxEntry.EtymologyOS.Count > 0)
            {
                xEtymology = new PaMultiString();
                foreach (var etymology in lxEntry.EtymologyOS)
                {
                    PaMultiString.Append(xEtymology, etymology.Form, svcloc);
                }
            }

            xComplexFormInfo = (from eref in lxEntry.EntryRefsOS
                                let pcfi = PaComplexFormInfo.Create(eref)
                                           where pcfi != null
                                           select pcfi).ToList();
        }