예제 #1
0
        public ArrayList DifferenceReport()
        {
            ArrayList retval = new ArrayList();
            int       dcount = _destination.Count();
            int       scount = _source.Count();

            // Deal with the special case of empty files
            if (dcount == 0)
            {
                if (scount > 0)
                {
                    retval.Add(DifferenceResultSpan.CreateDeleteSource(0, scount));
                }

                return(retval);
            }
            else
            {
                if (scount == 0)
                {
                    retval.Add(DifferenceResultSpan.CreateAddDestination(0, dcount));
                    return(retval);
                }
            }

            _matchList.Sort();
            int curDest               = 0;
            int curSource             = 0;
            DifferenceResultSpan last = null;

            // Process each match record
            foreach (DifferenceResultSpan drs in _matchList)
            {
                if ((!AddChanges(retval, curDest, drs.DestIndex, curSource, drs.SourceIndex)) &&
                    (last != null))
                {
                    last.AddLength(drs.Length);
                }
                else
                {
                    retval.Add(drs);
                }

                curDest   = drs.DestIndex + drs.Length;
                curSource = drs.SourceIndex + drs.Length;
                last      = drs;
            }

            // Process any tail end data
            AddChanges(retval, curDest, dcount, curSource, scount);

            return(retval);
        }
예제 #2
0
        public double ProcessDifferences(IDifferenceList source, IDifferenceList destination)
        {
            DateTime dt = DateTime.Now;

            _source      = source;
            _destination = destination;
            _matchList   = new ArrayList();

            int dcount = _destination.Count();
            int scount = _source.Count();

            if ((dcount > 0) && (scount > 0))
            {
                _stateList = new DifferenceStateList(dcount);
                ProcessRange(0, dcount - 1, 0, scount - 1);
            }

            TimeSpan ts = DateTime.Now - dt;

            return(ts.TotalSeconds);
        }
예제 #3
0
        public double ProcessDifferences(IDifferenceList source, IDifferenceList destination)
        {
            DateTime dt = DateTime.Now;
            _source = source;
            _destination = destination;
            _matchList = new ArrayList();

            int dcount = _destination.Count();
            int scount = _source.Count();

            if ((dcount > 0) && (scount > 0))
            {
                _stateList = new DifferenceStateList(dcount);
                ProcessRange(0, dcount - 1, 0, scount - 1);
            }

            TimeSpan ts = DateTime.Now - dt;
            return ts.TotalSeconds;
        }