Ejemplo n.º 1
0
        public static void RunStrongAlgorithm <TInternal, TExternal, TInternalKey, TExternalKey>(
            IEnumerable <TInternal> internals,
            IEnumerable <TExternal> externals,
            MatchHandlersAndKeys <TInternal, TExternal, TInternalKey, TExternalKey> handlers)
            where TInternal : class
            where TExternal : class
        {
            var manualMatchViewModel = new ManualMatchViewModel <TInternal, TExternal>(handlers.Handlers);
            var pendingData          = new MatchingPendingData <TInternal, TExternal>(internals, externals);

            var idMatch       = new TwoDirectionalIdMatch <TInternal, TExternal, TInternalKey, TExternalKey>(pendingData, handlers.KeySet);
            var idMatchResult = idMatch.Run();

            manualMatchViewModel.Pull(idMatchResult);
            pendingData = idMatchResult.GetPendingData();

            var nameMatch       = new NameMatch <TInternal, TExternal>(pendingData, handlers.Handlers);
            var nameMatchResult = nameMatch.Run();

            manualMatchViewModel.Pull(nameMatchResult);
            pendingData = nameMatchResult.GetPendingData();

            manualMatchViewModel.Pull(pendingData);

            manualMatchViewModel.Prepare();
            var window = new Tuto.Publishing.Views.ManualMatch();

            window.DataContext = manualMatchViewModel;
            window.ShowDialog();

            if (window.DialogResult == true)
            {
                manualMatchViewModel.Push(handlers.Updaters);
            }
        }
Ejemplo n.º 2
0
 public NameMatch(MatchingPendingData <TInternal, TExternal> pendingData, MatchHandlers <TInternal, TExternal> handlers)
 {
     this.internals        = pendingData.Internals.ToArray();
     this.externals        = pendingData.Externals.ToArray();
     this.internalSelector = handlers.InternalHandler.Name;
     this.externalSelector = handlers.ExternalHandler.Name;
     result = new MatchDataContainer <TInternal, TExternal>(internals, externals);
 }
Ejemplo n.º 3
0
 public void Pull(MatchingPendingData <TInternal, TExternal> pendingData)
 {
     foreach (var e in pendingData.Internals)
     {
         AddInternalUnmatched(e, MatchStatus.Pending);
     }
     foreach (var e in pendingData.Externals)
     {
         AddExternalUnmatched(e, MatchStatus.Pending);
     }
 }
Ejemplo n.º 4
0
        public TwoDirectionalIdMatch(
            MatchingPendingData <TInternal, TExternal> pendingData,
            MatchKeySet <TInternal, TExternal, TInternalKey, TExternalKey> KeySet)
        {
            this.Internal      = pendingData.Internals.ToList();
            this.External      = pendingData.Externals.ToList();
            this.intToInt      = KeySet.IntToInt;
            this.intToExt      = KeySet.IntToExt;
            this.extToInt      = KeySet.ExtToInt;
            this.extToExt      = KeySet.ExtToExt;
            this.emptyExternal = KeySet.EmptyExternal;
            this.emptyInternal = KeySet.EmptyInternal;

            result = new MatchDataContainer <TInternal, TExternal>(Internal, External);
        }
Ejemplo n.º 5
0
        public static void RunWeakAlgorithm <TInternal, TExternal>(
            IEnumerable <TInternal> internals,
            IEnumerable <TExternal> externals,
            MatchHandlers <TInternal, TExternal> handlers,
            MatchUpdater <TInternal, TExternal> updates)
        {
            var pendingData     = new MatchingPendingData <TInternal, TExternal>(internals, externals);
            var nameMatch       = new NameMatch <TInternal, TExternal>(pendingData, handlers);
            var nameMatchResult = nameMatch.Run();
            var model           = new ManualMatchViewModel <TInternal, TExternal>(handlers);

            model.Pull(nameMatchResult);
            model.Pull(nameMatchResult.GetPendingData());
            model.Push(updates);
        }