예제 #1
0
 protected internal virtual void Minimize()
 {
     MakeInitialBlocks();
     while (HasSplit())
     {
         FastExactAutomatonMinimizer.Split split = GetSplit();
         ICollection inverseImages        = GetInverseImages(split);
         IDictionary inverseImagesByBlock = SortIntoBlocks(inverseImages);
         foreach (object o in inverseImagesByBlock.Keys)
         {
             FastExactAutomatonMinimizer.Block block = (FastExactAutomatonMinimizer.Block)o;
             ICollection members = (ICollection)inverseImagesByBlock[block];
             if (members.Count == 0 || members.Count == block.GetMembers().Count)
             {
                 continue;
             }
             if (members.Count > block.GetMembers().Count - members.Count)
             {
                 members = Difference(block.GetMembers(), members);
             }
             RemoveAll(block.GetMembers(), members);
             MakeBlock(members);
         }
     }
 }
예제 #2
0
        protected internal virtual ICollection GetInverseImages(FastExactAutomatonMinimizer.Split split)
        {
            IList  inverseImages = new ArrayList();
            object symbol        = split.GetSymbol();

            FastExactAutomatonMinimizer.Block block = split.GetBlock();
            foreach (object member in split.GetMembers())
            {
                if (!block.GetMembers().Contains(member))
                {
                    continue;
                }
                ICollection arcs = GetInverseArcs(member, symbol);
                foreach (object arc1 in arcs)
                {
                    TransducerGraph.Arc arc = (TransducerGraph.Arc)arc1;
                    object source           = arc.GetSourceNode();
                    inverseImages.Add(source);
                }
            }
            return(inverseImages);
        }
예제 #3
0
 protected internal virtual void AddSplit(FastExactAutomatonMinimizer.Split split)
 {
     splits.AddLast(split);
 }