Esempio n. 1
0
			public void AssignObjects (LangProject lp)
			{
				//assign an atomic reference attribute
				FdoObjectSet os = (FdoObjectSet)lp.ResearchNotebookOA.RecordsOC.GetEnumerator();
				os.MoveNext();
				RnGenericRec record =(RnGenericRec)os.Current;
				record.ConfidenceRA= (CmPossibility)lp.ConfidenceLevelsOA.PossibilitiesOS[0];
			}
Esempio n. 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor for the FwDataEntryForm class that takes a language project.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public FwDataEntryForm(LangProject lp) : this()
		{
			m_LangProj = lp;
		}
Esempio n. 3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets the language project
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void SetLangProject(LangProject lp)
		{
			CheckDisposed();
			m_lp = lp;
		}
Esempio n. 4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		/// ------------------------------------------------------------------------------------
		protected virtual void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (m_isDisposed)
				return;


			IFwMetaDataCache metaCache = null;
			ILgWritingSystemFactory wsFactory = null;
			if (disposing)
			{
				// Dispose managed resources here.
				if (m_fdoCache != null)
				{
					metaCache = m_fdoCache.MetaDataCacheAccessor;
					// Don't set these to null, since the Dispose method on the
					// cache needs them to remove ChangeWatchers from them.
					//(m_fdoCache as NewFdoCache).MetaDataCache = null;
					//(m_fdoCache as NewFdoCache).DataAccess = null;
					m_fdoCache.Dispose();
				}
				if (m_cacheBase != null)
				{
					wsFactory = m_cacheBase.WritingSystemFactory;
					m_cacheBase.WritingSystemFactory = null;
					m_cacheBase.Dispose();
				}
			}
			// Dispose unmanaged resources here, whether disposing is true or false.
			if (metaCache != null && Marshal.IsComObject(metaCache))
				Marshal.ReleaseComObject(metaCache);
			if (wsFactory != null)
				wsFactory.Shutdown();
			m_lp = null;
			m_fdoCache = null;
			m_acth = null;
			m_cacheBase = null;
			m_metaDataModulesLoaded = null;

			m_isDisposed = true;
		}
Esempio n. 5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize the language project in the cache
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void InitializeLangProject()
		{
			CheckDisposed();
			int lpHvo = m_cacheBase.NewHvo(LangProject.kClassId);
			m_cacheBase.SetBasicProps(lpHvo, 0, LangProject.kClassId, 0, 0);

			// setup the default WSs
			m_cacheBase.CacheVecProp(lpHvo,
				(int)LangProject.LangProjectTags.kflidCurAnalysisWss,
				new int[] { s_wsHvos.En, s_wsHvos.De, s_wsHvos.Es }, 3);
			m_cacheBase.CacheVecProp(lpHvo,
				(int)LangProject.LangProjectTags.kflidAnalysisWss,
				new int[] { s_wsHvos.En, s_wsHvos.De, s_wsHvos.Es, s_wsHvos.Ipa }, 4);
			m_cacheBase.CacheVecProp(lpHvo,
				(int)LangProject.LangProjectTags.kflidCurVernWss,
				new int[] { s_wsHvos.Fr, s_wsHvos.Ur }, 2);
			m_cacheBase.CacheVecProp(lpHvo,
				(int)LangProject.LangProjectTags.kflidVernWss,
				new int[] { s_wsHvos.Fr, s_wsHvos.Ur }, 2);
			// make the new LP
			m_lp = new LangProject(Cache, lpHvo);

			((NewFdoCache)m_fdoCache).SetLangProject(m_lp);
			Debug.Assert(m_fdoCache.LangProject.CurAnalysisWssRS.Count > 0);
			Debug.Assert(m_fdoCache.LangProject.AnalysisWssRC.Count > 0);

			m_lp.AnthroListOAHvo = m_cacheBase.NewHvo(CmPossibilityList.kClassId);
			m_lp.MsFeatureSystemOAHvo = m_cacheBase.NewHvo(FsFeatureSystem.kClassId);

			CmAgent agent = new CmAgent();
			m_lp.AnalyzingAgentsOC.Add(agent);
			agent.Human = true;
			agent.Guid = LangProject.kguidAgentDefUser;
			agent = new CmAgent();
			m_lp.AnalyzingAgentsOC.Add(agent);
			agent.Human = false;
			agent.Guid = LangProject.kguidAgentM3Parser;
			agent.Version = "Normal";
			agent = new CmAgent();
			m_lp.AnalyzingAgentsOC.Add(agent);
			agent.Human = false;
			agent.Guid = LangProject.kguidAgentComputer;

			// Create the valid Translation Types
			m_lp.TranslationTagsOAHvo = m_cacheBase.NewHvo(CmPossibilityList.kClassId);
			m_cacheBase.SetBasicProps(m_lp.TranslationTagsOAHvo, m_lp.Hvo, (int)CmPossibilityList.kClassId,
				(int)LangProject.LangProjectTags.kflidTranslationTags, 0);
			AddTransType(LangProject.kguidTranBackTranslation);
			AddTransType(LangProject.kguidTranFreeTranslation);
			AddTransType(LangProject.kguidTranLiteralTranslation);
		}
Esempio n. 6
0
			public void MakeNewObjects(LangProject lp)
			{
				// add a new morphological data to the language project
				// (and replace the existing one, if there is one)
				lp.MorphologicalDataOA = new MoMorphData();

				// add a new set of test words to the morphological data object
				lp.MorphologicalDataOA.TestSetsOC.Add(new WfiWordSet());
			}
Esempio n. 7
0
			public void ModifyVectors (LangProject lp)
			{
				//add a new item to an owned sequence attribute
				CmAnthroItem a = (CmAnthroItem)lp.AnthroListOA.PossibilitiesOS.Append(new CmAnthroItem ());

				//add a new item to an owned collection attribute
				CmOverlay overlay = (CmOverlay)lp.OverlaysOC.Add (new CmOverlay());

				//add a new item to a reference collection attribute
				CmPossibility position = (CmPossibility)lp.PositionsOA.PossibilitiesOS [0];
				CmPerson person =(CmPerson)lp.PeopleOA.PossibilitiesOS[0];
				person.PositionsRC.Add(position);

				//move the last item in a sequence to the beginning
				FdoOwnSeqVector positions =lp.PositionsOA.PossibilitiesOS;

				position = (CmPossibility)positions[positions.Count-1];
				positions.InsertAt (position,0);

				//do the same, without instantiating the object we're moving
				int hvo = positions.hvoArray[positions.Count-1];
				positions.InsertAt(hvo,0);
			}
Esempio n. 8
0
			public void ReadFromVectors(LangProject lp)
			{
				//read a single item, the third element in the AnthroList
				CmAnthroItem p= (CmAnthroItem) lp.AnthroListOA.PossibilitiesOS[2];

				//read all of the items in the AntrhoList
				foreach (CmAnthroItem item in lp.AnthroListOA.PossibilitiesOS)
				{
					Console.WriteLine (item.Name.AnalysisDefaultWritingSystem);
				}
			}