diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..1ff0c42
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c4efe2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,261 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
\ No newline at end of file
diff --git a/ASDC.Demo/ASDC.Demo.csproj b/ASDC.Demo/ASDC.Demo.csproj
new file mode 100644
index 0000000..a7274b9
--- /dev/null
+++ b/ASDC.Demo/ASDC.Demo.csproj
@@ -0,0 +1,206 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {05737572-92DD-4A52-A098-78FB96F9CB5A}
+ WinExe
+ ASDC.Demo
+ ASDC.Demo
+ v4.7
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ true
+
+
+
+ AnyCPU
+ true
+ full
+ false
+ ..\bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ 7.2
+
+
+ AnyCPU
+ none
+ true
+ ..\bin\Release\
+
+
+ prompt
+ 4
+ false
+
+
+ Resources\Icon.ico
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+
+ ListWindow.xaml
+
+
+ SearchTestWindow.xaml
+
+
+ SortTestWindow.xaml
+
+
+ TreeWindow.xaml
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ App.xaml
+ Code
+
+
+ TabItem.xaml
+
+
+
+
+
+
+ MainWindow.xaml
+ Code
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {6b1f81b6-002f-467e-bac5-007e0f8304d6}
+ ASDC
+
+
+
+
\ No newline at end of file
diff --git a/ASDC.Demo/App.config b/ASDC.Demo/App.config
new file mode 100644
index 0000000..9d2c7ad
--- /dev/null
+++ b/ASDC.Demo/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ASDC.Demo/App.xaml b/ASDC.Demo/App.xaml
new file mode 100644
index 0000000..bbce9bf
--- /dev/null
+++ b/ASDC.Demo/App.xaml
@@ -0,0 +1,1014 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ M0,0 L8,8 M0,8 L8,0
+ M0,0 H8 V8 H0 V0 M0,1 H8 M0,2 H8
+ M0,8 H8 M0,7 H8 M0,6 H8
+
+
+
+
+
+
+
diff --git a/ASDC.Demo/App.xaml.cs b/ASDC.Demo/App.xaml.cs
new file mode 100644
index 0000000..9c4526e
--- /dev/null
+++ b/ASDC.Demo/App.xaml.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+
+namespace ASDC.Demo
+{
+ ///
+ /// Логика взаимодействия для App.xaml
+ ///
+ public partial class App : Application
+ {
+ private void closeButton_Click(object sender, RoutedEventArgs e)
+ {
+ Window window = (sender as FrameworkElement).TemplatedParent as Window;
+ if (window != null)
+ SystemCommands.CloseWindow(window);
+ }
+
+ private void maximizeButton_Click(object sender, RoutedEventArgs e)
+ {
+ Window window = (sender as FrameworkElement).TemplatedParent as Window;
+ if (window != null)
+ if (window.WindowState == WindowState.Maximized)
+ SystemCommands.RestoreWindow(window);
+ else
+ SystemCommands.MaximizeWindow(window);
+ }
+
+ private void minimizeButton_Click(object sender, RoutedEventArgs e)
+ {
+ Window window = (sender as FrameworkElement).TemplatedParent as Window;
+ if (window != null)
+ SystemCommands.MinimizeWindow(window);
+ }
+
+ private void border_Loaded(object sender, RoutedEventArgs e)
+ {
+ Window window = (sender as FrameworkElement).TemplatedParent as Window;
+ window.MaxWidth = SystemParameters.WorkArea.Width + 11;
+ window.MaxHeight = SystemParameters.WorkArea.Height + 8;
+ }
+
+ private void closeButton_Click1(object sender, RoutedEventArgs e)
+ {
+ Controls.TabItem tabItem = (Controls.TabItem)(sender as FrameworkElement).TemplatedParent;
+ var tabControl = GetAncestor(tabItem);
+ int index = tabControl.Items.IndexOf(tabItem);
+ tabControl.Items.RemoveAt(index);
+ }
+
+ public static T GetAncestor(FrameworkElement element) where T : FrameworkElement
+ {
+ var result = (FrameworkElement)element.Parent;
+ while (!(result is T))
+ result = (FrameworkElement)result.Parent;
+ return (T)result;
+
+ }
+ }
+
+}
diff --git a/ASDC.Demo/Controls/TabItem.xaml b/ASDC.Demo/Controls/TabItem.xaml
new file mode 100644
index 0000000..89a288d
--- /dev/null
+++ b/ASDC.Demo/Controls/TabItem.xaml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/ASDC.Demo/Controls/TabItem.xaml.cs b/ASDC.Demo/Controls/TabItem.xaml.cs
new file mode 100644
index 0000000..443350a
--- /dev/null
+++ b/ASDC.Demo/Controls/TabItem.xaml.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using ASDC.Data;
+
+namespace ASDC.Demo.Controls
+{
+ ///
+ /// Логика взаимодействия для TabItem.xaml
+ ///
+ public partial class TabItem : TabItem where TKey : IComparable
+ {
+ public Table Table { get; }
+
+ public TabItemType TabItemType { get; }
+
+ public int Algorithm { get; }
+
+ public int ComparisionsCount { get; }
+
+ public long SwapsCount { get; }
+
+ public object Key { get; }
+
+ private TabItem()
+ {
+ InitializeComponent();
+ Style = (Style)Application.Current.TryFindResource("tabItemStyle");
+
+ }
+
+ public TabItem(Table table) : this()
+ {
+ dataGrid.ItemsSource = (Table = table).Rows;
+ TabItemType = TabItemType.File;
+ }
+
+ public TabItem(Table table, string key, int algorithm, int comparisionsCount) : this()
+ {
+ Key = key;
+ dataGrid.ItemsSource = (Table = table).Rows ?? new List();
+ TabItemType = TabItemType.Search;
+ Algorithm = algorithm;
+ ComparisionsCount = comparisionsCount;
+ }
+
+ public TabItem(Table table, int key, int algorithm, int comparisionsCount, long swapsCount) : this()
+ {
+ Key = key;
+ dataGrid.ItemsSource = (Table = table).Rows ?? new List();
+ TabItemType = TabItemType.Sort;
+ Algorithm = algorithm;
+ ComparisionsCount = comparisionsCount;
+ SwapsCount = swapsCount;
+ }
+ }
+}
diff --git a/ASDC.Demo/Controls/TabItemType.cs b/ASDC.Demo/Controls/TabItemType.cs
new file mode 100644
index 0000000..c0ba95f
--- /dev/null
+++ b/ASDC.Demo/Controls/TabItemType.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ASDC.Demo.Controls
+{
+ public enum TabItemType
+ {
+ File, Search, Sort
+ }
+}
diff --git a/ASDC.Demo/Data/Citizen.cs b/ASDC.Demo/Data/Citizen.cs
new file mode 100644
index 0000000..064b9a4
--- /dev/null
+++ b/ASDC.Demo/Data/Citizen.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Net;
+
+namespace ASDC.Data
+{
+
+ [Serializable]
+ public struct Citizen : IComparable, IComparable
+ {
+ public long PIN { get; set; }
+ public string FirstName { get; set; }
+ public string LastName { get; set; }
+ public DateTime Birth { get; set; }
+ public Gender Gender { get; set; }
+
+ public int CompareTo(Citizen other)
+ {
+#if DEBUG
+ return (FirstName, LastName).CompareTo((other.FirstName, other.LastName));
+#else
+ return PIN.CompareTo(other.PIN);
+#endif
+ }
+
+ public int CompareTo(object obj) => CompareTo((Citizen)obj);
+
+ }
+}
diff --git a/ASDC.Demo/Data/CitizenTable.cs b/ASDC.Demo/Data/CitizenTable.cs
new file mode 100644
index 0000000..f071ed1
--- /dev/null
+++ b/ASDC.Demo/Data/CitizenTable.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace ASDC.Data
+{
+ ///
+ /// Представляет рализацию таблицы со строками типа и ключём типа .
+ ///
+ public class CitizenTable : Table
+ {
+ public CitizenTable(int length) : base(length)
+ {
+
+ }
+
+ public CitizenTable(IEnumerable rows) : base(rows)
+ {
+
+ }
+
+ #region ~IHashTable~
+
+ public override Func HashFunction => (Id => Id.GetHashCode());
+
+ #endregion
+
+ #region ~ITable~
+
+ public override Func KeySelector => (user => user.PIN);
+
+ public void Open(string filename)
+ {
+
+ }
+
+ #endregion
+ }
+}
diff --git a/ASDC.Demo/Data/Gender.cs b/ASDC.Demo/Data/Gender.cs
new file mode 100644
index 0000000..cd2b052
--- /dev/null
+++ b/ASDC.Demo/Data/Gender.cs
@@ -0,0 +1,18 @@
+namespace ASDC.Data
+{
+ ///
+ /// Задаёт пол.
+ ///
+ public enum Gender
+ {
+ ///
+ /// Мужской.
+ ///
+ Male,
+
+ ///
+ /// Женский.
+ ///
+ Female
+ }
+}
diff --git a/ASDC.Demo/Data/Table.cs b/ASDC.Demo/Data/Table.cs
new file mode 100644
index 0000000..4b01677
--- /dev/null
+++ b/ASDC.Demo/Data/Table.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+using ASDC.Search;
+
+namespace ASDC.Data
+{
+ public abstract class Table : ITable, ITreeTable, IHashTable where TKey : IComparable
+ {
+ public int Length { get; }
+
+ public Table(int length)
+ {
+ Length = length;
+ Rows = new List(length);
+ Entries = new List[(int)(length * 1.5)];
+ ((ITreeTable)this).Rows = new List>();
+ }
+
+ public Table(IEnumerable Rows)
+ {
+ if (Rows != null)
+ this.Rows = new List(Rows);
+ else
+ this.Rows = new List();
+ }
+
+ #region ~IHashTable~
+
+ public IList[] Entries { get; set; }
+ public abstract Func HashFunction { get; }
+
+ #endregion
+
+ #region ~ITable~
+
+ public IList Rows { get; set; }
+ public abstract Func KeySelector { get; }
+
+ #endregion
+
+ #region ~IBinaryTree~
+
+ IList> ITreeTable.Rows { get; set; }
+
+ #endregion
+
+ #region ~Methods~
+
+ public void Add(TSource item)
+ {
+ Rows.Add(item);
+ ((IHashTable)this).Insert(KeySelector, item);
+ ((ITreeTable)this).Insert(KeySelector, item);
+ }
+
+ #endregion
+ }
+}
diff --git a/ASDC.Demo/ListWindow.xaml b/ASDC.Demo/ListWindow.xaml
new file mode 100644
index 0000000..27b6891
--- /dev/null
+++ b/ASDC.Demo/ListWindow.xaml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ASDC.Demo/ListWindow.xaml.cs b/ASDC.Demo/ListWindow.xaml.cs
new file mode 100644
index 0000000..c534d84
--- /dev/null
+++ b/ASDC.Demo/ListWindow.xaml.cs
@@ -0,0 +1,125 @@
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media.Imaging;
+using ASDC.Collections;
+using ASDC.Data;
+
+
+namespace ASDC
+{
+ ///
+ /// Логика взаимодействия для ListWindow.xaml
+ ///
+ public partial class ListWindow : Window
+ {
+ System.Collections.Generic.ICollection collection1;
+ System.Collections.Generic.ICollection collection2;
+
+ public ListWindow(System.Collections.Generic.ICollection collection) : this()
+ {
+ switch (collection1 = collection)
+ {
+ case ObservableStack stack:
+ collection2 = new ObservableStack();
+ clearMenuItem.ToolTip = clearMenuItem2.ToolTip += " стек";
+ break;
+ case ObservableQueue queue:
+ collection2 = new ObservableQueue();
+ addMenuItem.ToolTip = addMenuItem2.ToolTip = "Добавить элемент (Enqueue)";
+ removeMenuItem.ToolTip = removeMenuItem2.ToolTip = "Удалить элемент (Dequeue)";
+ clearMenuItem.ToolTip = clearMenuItem2.ToolTip += " очередь";
+ addMenuItem.Icon = new Image()
+ {
+ Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/AddBack.png"))
+ };
+ addMenuItem2.Icon = new Image()
+ {
+ Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/AddBack.png"))
+ };
+ break;
+ case ObservableDeque deque:
+ collection2 = new ObservableDeque();
+ clearMenuItem.ToolTip = clearMenuItem2.ToolTip += " двухстороннюю очередь";
+ addMenuItem.Header = "Добавить элемент в начало";
+ removeMenuItem.Header = "Удалить элемент с начала";
+ addMenuItem.ToolTip = addMenuItem2.ToolTip = "Добавить элемент в начало (PushFront)";
+ removeMenuItem.ToolTip = removeMenuItem2.ToolTip = "Удалить элемент с начала (PopFront)";
+ addBackMenuItem.Visibility = addBackMenuItem2.Visibility = removeBackMenuItem.Visibility = removeBackMenuItem2.Visibility = separator.Visibility = separator2.Visibility = Visibility.Visible;
+ break;
+ }
+ dataGrid.ItemsSource = collection2;
+ ((INotifyPropertyChanged)collection2).PropertyChanged += (sender, e) =>
+ {
+ addMenuItem.IsEnabled = addMenuItem2.IsEnabled = addBackMenuItem.IsEnabled = addBackMenuItem2.IsEnabled = collection1.Count > 0;
+ removeMenuItem.IsEnabled = removeMenuItem2.IsEnabled = removeBackMenuItem.IsEnabled = removeBackMenuItem2.IsEnabled = clearMenuItem.IsEnabled = clearMenuItem2.IsEnabled = collection2.Count > 0;
+ countTextBlock.Text = "Количество " + collection2.Count.ToString();
+ };
+ }
+
+
+ public ListWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void addMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ switch (collection1)
+ {
+ case ObservableStack stack:
+ ((ObservableStack)collection2).Push(stack.Pop());
+ break;
+ case ObservableQueue queue:
+ ((ObservableQueue)collection2).Enqueue(queue.Dequeue());
+ break;
+ case ObservableDeque deque:
+ ((ObservableDeque)collection2).PushFront(deque.PopFront());
+ break;
+ }
+ }
+
+ private void removeMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ switch (collection1)
+ {
+ case ObservableStack stack:
+ stack.Push(((ObservableStack)collection2).Pop());
+ break;
+ case ObservableQueue queue:
+ queue.Enqueue(((ObservableQueue)collection2).Dequeue());
+ break;
+ case ObservableDeque deque:
+ deque.PushFront(((ObservableDeque)collection2).PopFront());
+ break;
+ }
+ }
+
+ private void clearMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ // Не сокращать до лямбды
+ // Такой вызов вызывает делегат CollectionChanged Observable коллекций
+ switch (collection2)
+ {
+ case ObservableStack stack:
+ stack.Clear();
+ break;
+ case ObservableQueue queue:
+ queue.Clear();
+ break;
+ case ObservableDeque deque:
+ deque.Clear();
+ break;
+ }
+ }
+
+
+ private void closeMenuItem_Click(object sender, RoutedEventArgs e) => Close();
+
+ private void addBackMenuItem_Click(object sender, RoutedEventArgs e) => ((ObservableDeque)collection2).PushBack(((ObservableDeque)collection1).PopBack());
+
+ private void removeBackMenuItem_Click(object sender, RoutedEventArgs e) => ((ObservableDeque)collection1).PushBack(((ObservableDeque)collection2).PopBack());
+
+ }
+}
diff --git a/ASDC.Demo/MainWindow.xaml b/ASDC.Demo/MainWindow.xaml
new file mode 100644
index 0000000..305478e
--- /dev/null
+++ b/ASDC.Demo/MainWindow.xaml
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ASDC.Demo/MainWindow.xaml.cs b/ASDC.Demo/MainWindow.xaml.cs
new file mode 100644
index 0000000..130ebf5
--- /dev/null
+++ b/ASDC.Demo/MainWindow.xaml.cs
@@ -0,0 +1,388 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Xml.Linq;
+using ASDC.Data;
+using Microsoft.Win32;
+using ASDC.Demo.Controls;
+using ASDC.Search;
+using ASDC.Sort;
+using ASDC.Collections;
+using System.Windows.Media.Imaging;
+
+namespace ASDC.Demo
+{
+ ///
+ /// Логика взаимодействия для MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ OpenFileDialog openFileDialog;
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ openFileDialog = new OpenFileDialog()
+ {
+ Filter = "Бинарные файлы (*.bin)|*.bin"
+ };
+#if DEBUG
+ sortKeyComboBox.ItemsSource = typeof(Citizen).GetProperties().Select(p => p.Name).Union(new List { "FirstName + LastName" });
+ sortKeyComboBox.Width = 140.0;
+#else
+ sortKeyComboBox.ItemsSource = typeof(Citizen).GetProperties().Select(p => p.Name);
+#endif
+ }
+
+ private void openMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ statusTextBlock.Text = "Открытие...";
+ if (openFileDialog.ShowDialog() == true)
+ try
+ {
+ using (BinaryReader reader = new BinaryReader(File.OpenRead(openFileDialog.FileName)))
+ {
+ var table = new CitizenTable(reader.ReadInt32());
+ for (int i = 0; i < table.Length; i++)
+ {
+ Citizen item = new Citizen();
+ item.PIN = reader.ReadInt64();
+ int l1 = reader.ReadInt32();
+ for (int j = 0; j < l1; j++)
+ item.FirstName += reader.ReadChar();
+ int l2 = reader.ReadInt32();
+ for (int j = 0; j < l2; j++)
+ item.LastName += reader.ReadChar();
+ var day = reader.ReadInt32();
+ var month = reader.ReadInt32();
+ var year = reader.ReadInt32();
+ item.Birth = new DateTime(year, month, day);
+ item.Gender = (Gender)reader.ReadInt32();
+ table.Add(item);
+ }
+ tabControl.SelectedIndex = tabControl.Items.Add(new TabItem(table)
+ {
+ Header = System.IO.Path.GetFileName(openFileDialog.FileName)
+ });
+ Title = $"ASDC - {System.IO.Path.GetFileName(openFileDialog.FileName)}";
+ statusTextBlock.Text = "Готово";
+ }
+ }
+ catch (Exception ex)
+ {
+ tabControl.Items.Clear();
+ MessageBox.Show(ex.ToString(), "ACDC", MessageBoxButton.OK, MessageBoxImage.Error);
+ statusTextBlock.Text = "Ошибка";
+ }
+ else
+ statusTextBlock.Text = "Отменено";
+ }
+
+
+ // Пример преобразования XML в понятные для программы BIN файлы.
+
+ private void transformMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ statusTextBlock.Text = "Преобразование...";
+ List result = new List();
+ OpenFileDialog openFileDialog = new OpenFileDialog()
+ {
+ Title = "Преобразовать",
+ Filter = "XML файлы (*.xml)|*.xml"
+ };
+ if (openFileDialog.ShowDialog() == true)
+ {
+ try
+ {
+
+ XDocument doc = XDocument.Load(openFileDialog.FileName);
+ foreach (var record in doc.Element("dataset").Elements("record"))
+ {
+ result.Add(new Citizen()
+ {
+ PIN = long.Parse(record.Element("PIN").Value),
+ FirstName = record.Element("FirstName").Value,
+ LastName = record.Element("LastName").Value,
+ Gender = (Gender)int.Parse(record.Element("Gender").Value),
+ Birth = DateTime.Parse(record.Element("Birth").Value),
+ });
+ }
+
+ using (var writer = new BinaryWriter(new FileStream("citizens.bin", FileMode.OpenOrCreate)))
+ {
+ writer.Write(result.Count);
+ foreach (var item in result)
+ {
+ writer.Write(item.PIN);
+ writer.Write(item.FirstName.Length);
+ foreach (var c in item.FirstName)
+ writer.Write(c);
+
+ writer.Write(item.LastName.Length);
+ foreach (var c in item.LastName)
+ writer.Write(c);
+ writer.Write(item.Birth.Day);
+ writer.Write(item.Birth.Month);
+ writer.Write(item.Birth.Year);
+ writer.Write((int)item.Gender);
+ }
+ }
+ statusTextBlock.Text = "Готово";
+ }
+ catch (Exception)
+ {
+ MessageBox.Show("Не удалось преобразовать указанный файл!", "ASDC", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ }
+ }
+
+
+ private async void searchMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+
+ statusTextBlock.Text = "Поиск...";
+ if (long.TryParse(searchKeyTextBox.Text, out long keyValue))
+ {
+ var selectedItem = tabControl.SelectedItem as Controls.TabItem;
+ (IEnumerable result, int comparisonsCount) searchResult = default((IEnumerable, int));
+
+ switch ((SearchAlgorithm)searchAlgorithmComboBox.SelectedIndex)
+ {
+ case SearchAlgorithm.Linear:
+ searchResult = await selectedItem.Table.LinearSearchAsync(selectedItem.Table.KeySelector, keyValue);
+ break;
+ case SearchAlgorithm.Binary:
+ searchResult = await selectedItem.Table.BinarySearchAsync(selectedItem.Table.KeySelector, keyValue);
+ break;
+ case SearchAlgorithm.BinaryTree:
+ searchResult = selectedItem.Table.TreeSearch(selectedItem.Table.KeySelector, keyValue);
+ break;
+ case SearchAlgorithm.HashTable:
+ searchResult = await selectedItem.Table.HashSearchAsync(selectedItem.Table.KeySelector, keyValue);
+ break;
+ }
+
+ tabControl.SelectedIndex = tabControl.Items.Add(new TabItem(new CitizenTable(searchResult.result), searchKeyTextBox.Text, searchAlgorithmComboBox.SelectedIndex, searchResult.comparisonsCount)
+ {
+ Header = $"{selectedItem.Header} - поиск"
+ });
+
+ statusTextBlock.Text = "Готово";
+ }
+ else
+ {
+ MessageBox.Show("Введённое значение не является целым числом!", "ASDC", MessageBoxButton.OK, MessageBoxImage.Error);
+ statusTextBlock.Text = "Ошибка";
+ }
+
+ }
+
+ private void tabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ var selectedItem = tabControl.SelectedItem as TabItem;
+
+ if (selectedItem == null)
+ {
+ openMenuItem.IsEnabled = openMenu2.IsEnabled = true;
+ searchAlgorithmComboBox.IsEnabled = searchKeyTextBox.IsEnabled = searchMenuItem.IsEnabled = searchTestMenuItem.IsEnabled = sortAlgorithmComboBox.IsEnabled = sortKeyComboBox.IsEnabled = sortMenuItem.IsEnabled = sortTestMenuItem.IsEnabled = stackMenuItem.IsEnabled = queueMenuItem.IsEnabled = dequeMenuItem.IsEnabled = inorderMenuItem.IsEnabled = preorderMenuItem.IsEnabled = postorderMenuItem.IsEnabled = false;
+ }
+ else if ( selectedItem.TabItemType == TabItemType.Search)
+ {
+ openMenuItem.IsEnabled = openMenu2.IsEnabled = false;
+ searchAlgorithmComboBox.SelectedIndex = selectedItem.Algorithm;
+ searchKeyTextBox.Text = selectedItem.Key.ToString();
+ sortAlgorithmComboBox.SelectedIndex = -1;
+ sortKeyComboBox.SelectedIndex = -1;
+
+ searchAlgorithmComboBox.IsEnabled = searchKeyTextBox.IsEnabled = searchMenuItem.IsEnabled = searchTestMenuItem.IsEnabled = sortAlgorithmComboBox.IsEnabled = sortKeyComboBox.IsEnabled = sortMenuItem.IsEnabled = sortTestMenuItem.IsEnabled = stackMenuItem.IsEnabled = queueMenuItem.IsEnabled = dequeMenuItem.IsEnabled = inorderMenuItem.IsEnabled = preorderMenuItem.IsEnabled = postorderMenuItem.IsEnabled = false;
+
+ comparisionsCountTextBlock.Text = $"Сравнений {selectedItem.ComparisionsCount.ToString()}";
+ comparisionsCountTextBlock.Visibility = Visibility.Visible;
+ }
+ else if (selectedItem != null && selectedItem.TabItemType == TabItemType.Sort)
+ {
+ openMenuItem.IsEnabled = openMenu2.IsEnabled = false;
+ searchAlgorithmComboBox.SelectedIndex = -1;
+ searchKeyTextBox.Text = string.Empty;
+ sortAlgorithmComboBox.SelectedIndex = selectedItem.Algorithm;
+ sortKeyComboBox.SelectedIndex = (int)selectedItem.Key;
+
+ searchAlgorithmComboBox.IsEnabled = searchKeyTextBox.IsEnabled = searchMenuItem.IsEnabled = searchTestMenuItem.IsEnabled = sortAlgorithmComboBox.IsEnabled = sortKeyComboBox.IsEnabled = sortMenuItem.IsEnabled = sortTestMenuItem.IsEnabled = stackMenuItem.IsEnabled = queueMenuItem.IsEnabled = dequeMenuItem.IsEnabled = inorderMenuItem.IsEnabled = preorderMenuItem.IsEnabled = postorderMenuItem.IsEnabled = false;
+
+ comparisionsCountTextBlock.Text = $"Сравнений {selectedItem.ComparisionsCount.ToString()}";
+ comparisionsCountTextBlock.Visibility = Visibility.Visible;
+ timeTextBlock.Text = $"Перестановок {selectedItem.SwapsCount.ToString()}";
+ timeTextBlock.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ openMenuItem.IsEnabled = openMenu2.IsEnabled = false;
+ searchAlgorithmComboBox.IsEnabled = searchKeyTextBox.IsEnabled = searchTestMenuItem.IsEnabled = sortAlgorithmComboBox.IsEnabled = sortKeyComboBox.IsEnabled = sortTestMenuItem.IsEnabled = stackMenuItem.IsEnabled = queueMenuItem.IsEnabled = dequeMenuItem.IsEnabled = inorderMenuItem.IsEnabled = preorderMenuItem.IsEnabled = postorderMenuItem.IsEnabled = true;
+ searchMenuItem.IsEnabled = searchAlgorithmComboBox.SelectedIndex != -1 && !string.IsNullOrWhiteSpace(searchKeyTextBox.Text);
+ sortMenuItem.IsEnabled = sortAlgorithmComboBox.SelectedIndex != -1 && sortKeyComboBox.SelectedIndex != -1;
+ comparisionsCountTextBlock.Visibility = Visibility.Hidden;
+ timeTextBlock.Visibility = Visibility.Hidden;
+ }
+ }
+
+ private void searchAlgorithmComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ searchMenuItem.IsEnabled = searchAlgorithmComboBox.SelectedIndex != -1 && !string.IsNullOrWhiteSpace(searchKeyTextBox.Text);
+ }
+
+ private void searchKeyTextBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ searchMenuItem.IsEnabled = searchAlgorithmComboBox.SelectedIndex != -1 && !string.IsNullOrWhiteSpace(searchKeyTextBox.Text);
+ }
+
+ private void sortKeyComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ sortMenuItem.IsEnabled = sortAlgorithmComboBox.SelectedIndex != -1 && sortKeyComboBox.SelectedIndex != -1;
+ }
+
+ private void sortMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ statusTextBlock.Text = "Сортировка...";
+ var selectedItem = tabControl.SelectedItem as TabItem;
+
+ (IEnumerable result, int comparisonsCount, int swapsCount) searchResult = default((IEnumerable, int, int));
+
+#if DEBUG
+ if (sortKeyComboBox.Text == "FirstName + LastName")
+ {
+ Func keySelector = (row => (row.FirstName, row.LastName));
+ switch ((SortAlgorithm)sortAlgorithmComboBox.SelectedIndex)
+ {
+ case SortAlgorithm.Bubble:
+ searchResult = selectedItem.Table.BubbleSort(keySelector);
+ break;
+ case SortAlgorithm.Quick:
+ searchResult = selectedItem.Table.QuickSort(keySelector);
+ break;
+ case SortAlgorithm.Selection:
+ searchResult = selectedItem.Table.SelectionSort(keySelector);
+ break;
+ case SortAlgorithm.Heap:
+ searchResult = selectedItem.Table.HeapSort(keySelector);
+ break;
+ case SortAlgorithm.Insert:
+ searchResult = selectedItem.Table.InsertSort(keySelector);
+ break;
+ case SortAlgorithm.Shell:
+ searchResult = selectedItem.Table.ShellSort(keySelector);
+ break;
+ }
+ }
+ else
+#endif
+ switch ((SortAlgorithm)sortAlgorithmComboBox.SelectedIndex)
+ {
+ case SortAlgorithm.Bubble:
+ searchResult = selectedItem.Table.BubbleSort(row => (IComparable)row.GetType().GetProperty(sortKeyComboBox.Text).GetValue(row));
+ break;
+ case SortAlgorithm.Quick:
+ searchResult = selectedItem.Table.QuickSort(row => (IComparable)row.GetType().GetProperty(sortKeyComboBox.Text).GetValue(row));
+ break;
+ case SortAlgorithm.Selection:
+ searchResult = selectedItem.Table.SelectionSort(row => (IComparable)row.GetType().GetProperty(sortKeyComboBox.Text).GetValue(row));
+ break;
+ case SortAlgorithm.Heap:
+ searchResult = selectedItem.Table.HeapSort(row => (IComparable)row.GetType().GetProperty(sortKeyComboBox.Text).GetValue(row));
+ break;
+ case SortAlgorithm.Insert:
+ searchResult = selectedItem.Table.InsertSort(row => (IComparable)row.GetType().GetProperty(sortKeyComboBox.Text).GetValue(row));
+ break;
+ case SortAlgorithm.Shell:
+ searchResult = selectedItem.Table.ShellSort(row => (IComparable)row.GetType().GetProperty(sortKeyComboBox.Text).GetValue(row));
+ break;
+ }
+
+ tabControl.SelectedIndex = tabControl.Items.Add(new TabItem(new CitizenTable(searchResult.result), sortKeyComboBox.SelectedIndex, sortAlgorithmComboBox.SelectedIndex, searchResult.comparisonsCount, searchResult.swapsCount)
+ {
+ Header = $"{selectedItem.Header} - сортировка"
+ });
+
+ statusTextBlock.Text = "Готово";
+
+ }
+
+ private void sortTestMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ new SortTestWindow()
+ {
+ Owner = this
+ }.ShowDialog((CitizenTable)(tabControl.SelectedItem as TabItem).Table);
+ }
+
+ private void searchTestMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ new SearchTestWindow()
+ {
+ Owner = this
+ }.ShowDialog((tabControl.SelectedItem as TabItem).Table);
+ }
+
+ private void stackMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ new ListWindow(new ObservableStack((tabControl.SelectedItem as TabItem).Table.Rows))
+ {
+ Title = "Стек",
+ Owner = this,
+ Icon = new BitmapImage(new Uri(@"pack://application:,,,/Resources/Stack.png"))
+ }.ShowDialog();
+ }
+
+ private void queueMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ new ListWindow(new ObservableQueue((tabControl.SelectedItem as TabItem).Table.Rows))
+ {
+ Title = "Очередь",
+ Owner = this,
+ Icon = new BitmapImage(new Uri(@"pack://application:,,,/Resources/Queue.png"))
+ }.ShowDialog();
+ }
+
+ private void dequeMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ new ListWindow(new ObservableDeque((tabControl.SelectedItem as TabItem).Table.Rows))
+ {
+ Title = "Двухсторонняя очередь",
+ Owner = this,
+ Icon = new BitmapImage(new Uri(@"pack://application:,,,/Resources/Deque.png"))
+ }.ShowDialog();
+ }
+
+ private void preorderMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ new TreeWindow(new BinarySearchTree((tabControl.SelectedItem as TabItem).Table.Rows).PreorderTraverse())
+ {
+ Title = "Прямой обход",
+ Owner = this,
+ Icon = new BitmapImage(new Uri(@"pack://application:,,,/Resources/Preorder.png"))
+ }.ShowDialog();
+ }
+
+ private void inorderMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ new TreeWindow(new BinarySearchTree((tabControl.SelectedItem as TabItem).Table.Rows).InorderTraverse())
+ {
+ Title = "Симметричный обход",
+ Owner = this,
+ Icon = new BitmapImage(new Uri(@"pack://application:,,,/Resources/Inorder.png"))
+ }.ShowDialog();
+ }
+
+ private void postorderMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ new TreeWindow(new BinarySearchTree((tabControl.SelectedItem as TabItem).Table.Rows).PostorderTraverse())
+ {
+ Title = "Обратный обход",
+ Owner = this,
+ Icon = new BitmapImage(new Uri(@"pack://application:,,,/Resources/Postorder.png"))
+ }.ShowDialog();
+ }
+ }
+}
diff --git a/ASDC.Demo/Properties/AssemblyInfo.cs b/ASDC.Demo/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..c520d4c
--- /dev/null
+++ b/ASDC.Demo/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// Общие сведения об этой сборке предоставляются следующим набором
+// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
+// связанные со сборкой.
+[assembly: AssemblyTitle("ASDC")]
+[assembly: AssemblyDescription("Демонстрация лабораторных работ №1-3")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("USM I1602")]
+[assembly: AssemblyProduct("ASDC")]
+[assembly: AssemblyCopyright("Copyright Козлович Артём © 2018")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
+// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
+// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
+[assembly: ComVisible(false)]
+
+//Чтобы начать создание локализуемых приложений, задайте
+//CultureYouAreCodingWith в файле .csproj
+//внутри . Например, если используется английский США
+//в своих исходных файлах установите в en-US. Затем отмените преобразование в комментарий
+//атрибута NeutralResourceLanguage ниже. Обновите "en-US" в
+//строка внизу для обеспечения соответствия настройки UICulture в файле проекта.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //где расположены словари ресурсов по конкретным тематикам
+ //(используется, если ресурс не найден на странице,
+ // или в словарях ресурсов приложения)
+ ResourceDictionaryLocation.SourceAssembly //где расположен словарь универсальных ресурсов
+ //(используется, если ресурс не найден на странице,
+ // в приложении или в каких-либо словарях ресурсов для конкретной темы)
+)]
+
+
+// Сведения о версии сборки состоят из следующих четырех значений:
+//
+// Основной номер версии
+// Дополнительный номер версии
+// Номер сборки
+// Редакция
+//
+// Можно задать все значения или принять номер сборки и номер редакции по умолчанию.
+// используя "*", как показано ниже:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("2.0.0.0")]
+[assembly: AssemblyFileVersion("2.0.0.0")]
diff --git a/ASDC.Demo/Properties/Resources.Designer.cs b/ASDC.Demo/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..072d03a
--- /dev/null
+++ b/ASDC.Demo/Properties/Resources.Designer.cs
@@ -0,0 +1,223 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace ASDC.Demo.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASDC.Demo.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap AddBack {
+ get {
+ object obj = ResourceManager.GetObject("AddBack", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap AddFront {
+ get {
+ object obj = ResourceManager.GetObject("AddFront", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Clear {
+ get {
+ object obj = ResourceManager.GetObject("Clear", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Deque {
+ get {
+ object obj = ResourceManager.GetObject("Deque", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Exit {
+ get {
+ object obj = ResourceManager.GetObject("Exit", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Icon, аналогичного (Значок).
+ ///
+ internal static System.Drawing.Icon Icon {
+ get {
+ object obj = ResourceManager.GetObject("Icon", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Inorder {
+ get {
+ object obj = ResourceManager.GetObject("Inorder", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Open {
+ get {
+ object obj = ResourceManager.GetObject("Open", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Postorder {
+ get {
+ object obj = ResourceManager.GetObject("Postorder", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Preorder {
+ get {
+ object obj = ResourceManager.GetObject("Preorder", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Queue {
+ get {
+ object obj = ResourceManager.GetObject("Queue", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap RemoveBack {
+ get {
+ object obj = ResourceManager.GetObject("RemoveBack", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap RemoveFront {
+ get {
+ object obj = ResourceManager.GetObject("RemoveFront", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Search {
+ get {
+ object obj = ResourceManager.GetObject("Search", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Sort {
+ get {
+ object obj = ResourceManager.GetObject("Sort", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Stack {
+ get {
+ object obj = ResourceManager.GetObject("Stack", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/ASDC.Demo/Properties/Resources.resx b/ASDC.Demo/Properties/Resources.resx
new file mode 100644
index 0000000..a0b3e97
--- /dev/null
+++ b/ASDC.Demo/Properties/Resources.resx
@@ -0,0 +1,169 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\Resources\AddBack.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\AddFront.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Deque.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Exit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Inorder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Postorder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Preorder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Queue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\RemoveBack.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\RemoveFront.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Search.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Sort.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Stack.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/ASDC.Demo/Properties/Settings.Designer.cs b/ASDC.Demo/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..ab97efe
--- /dev/null
+++ b/ASDC.Demo/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace ASDC.Demo.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/ASDC.Demo/Properties/Settings.settings b/ASDC.Demo/Properties/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/ASDC.Demo/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ASDC.Demo/Resources/AddBack.png b/ASDC.Demo/Resources/AddBack.png
new file mode 100644
index 0000000..fce67ac
Binary files /dev/null and b/ASDC.Demo/Resources/AddBack.png differ
diff --git a/ASDC.Demo/Resources/AddFront.png b/ASDC.Demo/Resources/AddFront.png
new file mode 100644
index 0000000..a612357
Binary files /dev/null and b/ASDC.Demo/Resources/AddFront.png differ
diff --git a/ASDC.Demo/Resources/Clear.png b/ASDC.Demo/Resources/Clear.png
new file mode 100644
index 0000000..510b507
Binary files /dev/null and b/ASDC.Demo/Resources/Clear.png differ
diff --git a/ASDC.Demo/Resources/Deque.png b/ASDC.Demo/Resources/Deque.png
new file mode 100644
index 0000000..d53df81
Binary files /dev/null and b/ASDC.Demo/Resources/Deque.png differ
diff --git a/ASDC.Demo/Resources/Exit.png b/ASDC.Demo/Resources/Exit.png
new file mode 100644
index 0000000..36654d6
Binary files /dev/null and b/ASDC.Demo/Resources/Exit.png differ
diff --git a/ASDC.Demo/Resources/Icon.ico b/ASDC.Demo/Resources/Icon.ico
new file mode 100644
index 0000000..08ca794
Binary files /dev/null and b/ASDC.Demo/Resources/Icon.ico differ
diff --git a/ASDC.Demo/Resources/Inorder.png b/ASDC.Demo/Resources/Inorder.png
new file mode 100644
index 0000000..0465e46
Binary files /dev/null and b/ASDC.Demo/Resources/Inorder.png differ
diff --git a/ASDC.Demo/Resources/Open.png b/ASDC.Demo/Resources/Open.png
new file mode 100644
index 0000000..b9e1d55
Binary files /dev/null and b/ASDC.Demo/Resources/Open.png differ
diff --git a/ASDC.Demo/Resources/Postorder.png b/ASDC.Demo/Resources/Postorder.png
new file mode 100644
index 0000000..c9742c4
Binary files /dev/null and b/ASDC.Demo/Resources/Postorder.png differ
diff --git a/ASDC.Demo/Resources/Preorder.png b/ASDC.Demo/Resources/Preorder.png
new file mode 100644
index 0000000..0cee8ff
Binary files /dev/null and b/ASDC.Demo/Resources/Preorder.png differ
diff --git a/ASDC.Demo/Resources/Queue.png b/ASDC.Demo/Resources/Queue.png
new file mode 100644
index 0000000..59b8f49
Binary files /dev/null and b/ASDC.Demo/Resources/Queue.png differ
diff --git a/ASDC.Demo/Resources/RemoveBack.png b/ASDC.Demo/Resources/RemoveBack.png
new file mode 100644
index 0000000..1a59d5d
Binary files /dev/null and b/ASDC.Demo/Resources/RemoveBack.png differ
diff --git a/ASDC.Demo/Resources/RemoveFront.png b/ASDC.Demo/Resources/RemoveFront.png
new file mode 100644
index 0000000..38a310a
Binary files /dev/null and b/ASDC.Demo/Resources/RemoveFront.png differ
diff --git a/ASDC.Demo/Resources/Search.png b/ASDC.Demo/Resources/Search.png
new file mode 100644
index 0000000..ed5d30f
Binary files /dev/null and b/ASDC.Demo/Resources/Search.png differ
diff --git a/ASDC.Demo/Resources/SearchDisabled.png b/ASDC.Demo/Resources/SearchDisabled.png
new file mode 100644
index 0000000..c5e76c2
Binary files /dev/null and b/ASDC.Demo/Resources/SearchDisabled.png differ
diff --git a/ASDC.Demo/Resources/Sort.png b/ASDC.Demo/Resources/Sort.png
new file mode 100644
index 0000000..c3dc691
Binary files /dev/null and b/ASDC.Demo/Resources/Sort.png differ
diff --git a/ASDC.Demo/Resources/SortDisabled.png b/ASDC.Demo/Resources/SortDisabled.png
new file mode 100644
index 0000000..bd118c5
Binary files /dev/null and b/ASDC.Demo/Resources/SortDisabled.png differ
diff --git a/ASDC.Demo/Resources/Stack.png b/ASDC.Demo/Resources/Stack.png
new file mode 100644
index 0000000..8afb0bb
Binary files /dev/null and b/ASDC.Demo/Resources/Stack.png differ
diff --git a/ASDC.Demo/SearchTestWindow.xaml b/ASDC.Demo/SearchTestWindow.xaml
new file mode 100644
index 0000000..97a9c35
--- /dev/null
+++ b/ASDC.Demo/SearchTestWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
diff --git a/ASDC.Demo/SearchTestWindow.xaml.cs b/ASDC.Demo/SearchTestWindow.xaml.cs
new file mode 100644
index 0000000..180ff24
--- /dev/null
+++ b/ASDC.Demo/SearchTestWindow.xaml.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows;
+using ASDC.Data;
+
+namespace ASDC.Demo
+{
+ ///
+ /// Логика взаимодействия для SearchTestWindow.xaml
+ ///
+ public partial class SearchTestWindow : Window
+ {
+
+ public SearchTestWindow()
+ {
+ InitializeComponent();
+
+ }
+
+ ///
+ /// Открывает окно с результатами сложности поиска в таблице и возвращается только после закрытия нового открытого окна.
+ ///
+ /// Тип строк в таблице .
+ /// Тип ключа в таблице .
+ /// Таблица для по которой должна быть представлена информация о сложности поиска.
+ /// Значение типа указывающий, принято ли действие (true) или отменено (false). Возвращаемое значение является значением свойства перед закрытием окна.
+ public bool? ShowDialog(Table source) where TKey : IComparable
+ {
+ dataGrid.Items.Add(new { Algorithm = "Linear", Complexity = SearchComplexity(source, Search.Extensions.LinearSearch, source.KeySelector), TheoreticalComplexity = (source.Rows.Count + 1) / 2.0 });
+ dataGrid.Items.Add(new { Algorithm = "Binary", Complexity = SearchComplexity(source, Search.Extensions.BinarySearch, source.KeySelector), TheoreticalComplexity = Math.Log(source.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Tree", Complexity = SearchComplexity(source, Search.Extensions.TreeSearch, source.KeySelector), TheoreticalComplexity = Math.Log(source.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Hash", Complexity = SearchComplexity(source, Search.Extensions.HashSearch, source.KeySelector), TheoreticalComplexity = 1 + (source.Rows.Count - 1) / (2.0 * ((IHashTable)source).Entries.Length) });
+ return ShowDialog();
+ }
+
+ private double SearchComplexity(Table source, Func, Func, TKey, (IEnumerable result, int comparisionsCount)> searchFunction, Func keySelector) where TKey : IComparable
+ {
+ return source.Rows.Sum(row => searchFunction(source, keySelector, keySelector(row)).comparisionsCount) / (double)source.Rows.Count;
+ }
+
+ }
+}
diff --git a/ASDC.Demo/SortTestWindow.xaml b/ASDC.Demo/SortTestWindow.xaml
new file mode 100644
index 0000000..911867d
--- /dev/null
+++ b/ASDC.Demo/SortTestWindow.xaml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ASDC.Demo/SortTestWindow.xaml.cs b/ASDC.Demo/SortTestWindow.xaml.cs
new file mode 100644
index 0000000..e0e8b97
--- /dev/null
+++ b/ASDC.Demo/SortTestWindow.xaml.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Windows;
+using ASDC.Data;
+using ASDC.Sort;
+using static System.Math;
+
+namespace ASDC.Demo
+{
+ ///
+ /// Логика взаимодействия для SortTestWindow.xaml
+ ///
+ public partial class SortTestWindow : Window
+ {
+ public SortTestWindow()
+ {
+ InitializeComponent();
+
+ }
+
+
+
+#if DEBUG
+ public bool? ShowDialog(CitizenTable table)
+ {
+ Func keySelector = (row => (row.FirstName, row.LastName));
+ dataGrid.Items.Add(new { Algorithm = "Bubble", MinComplexity = table.Rows.Count, Complexity = table.BubbleSort(keySelector).comparisonsCount, MaxComplexity = Pow(table.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Quick", MinComplexity = table.Rows.Count * Log(table.Rows.Count, 2), Complexity = table.QuickSort(keySelector).comparisonsCount, MaxComplexity = Pow(table.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Selection", MinComplexity = Pow(table.Rows.Count, 2), Complexity = table.SelectionSort(keySelector).comparisonsCount, MaxComplexity = Pow(table.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Heap", MinComplexity = table.Rows.Count * Log(table.Rows.Count, 2), Complexity = table.HeapSort(keySelector).comparisonsCount, MaxComplexity = table.Rows.Count * Log(table.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Insertion", MinComplexity = table.Rows.Count, Complexity = table.InsertSort(keySelector).comparisonsCount, MaxComplexity = Pow(table.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Shell", MinComplexity = table.Rows.Count * Log(table.Rows.Count, 2), Complexity = table.ShellSort(keySelector).comparisonsCount, MaxComplexity = Pow(table.Rows.Count, 2) });
+
+ return ShowDialog();
+ }
+#else
+ ///
+ /// Открывает окно с результатами сложности сортировки в таблице и возвращается только после закрытия нового открытого окна.
+ ///
+ /// Тип строк в таблице .
+ /// Тип ключа в таблице .
+ /// Таблица для по которой должна быть представлена информация о сложности сортировки.
+ /// Значение типа указывающий, принято ли действие (true) или отменено (false). Возвращаемое значение является значением свойства перед закрытием окна.
+ public bool? ShowDialog(Table table) where TKey : IComparable
+ {
+
+ dataGrid.Items.Add(new { Algorithm = "Bubble", MinComplexity = table.Rows.Count, Complexity = table.BubbleSort(table.KeySelector).comparisonsCount, MaxComplexity = Pow(table.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Quick", MinComplexity = table.Rows.Count * Log(table.Rows.Count, 2), Complexity = table.QuickSort(table.KeySelector).comparisonsCount, MaxComplexity = Pow(table.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Selection", MinComplexity = Pow(table.Rows.Count, 2), Complexity = table.SelectionSort(table.KeySelector).comparisonsCount, MaxComplexity = Pow(table.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Heap", MinComplexity = table.Rows.Count * Log(table.Rows.Count, 2), Complexity = table.HeapSort(table.KeySelector).comparisonsCount, MaxComplexity = table.Rows.Count * Log(table.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Insert", MinComplexity = table.Rows.Count, Complexity = table.InsertSort(table.KeySelector).comparisonsCount, MaxComplexity = Pow(table.Rows.Count, 2) });
+ dataGrid.Items.Add(new { Algorithm = "Shell", MinComplexity = table.Rows.Count * Log(table.Rows.Count, 2), Complexity = table.ShellSort(table.KeySelector).comparisonsCount, MaxComplexity = Pow(table.Rows.Count, 2) });
+
+ return ShowDialog();
+ }
+#endif
+
+ }
+}
diff --git a/ASDC.Demo/TreeWindow.xaml b/ASDC.Demo/TreeWindow.xaml
new file mode 100644
index 0000000..09351cc
--- /dev/null
+++ b/ASDC.Demo/TreeWindow.xaml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/ASDC.Demo/TreeWindow.xaml.cs b/ASDC.Demo/TreeWindow.xaml.cs
new file mode 100644
index 0000000..9c02aa5
--- /dev/null
+++ b/ASDC.Demo/TreeWindow.xaml.cs
@@ -0,0 +1,22 @@
+using System.Collections.Generic;
+using System.Windows;
+using ASDC.Data;
+
+namespace ASDC
+{
+ ///
+ /// Логика взаимодействия для TreeWindow.xaml
+ ///
+ public partial class TreeWindow : Window
+ {
+ public TreeWindow(IEnumerable collection) : this()
+ {
+ dataGrid.ItemsSource = collection;
+ }
+
+ public TreeWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ASDC.Demo/citizens.bin b/ASDC.Demo/citizens.bin
new file mode 100644
index 0000000..c3e9975
Binary files /dev/null and b/ASDC.Demo/citizens.bin differ
diff --git a/ASDC.Demo/citizens.min.bin b/ASDC.Demo/citizens.min.bin
new file mode 100644
index 0000000..afd14c8
Binary files /dev/null and b/ASDC.Demo/citizens.min.bin differ
diff --git a/ASDC.Lab4/ASDC.Lab4.vcxproj b/ASDC.Lab4/ASDC.Lab4.vcxproj
new file mode 100644
index 0000000..f51ca2a
--- /dev/null
+++ b/ASDC.Lab4/ASDC.Lab4.vcxproj
@@ -0,0 +1,185 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 15.0
+ {9BE548AE-7068-44D7-9C9D-4AFEA6F0C260}
+ Win32Proj
+ ASDCLab4
+ 10.0.16299.0
+
+
+
+ Application
+ true
+ v141
+ Unicode
+
+
+ Application
+ false
+ v141
+ true
+ Unicode
+
+
+ Application
+ true
+ v141
+ Unicode
+
+
+ Application
+ false
+ v141
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)\bin\$(Configuration)\
+ $(Configuration)\
+
+
+ true
+ $(SolutionDir)\bin\$(Configuration)\
+ $(Configuration)\
+
+
+ false
+ $(SolutionDir)\bin\$(Configuration)\
+
+
+ false
+ $(SolutionDir)\bin\$(Configuration)\
+ $(Configuration)\
+
+
+
+ Use
+ Level3
+ Disabled
+ true
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+ Use
+ Level3
+ Disabled
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+ Use
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+ Use
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ASDC.Lab4/ASDC.Lab4.vcxproj.filters b/ASDC.Lab4/ASDC.Lab4.vcxproj.filters
new file mode 100644
index 0000000..4b7483f
--- /dev/null
+++ b/ASDC.Lab4/ASDC.Lab4.vcxproj.filters
@@ -0,0 +1,78 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {4520a562-82b1-49cc-be43-c1d1f012957c}
+
+
+ {2d6d827e-065b-4c23-8b9c-52b195ec5c0d}
+
+
+
+
+ Файлы заголовков
+
+
+ Файлы заголовков
+
+
+ Файлы заголовков
+
+
+ Файлы заголовков\matrix
+
+
+ Файлы заголовков\matrix
+
+
+ Файлы заголовков\matrix
+
+
+ Файлы заголовков\matrix
+
+
+ Файлы заголовков\matrix
+
+
+ Файлы заголовков\matrix
+
+
+ Файлы заголовков\matrix
+
+
+ Файлы заголовков\matrix
+
+
+ Файлы заголовков\matrix
+
+
+ Файлы заголовков\data
+
+
+ Файлы заголовков\data
+
+
+
+
+ Исходные файлы
+
+
+ Исходные файлы
+
+
+ Исходные файлы
+
+
+
\ No newline at end of file
diff --git a/ASDC.Lab4/_matrix4.h b/ASDC.Lab4/_matrix4.h
new file mode 100644
index 0000000..0dee68f
--- /dev/null
+++ b/ASDC.Lab4/_matrix4.h
@@ -0,0 +1,57 @@
+#pragma once
+
+template
+///
+/// , .
+///
+class _matrix4
+{
+public:
+ ///
+ /// .
+ ///
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ virtual T& at(int i1, int i2, int i3, int i4) = 0;
+
+ ///
+ /// .
+ ///
+ virtual size_t getLength() = 0;
+
+ ///
+ /// , .
+ ///
+ /// , , .
+ /// 32- , .
+ virtual int getLength(int dimension) = 0;
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ virtual int getAddCount() = 0;
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ virtual int getMulCount() = 0;
+
+ ///
+ /// .
+ ///
+ /// , , .
+ /// .
+ virtual int getLowerBound(int dimension) = 0;
+
+ ///
+ /// .
+ ///
+ /// , , .
+ /// .
+ virtual int getUpperBound(int dimension) = 0;
+};
diff --git a/ASDC.Lab4/citizen.cpp b/ASDC.Lab4/citizen.cpp
new file mode 100644
index 0000000..9a50484
--- /dev/null
+++ b/ASDC.Lab4/citizen.cpp
@@ -0,0 +1,36 @@
+#include "stdafx.h"
+#include "citizen.h"
+
+
+CITIZEN::CITIZEN()
+{
+ first_name = new char('\0');
+ last_name = new char('\0');
+ birth = tm();
+}
+
+CITIZEN::CITIZEN(FILE * file)
+{
+ fread(&pin, sizeof(int64_t), 1, file);
+ int count;
+ fread(&count, sizeof(int), 1, file);
+ first_name = new char[count + 1];
+ fread(first_name, sizeof(char), count, file);
+ first_name[count] = '\0';
+ fread(&count, sizeof(int), 1, file);
+ last_name = new char[count + 1];
+ fread(last_name, sizeof(char), count, file);
+ last_name[count] = '\0';
+ birth = tm();
+ fread(&birth.tm_mday, sizeof(int), 1, file);
+ fread(&birth.tm_mon, sizeof(int), 1, file);
+ fread(&birth.tm_year, sizeof(int), 1, file);
+ fread(&gender, sizeof(int), 1, file);
+}
+
+
+CITIZEN::~CITIZEN()
+{
+ //delete[] first_name;
+ //delete[] last_name;
+}
diff --git a/ASDC.Lab4/citizen.h b/ASDC.Lab4/citizen.h
new file mode 100644
index 0000000..40f2149
--- /dev/null
+++ b/ASDC.Lab4/citizen.h
@@ -0,0 +1,17 @@
+#pragma once
+
+class CITIZEN
+{
+public:
+
+ int64_t pin;
+ char* first_name;
+ char* last_name;
+ tm birth;
+ GENDER gender;
+
+ CITIZEN();
+ CITIZEN(FILE* file);
+ ~CITIZEN();
+};
+
diff --git a/ASDC.Lab4/citizens222.bin b/ASDC.Lab4/citizens222.bin
new file mode 100644
index 0000000..9652f59
Binary files /dev/null and b/ASDC.Lab4/citizens222.bin differ
diff --git a/ASDC.Lab4/cmatrix4.h b/ASDC.Lab4/cmatrix4.h
new file mode 100644
index 0000000..cfe33eb
--- /dev/null
+++ b/ASDC.Lab4/cmatrix4.h
@@ -0,0 +1,135 @@
+#pragma once
+#include "matrix4.h"
+#include "resource.h"
+
+template
+///
+/// , , .
+///
+class cmatrix4 : public matrix4
+{
+public:
+ ///
+ /// .
+ ///
+ /// .
+ ///
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ ///
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ ///
+ cmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h);
+
+ ///
+ /// , , .
+ ///
+ /// .
+ ///
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// , .
+ ///
+ ///
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// nullptr.
+ /// - -
+ /// .
+ ///
+ cmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h, T* array, size_t length);
+
+ ///
+ /// .
+ ///
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ /// .
+ virtual T& at(int i1, int i2, int i3, int i4);
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ int getAddCount();
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ int getMulCount();
+
+private:
+ int getDimension(int dimension);
+};
+
+template
+inline cmatrix4::cmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h) : matrix4::matrix4(i1l, i1h, i2l, i2h, i3l, i3h, i4l, i4h)
+{
+}
+
+template
+inline cmatrix4::cmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h, T * array, size_t length) : matrix4::matrix4(i1l, i1h, i2l, i2h, i3l, i3h, i4l, i4h, array, length)
+{
+}
+
+template
+inline T & cmatrix4::at(int i1, int i2, int i3, int i4)
+{
+ if (i1 < matrix4::getLowerBound(1) || i1 > matrix4::getUpperBound(1))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I1);
+ if (i2 < matrix4::getLowerBound(2) || i2 > matrix4::getUpperBound(2))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I2);
+ if (i3 < matrix4::getLowerBound(3) || i3 > matrix4::getUpperBound(3))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I3);
+ if (i4 < matrix4::getLowerBound(4) || i4 > matrix4::getUpperBound(4))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I4);
+
+ return matrix4::_vector[(i1 - this->getLowerBound(1)) * getDimension(1) + (i2 - this->getLowerBound(2)) * getDimension(2) + (i3 - this->getLowerBound(3)) * getDimension(3) + (i4 - this->getLowerBound(4)) * getDimension(4)];
+}
+
+template
+inline int cmatrix4::getDimension(int dimension)
+{
+ int _dimension[4];
+ _dimension[0] = 1;
+ for (int i = 1; i < dimension; i++)
+ _dimension[i] = _dimension[i - 1] * matrix4::getLength(i);
+ return _dimension[dimension - 1];
+}
+
+
+template
+inline int cmatrix4::getAddCount()
+{
+ return 7;
+}
+
+template
+inline int cmatrix4::getMulCount()
+{
+ return 10;
+}
diff --git a/ASDC.Lab4/cmatrix4m.h b/ASDC.Lab4/cmatrix4m.h
new file mode 100644
index 0000000..5b73f0d
--- /dev/null
+++ b/ASDC.Lab4/cmatrix4m.h
@@ -0,0 +1,153 @@
+#pragma once
+#include "matrix4.h"
+#include "resource.h"
+
+template
+///
+/// , , , .
+///
+class cmatrix4m : public matrix4
+{
+ int* _dimension;
+ int _dimensionSum;
+
+public:
+ ///
+ /// .
+ ///
+ /// .
+ ///
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ ///
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ ///
+ cmatrix4m(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h);
+
+ ///
+ /// , , .
+ ///
+ /// .
+ ///
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// , .
+ ///
+ ///
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// nullptr.
+ /// - -
+ /// .
+ ///
+ cmatrix4m(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h, T* array, size_t length);
+
+ ///
+ /// , .
+ ///
+ ~cmatrix4m();
+
+ ///
+ /// .
+ ///
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ /// .
+ T& at(int i1, int i2, int i3, int i4);
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ virtual int getAddCount();
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ virtual int getMulCount();
+
+private:
+ int getDimension(int dimension);
+};
+
+template
+inline cmatrix4m::cmatrix4m(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h) : matrix4::matrix4(i1l, i1h, i2l, i2h, i3l, i3h, i4l, i4h)
+{
+ _dimension = new int[4];
+ _dimension[0] = 1;
+ for (int i = 1; i <= 3; i++)
+ _dimension[i] = _dimension[i - 1] * matrix4::getLength(i);
+ _dimensionSum = _dimension[0] * this->getLowerBound(1) + _dimension[1] * this->getLowerBound(2) + _dimension[2] * this->getLowerBound(3) + _dimension[3] * this->getLowerBound(4);
+}
+
+template
+inline cmatrix4m::cmatrix4m(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h, T * array, size_t length) : matrix4::matrix4(i1l, i1h, i2l, i2h, i3l, i3h, i4l, i4h, array, length)
+{
+ _dimension = new int[4];
+ _dimension[0] = 1;
+ for (int i = 1; i <= 3; i++)
+ _dimension[i] = _dimension[i - 1] * matrix4::getLength(i);
+ _dimensionSum = _dimension[0] * this->getLowerBound(1) + _dimension[1] * this->getLowerBound(2) + _dimension[2] * this->getLowerBound(3) + _dimension[3] * this->getLowerBound(4);
+}
+
+template
+inline cmatrix4m::~cmatrix4m()
+{
+ delete[] _dimension;
+}
+
+template
+inline int cmatrix4m::getAddCount()
+{
+ return 4;
+}
+
+template
+inline int cmatrix4m::getMulCount()
+{
+ return 4;
+}
+
+template
+inline int cmatrix4m::getDimension(int dimension)
+{
+ return _dimension[dimension - 1];
+}
+
+template
+inline T & cmatrix4m::at(int i1, int i2, int i3, int i4)
+{
+ if (i1 < matrix4::getLowerBound(1) || i1 > matrix4::getUpperBound(1))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I1);
+ if (i2 < matrix4::getLowerBound(2) || i2 > matrix4::getUpperBound(2))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I2);
+ if (i3 < matrix4::getLowerBound(3) || i3 > matrix4::getUpperBound(3))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I3);
+ if (i4 < matrix4::getLowerBound(4) || i4 > matrix4::getUpperBound(4))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I4);
+ return i1 * getDimension(1) + i2 * getDimension(2) + i3 * getDimension(3) + i4 * getDimension(4) - _dimensionSum;
+}
diff --git a/ASDC.Lab4/gender.h b/ASDC.Lab4/gender.h
new file mode 100644
index 0000000..f8b5800
--- /dev/null
+++ b/ASDC.Lab4/gender.h
@@ -0,0 +1,6 @@
+#pragma once
+
+enum GENDER : int
+{
+ MALE, FEMALE
+};
\ No newline at end of file
diff --git a/ASDC.Lab4/icmatrix4.h b/ASDC.Lab4/icmatrix4.h
new file mode 100644
index 0000000..286ed5b
--- /dev/null
+++ b/ASDC.Lab4/icmatrix4.h
@@ -0,0 +1,156 @@
+#pragma once
+#include "matrix4.h"
+
+template
+///
+/// , , , .
+///
+class icmatrix4 : public matrix4
+{
+ T**** iliffeVector;
+
+public:
+ ///
+ /// .
+ ///
+ /// .
+ ///
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ ///
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ ///
+ icmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h);
+
+ ///
+ /// , , .
+ ///
+ /// .
+ ///
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// , .
+ ///
+ ///
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// nullptr.
+ /// - -
+ /// .
+ ///
+ icmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h, T* array, size_t length);
+
+ ///
+ /// .
+ ///
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ /// .
+ T& at(int i1, int i2, int i3, int i4);
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ int getAddCount();
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ int getMulCount();
+
+
+private:
+ //int getDimension(int index);
+};
+
+template
+inline icmatrix4::icmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h) : matrix4::matrix4(i1l, i1h, i2l, i2h, i3l, i3h, i4l, i4h)
+{
+ int offset = 0;
+ iliffeVector = new T***[matrix4::getLength(1)] - i1l;
+ for (int i1 = i1l; i1 <= i1h; i1++)
+ {
+ iliffeVector[i1] = new T**[matrix4::getLength(2)] - i2l;
+ for (int i2 = i2l; i2 <= i2h; i2++)
+ {
+ iliffeVector[i1][i2] = new T*[matrix4::getLength(3)] - i3l;
+ for (int i3 = i3l; i3 <= i3h; i3++)
+ {
+ iliffeVector[i1][i2][i3] = &(matrix4::_vector[offset]) - i4l;
+ offset += matrix4::getLength(4);
+ }
+ }
+ }
+}
+
+template
+inline icmatrix4::icmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h, T * array, size_t length) : matrix4::matrix4(i1l, i1h, i2l, i2h, i3l, i3h, i4l, i4h, array, length)
+{
+ int offset = 0;
+ iliffeVector = new T***[matrix4::getLength(4)] - i4l;
+ for (int i4 = i4l; i4 <= i4h; i4++)
+ {
+ iliffeVector[i4] = new T**[matrix4::getLength(3)] - i3l;
+ for (int i3 = i3l; i3 <= i3h; i3++)
+ {
+ iliffeVector[i4][i3] = new T*[matrix4::getLength(2)] - i2l;
+ for (int i2 = i2l; i2 <= i2h; i2++)
+ {
+ iliffeVector[i4][i3][i2] = &(matrix4::_vector[offset]) - i1l;
+ offset += matrix4::getLength(1);
+ }
+ }
+ }
+
+}
+
+template
+inline T & icmatrix4::at(int i1, int i2, int i3, int i4)
+{
+ if (i1 < matrix4::getLowerBound(1) || i1 > matrix4::getUpperBound(1))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I1);
+ if (i2 < matrix4::getLowerBound(2) || i2 > matrix4::getUpperBound(2))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I2);
+ if (i3 < matrix4::getLowerBound(3) || i3 > matrix4::getUpperBound(3))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I3);
+ if (i4 < matrix4::getLowerBound(4) || i4 > matrix4::getUpperBound(4))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I4);
+ return iliffeVector[i4][i3][i2][i1];
+}
+
+template
+inline int icmatrix4::getAddCount()
+{
+ return 0;
+}
+
+template
+inline int icmatrix4::getMulCount()
+{
+ return 0;
+}
\ No newline at end of file
diff --git a/ASDC.Lab4/ilmatrix4.h b/ASDC.Lab4/ilmatrix4.h
new file mode 100644
index 0000000..34379ef
--- /dev/null
+++ b/ASDC.Lab4/ilmatrix4.h
@@ -0,0 +1,189 @@
+#pragma once
+#include "matrix4.h"
+
+template
+///
+/// , , , .
+///
+class ilmatrix4 : public matrix4
+{
+ T**** iliffeVector;
+
+public:
+ ///
+ /// .
+ ///
+ /// .
+ ///
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ ///
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ ///
+ ilmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h);
+
+ ///
+ /// , , .
+ ///
+ /// .
+ ///
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// , .
+ ///
+ ///
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// nullptr.
+ /// - -
+ /// .
+ ///
+ ilmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h, T* array, size_t length);
+
+ ///
+ /// , .
+ ///
+ ~ilmatrix4();
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ int getAddCount();
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ int getMulCount();
+
+ ///
+ /// .
+ ///
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ /// .
+ T& at(int i1, int i2, int i3, int i4);
+
+ int getComplexity();
+
+private:
+ int getDimension(int index);
+};
+
+template
+inline ilmatrix4::ilmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h) : matrix4::matrix4(i1l, i1h, i2l, i2h, i3l, i3h, i4l, i4h)
+{
+ int offset = 0;
+ iliffeVector = new T***[matrix4::getLength(1)] - i1l;
+ for (int i1 = i1l; i1 <= i1h; i1++)
+ {
+ iliffeVector[i1] = new T**[matrix4::getLength(2)] - i2l;
+ for (int i2 = i2l; i2 <= i2h; i2++)
+ {
+ iliffeVector[i1][i2] = new T*[matrix4::getLength(3)] - i3l;
+ for (int i3 = i3l; i3 <= i3h; i3++)
+ {
+ iliffeVector[i1][i2][i3] = &(matrix4::_vector[offset]) - i4l;
+ offset += matrix4::getLength(4);
+ }
+ }
+ }
+}
+
+template
+inline ilmatrix4::ilmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h, T * array, size_t length) : matrix4::matrix4(i1l, i1h, i2l, i2h, i3l, i3h, i4l, i4h, array, length)
+{
+ int offset = 0;
+ iliffeVector = new T***[matrix4::getLength(1)] - i1l;
+ for (int i1 = i1l; i1 <= i1h; i1++)
+ {
+ iliffeVector[i1] = new T**[matrix4::getLength(2)] - i2l;
+ for (int i2 = i2l; i2 <= i2h; i2++)
+ {
+ iliffeVector[i1][i2] = new T*[matrix4::getLength(3)] - i3l;
+ for (int i3 = i3l; i3 <= i3h; i3++)
+ {
+ iliffeVector[i1][i2][i3] = &(matrix4::_vector[offset]) - i4l;
+ offset += matrix4::getLength(4);
+ }
+ }
+ }
+}
+
+template
+inline ilmatrix4::~ilmatrix4()
+{
+ for (int i1 = index[0][0]; i1 <= index[0][1]; i1++)
+ {
+ for (int i2 = index[1][0]; i2 <= index[1][1]; i2++)
+ {
+ for (int i3 = index[2][0]; i3 <= index[2][1]; i3++)
+ delete[] iliffeVector[i1][i2][i3];
+ delete[] iliffeVector[i1][i2];
+ }
+ delete[] iliffeVector[i1];
+ }
+ delete[] iliffeVector;
+}
+
+template
+inline int ilmatrix4::getAddCount()
+{
+ return 0;
+}
+
+template
+inline int ilmatrix4::getMulCount()
+{
+ return 0;
+}
+
+template
+inline T & ilmatrix4::at(int i1, int i2, int i3, int i4)
+{
+ if (i1 < matrix4::getLowerBound(1) || i1 > matrix4::getUpperBound(1))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I1);
+ if (i2 < matrix4::getLowerBound(2) || i2 > matrix4::getUpperBound(2))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I2);
+ if (i3 < matrix4::getLowerBound(3) || i3 > matrix4::getUpperBound(3))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I3);
+ if (i4 < matrix4::getLowerBound(4) || i4 > matrix4::getUpperBound(4))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I4);
+ return iliffeVector[i1][i2][i3][i4];
+}
+
+template
+inline int ilmatrix4::getComplexity()
+{
+ return matrix4::getLength() * 4;
+}
+
+template
+inline int ilmatrix4::getDimension(int index)
+{
+ return 0;
+}
diff --git a/ASDC.Lab4/lmatrix4.h b/ASDC.Lab4/lmatrix4.h
new file mode 100644
index 0000000..6759d8e
--- /dev/null
+++ b/ASDC.Lab4/lmatrix4.h
@@ -0,0 +1,135 @@
+#pragma once
+#include "matrix4.h"
+#include "resource.h"
+
+template
+///
+/// , , .
+///
+class lmatrix4 : public matrix4
+{
+
+public:
+ ///
+ /// .
+ ///
+ /// .
+ ///
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ ///
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ ///
+ lmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h);
+
+ ///
+ /// , , .
+ ///
+ /// .
+ ///
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// .
+ /// , .
+ ///
+ ///
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// .
+ /// - -
+ /// nullptr.
+ /// - -
+ /// .
+ ///
+ lmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h, T* array, size_t length);
+
+ ///
+ /// .
+ ///
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ /// , .
+ /// .
+ T& at(int i1, int i2, int i3, int i4);
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ int getAddCount();
+
+ ///
+ /// , .
+ ///
+ /// 32- , .
+ int getMulCount();
+
+private:
+ int getDimension(int dimension);
+};
+
+template
+inline lmatrix4::lmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h) : matrix4::matrix4(i1l, i1h, i2l, i2h, i3l, i3h, i4l, i4h)
+{
+}
+
+template
+inline lmatrix4::lmatrix4(int i1l, int i1h, int i2l, int i2h, int i3l, int i3h, int i4l, int i4h, T * array, size_t length) : matrix4::matrix4(i1l, i1h, i2l, i2h, i3l, i3h, i4l, i4h, array, length)
+{
+}
+
+template
+inline int lmatrix4::getDimension(int dimension)
+{
+ int _dimension[4];
+ _dimension[3] = 1;
+ for (int i = 2; i >= dimension - 1; i--)
+ _dimension[i] = _dimension[i + 1] * matrix4::getLength(i + 2);
+ return _dimension[dimension - 1];
+}
+
+template
+inline T & lmatrix4::at(int i1, int i2, int i3, int i4)
+{
+ if (i1 < matrix4::getLowerBound(1) || i1 > matrix4::getUpperBound(1))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I1);
+ if (i2 < matrix4::getLowerBound(2) || i2 > matrix4::getUpperBound(2))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I2);
+ if (i3 < matrix4::getLowerBound(3) || i3 > matrix4::getUpperBound(3))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I3);
+ if (i4 < matrix4::getLowerBound(4) || i4 > matrix4::getUpperBound(4))
+ throw std::out_of_range(MESSAGE_OUT_OF_RANGE_I4);
+
+ return matrix4::_vector[(i1 - this->getLowerBound(1)) * getDimension(1) + (i2 - this->getLowerBound(2)) * getDimension(2) + (i3 - this->getLowerBound(3)) * getDimension(3) + (i4 - this->getLowerBound(4)) * getDimension(4)];
+}
+
+template
+inline int lmatrix4::getAddCount()
+{
+ return 7;
+}
+
+template