Ejemplo n.º 1
0
        protected override void DisposeManagedResources()
        {
            Trace.WriteLineIf(m_tracingSwitch.TraceInfo, "Total number of wordforms parsed = " + m_numberOfWordForms);
            Trace.WriteLineIf(m_tracingSwitch.TraceInfo, "Total time for parser = " + m_ticksParser);

            if (m_numberOfWordForms != 0)
            {
                long lAvg = m_ticksParser / m_numberOfWordForms;
                Trace.WriteLineIf(m_tracingSwitch.TraceInfo, "Average time for parser = " + lAvg);
            }

            m_parseFiler.Dispose();
            m_retriever.Dispose();
        }
        public override void FixtureTeardown()
        {
            m_vernacularWS = null;
            m_filer.Dispose();
            m_filer = null;
            m_idleQueue.Dispose();
            m_idleQueue               = null;
            m_entryFactory            = null;
            m_senseFactory            = null;
            m_stemAlloFactory         = null;
            m_afxAlloFactory          = null;
            m_stemMsaFactory          = null;
            m_inflAffMsaFactory       = null;
            m_lexEntryRefFactory      = null;
            m_lexEntryInflTypeFactory = null;

            base.FixtureTeardown();
        }
Ejemplo n.º 3
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>
        private void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (m_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                Trace.WriteLineIf(tracingSwitch.TraceInfo, "Total number of wordforms = " + m_iNumberOfWordForms.ToString());
                Trace.WriteLineIf(tracingSwitch.TraceInfo, "Total time for XAmple parser = " + m_ticksParser.ToString());

                if (m_iNumberOfWordForms != 0)
                {
                    long lAvg = m_ticksParser / m_iNumberOfWordForms;
                    Trace.WriteLineIf(tracingSwitch.TraceInfo, "Average time for XAmple parser = " + lAvg.ToString());
                }

                Trace.WriteLineIf(tracingSwitch.TraceInfo, "Total time for parser filer = " + m_ticksFiler);

                if (m_iNumberOfWordForms != 0)
                {
                    long lAvg = m_ticksFiler / m_iNumberOfWordForms;
                    Trace.WriteLineIf(tracingSwitch.TraceInfo, "Average time for parser filer = " + lAvg.ToString());
                }

                // Dispose managed resources here.
                if (m_parserFiler != null)
                {
                    m_parserFiler.Dispose();
                }
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_taskUpdateHandler = null;
            m_parserFiler       = null;
            m_connection        = null;      // Client needs to close and Dispose the connection, since it gave it to us.
            CleanupParser();
            m_LangProject = null;
            m_database    = null;
            m_isDisposed  = true;
        }