예제 #1
0
파일: Sentence.cs 프로젝트: Ran-QUAN/Alta
 /// <summary>
 /// 删除一个依赖关系。
 /// </summary>
 /// <param name="dependency">要删除的依赖关系</param>
 public void RemoveDependency(Dependency dependency)
 {
     lock (_dependencies)
     {
         _dependencies.Remove(dependency);
     }
 }
예제 #2
0
파일: Sentence.cs 프로젝트: Ran-QUAN/Alta
        /// <summary>
        /// 在分句内标注一个依赖关系。
        /// </summary>
        /// <param name="dependency">要标注的依赖关系</param>
        public void AnnotateDependency(Dependency dependency)
        {
            lock (_dependencies)
            {
                if (dependency == null)
                    return;

                int index = _dependencies.BinarySearch(dependency,
                    s_dependencyComparer);

                if (index < 0)
                {
                    dependency.Context = this;
                    _dependencies.Insert(~index, dependency);
                }
            }
        }