Ejemplo n.º 1
0
 public Engine()
 {
     _source        = null;
     _destination   = null;
     _matchList     = null;
     _diffStateList = null;
     _level         = DiffEngineLevel.Fast;
 }
Ejemplo n.º 2
0
 public DiffEngine()
 {
     _source    = null;
     _dest      = null;
     _matchList = null;
     _stateList = null;
     _level     = DiffEngineLevel.FastImperfect;
 }
Ejemplo n.º 3
0
 public DiffEngine()
 {
     _source = null;
     _dest = null;
     _matchList = null;
     _stateList = null;
     _level = DiffEngineLevel.FastImperfect;
 }
Ejemplo n.º 4
0
        public double ProcessDiff(IDiffList source, IDiffList destination)
        {
            DateTime dt = DateTime.Now;

            _source    = source;
            _dest      = destination;
            _matchList = new ArrayList();
            int dcount = _dest.Count();
            int scount = _source.Count();

            if ((dcount > 0) && (scount > 0))
            {
                _stateList = new DiffStateList(dcount);
                ProcessRange(0, dcount - 1, 0, scount - 1);
            }
            TimeSpan ts = DateTime.Now - dt;

            return(ts.TotalSeconds);
        }
Ejemplo n.º 5
0
		public double ProcessDiff(IDiffList source, IDiffList destination)
		{
			DateTime dt = DateTime.Now;
			_source = source;
			_dest = destination;
			_matchList = new ArrayList();
			
			int dcount = _dest.Count();
			int scount = _source.Count();
			
			
			if ((dcount > 0)&&(scount > 0))
			{
				_stateList = new DiffStateList(dcount);
				ProcessRange(0,dcount - 1,0, scount - 1);
			}

			TimeSpan ts = DateTime.Now - dt;
			return ts.TotalSeconds;
		}
Ejemplo n.º 6
0
        public ArrayList ProcessDiff(DiffEngineLevel level)
        {
            ArrayList result = new ArrayList();

            if (_source == null || _dest == null)
                return result;

            _level = level;
            _matchList = new ArrayList();

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

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

            //Deal with the special case of empty files
            if (dcount == 0) {
                if (scount > 0) {
                    result.Add(DiffResultSpan.CreateDeleteSource(0, scount));
                }
                return result;
            } else {
                if (scount == 0) {
                    result.Add(DiffResultSpan.CreateAddDestination(0, dcount));
                    return result;
                }
            }

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

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

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

            return result;
        }