Add project files.

This commit is contained in:
2024-07-10 19:07:44 +03:00 Unverified
parent 21d7ed41f0
commit bcea0d6239
23 changed files with 4236 additions and 0 deletions
+244
View File
@@ -0,0 +1,244 @@
<Project ToolsVersion="17.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<!--
This section defines project-level properties.
AssemblyName
Name of the output assembly.
Configuration
Specifies a default value for debug.
OutputType
Must be "Library" for VSTO.
Platform
Specifies what CPU the output of this project can run on.
NoStandardLibraries
Set to "false" for VSTO.
RootNamespace
In C#, this specifies the namespace given to new files. In VB, all objects are
wrapped in this namespace at runtime.
-->
<PropertyGroup>
<ProjectTypeGuids>{BAA0C2D2-18E2-41B9-852F-F413020CAA33};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AA601AB6-1E54-4DDC-846A-F4A0230049F2}</ProjectGuid>
<OutputType>Library</OutputType>
<NoStandardLibraries>false</NoStandardLibraries>
<RootNamespace>Automata_theory</RootNamespace>
<AssemblyName>Automata theory</AssemblyName>
<LoadBehavior>3</LoadBehavior>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<DefineConstants>VSTO40</DefineConstants>
<BootstrapperEnabled>true</BootstrapperEnabled>
<BootstrapperComponentsLocation>HomeSite</BootstrapperComponentsLocation>
</PropertyGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.VSTORuntime.4.0">
<Visible>False</Visible>
<ProductName>Microsoft Visual Studio 2010 Tools for Office Runtime %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<PropertyGroup>
<!--
OfficeApplication
Add-in host application
-->
<OfficeApplication>Excel</OfficeApplication>
</PropertyGroup>
<!--
This section defines properties that are set when the "Debug" configuration is selected.
DebugSymbols
If "true", create symbols (.pdb). If "false", do not create symbols.
DefineConstants
Constants defined for the preprocessor.
EnableUnmanagedDebugging
If "true", starting the debugger will attach both managed and unmanaged debuggers.
Optimize
If "true", optimize the build output. If "false", do not optimize.
OutputPath
Output path of project relative to the project file.
WarningLevel
Warning level for the compiler.
-->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!--
This section defines properties that are set when the "Release" configuration is selected.
DebugSymbols
If "true", create symbols (.pdb). If "false", do not create symbols.
DefineConstants
Constants defined for the preprocessor.
EnableUnmanagedDebugging
If "true", starting the debugger will attach both managed and unmanaged debuggers.
Optimize
If "true", optimize the build output. If "false", do not optimize.
OutputPath
Output path of project relative to the project file.
WarningLevel
Warning level for the compiler.
-->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!--
This section specifies references for the project.
-->
<ItemGroup>
<Reference Include="Accessibility" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Office.Tools.v4.0.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Tools.Applications.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Office.Tools, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Office.Tools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Office.Tools.Excel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Office.Tools.Common.v4.0.Utilities, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="Office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<Private>False</Private>
<EmbedInteropTypes>true</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<Private>False</Private>
<EmbedInteropTypes>true</EmbedInteropTypes>
</Reference>
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>False</Private>
</Reference>
</ItemGroup>
<!--
This section defines the user source files that are part of the project.
A "Compile" element specifies a source file to compile.
An "EmbeddedResource" element specifies an .resx file for embedded resources.
A "None" element specifies a file that is not to be passed to the compiler (for instance,
a text file or XML file).
The "AppDesigner" element specifies the directory where the application properties files
can be found.
-->
<ItemGroup>
<Compile Include="Common.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Laba4.cs" />
<Compile Include="Laba5.1.cs" />
<Compile Include="Laba5.cs" />
<Compile Include="Laba6.cs" />
<Compile Include="Laba7.cs" />
<Compile Include="Laba8.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Ribbon1.resx">
<DependentUpon>Ribbon1.cs</DependentUpon>
</EmbeddedResource>
<None Include="Automata theory_TemporaryKey.pfx" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Ribbon1.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Ribbon1.Designer.cs">
<DependentUpon>Ribbon1.cs</DependentUpon>
</Compile>
<Compile Include="ThisAddIn.cs">
<SubType>Code</SubType>
</Compile>
<None Include="ThisAddIn.Designer.xml">
<DependentUpon>ThisAddIn.cs</DependentUpon>
</None>
<Compile Include="ThisAddIn.Designer.cs">
<DependentUpon>ThisAddIn.Designer.xml</DependentUpon>
</Compile>
<AppDesigner Include="Properties\" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>Automata theory_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>71E2C301299111CED893BA74AE375E6B8A8E71C9</ManifestCertificateThumbprint>
</PropertyGroup>
<!-- Include the build rules for a C# project. -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- Include additional build rules for an Office application add-in. -->
<Import Project="$(VSToolsPath)\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- This section defines VSTO properties that describe the host-changeable project properties. -->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{BAA0C2D2-18E2-41B9-852F-F413020CAA33}">
<ProjectProperties HostName="Excel" HostPackage="{29A7B9D7-A7F1-4328-8EF0-6B2D1A56B2C1}" OfficeVersion="15.0" VstxVersion="4.0" ApplicationType="Excel" Language="cs" TemplatesPath="" DebugInfoExeName="#Software\Microsoft\Office\16.0\Excel\InstallRoot\Path#excel.exe" DebugInfoCommandLine="/x" AddItemTemplatesGuid="{51063C3A-E220-4D12-8922-BDA915ACD783}" />
<Host Name="Excel" GeneratedCodeNamespace="Automata_theory" IconIndex="0">
<HostItem Name="ThisAddIn" Code="ThisAddIn.cs" CanonicalName="AddIn" CanActivate="false" IconIndex="1" Blueprint="ThisAddIn.Designer.xml" GeneratedCode="ThisAddIn.Designer.cs" />
</Host>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
+330
View File
@@ -0,0 +1,330 @@
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Automata_theory.Common;
namespace Automata_theory
{
public static class Common
{
public enum DisplayMode
{
OnlyStates,
OnlyOutput,
Everything
}
public static Dictionary<int, string> SubScripts = new Dictionary<int, string>()
{
{ 0, "\u2080" },
{ 1, "\u2081" },
{ 2, "\u2082" },
{ 3, "\u2083" },
{ 4, "\u2084" },
{ 5, "\u2085" },
{ 6, "\u2086" },
{ 7, "\u2087" },
{ 8, "\u2088" },
{ 9, "\u2089" },
{ 10, "\u2081\u2080" }
};
public static AutomataTableBase CreateTable(string msg = "Выберите совмещенную таблицу:")
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox(msg, Type: 8);
List<int> outputs = new List<int>();
AutomataTableBase table = new AutomataTableBase(RG.Columns.Count - 1, RG.Rows.Count - 1);
for (int i = 2; i < RG.Columns.Count + 1; i++)
{
AutomataStateBase state = new AutomataStateBase(RG.Rows.Count - 1, i - 1);
for (int j = 2; j < RG.Rows.Count + 1; j++)
{
string text = RG.Columns[i].Rows[j].Value2;
string toState = text.Split('/')[0].Trim().Trim('S').Trim('b');
int ToState = -1; if (int.TryParse(toState, out _)) ToState = Convert.ToInt32(toState) - 1;
string output = text.Split('/')[1].Trim().Trim('y');
int Output = -1; if (Char.IsNumber(output[0])) Output = Convert.ToInt32(output);
if (!outputs.Contains(Output) && Output != -1) outputs.Add(Output);
AutomataCellBase cell = new AutomataCellBase(ToState, Output);
state.Cells[j - 2] = cell;
}
table.States[i - 2] = state;
}
table.Outputs = outputs.Count;
return table;
}
public static void DisplayTable(AutomataTableBase table, DisplayMode displayMode = DisplayMode.Everything, string stateLetter = "s", bool displayLetter = true)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox($"Куда вставить таблицу ({table.States[0].Cells.Length}х{table.States.Length}):", Type: 8);
for (int i = 0; i < table.States[0].Cells.Length; i++)
RG.Columns[1].Rows[i + 2].Value2 = "x" + SubScripts[i + 1];
for (int i = 0; i < table.States.Length; i++)
{
RG.Columns[i + 2].Rows[1].Value2 = (displayLetter ? stateLetter : "") + (displayLetter ? SubScripts[i + 1].ToString() : (i + 1).ToString());
for (int j = 0; j < table.States[i].Cells.Length; j++)
switch (displayMode)
{
case DisplayMode.OnlyStates:
RG.Columns[i + 2].Rows[j + 2].Value2 = table.States[i].Cells[j].State != -1 ? stateLetter + (table.States[i].Cells[j].State + 1) : "--";
break;
case DisplayMode.OnlyOutput:
RG.Columns[i + 2].Rows[j + 2].Value2 = table.States[i].Cells[j].Output != -1 ? "y" + table.States[i].Cells[j].Output : "--";
break;
case DisplayMode.Everything:
RG.Columns[i + 2].Rows[j + 2].Value2 = (table.States[i].Cells[j].State != -1 ? stateLetter + (table.States[i].Cells[j].State + 1) : "--") + "/"
+ (table.States[i].Cells[j].Output != -1 ? "y" + table.States[i].Cells[j].Output : "--");
break;
}
}
}
public static void DisplayTables(List<AutomataTableBase> tables, DisplayMode displayMode = DisplayMode.Everything)
{
for (int i = 0; i < tables.Count; i++)
{
DisplayTable(tables[i], displayMode, $"{(char)(98 + i)}", false);
}
}
public static void DisplayTable(AutomataTableSP table, DisplayMode displayMode = DisplayMode.Everything, string stateLetter = "с")
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox($"Куда вставить таблицу ({table.States[0].Cells.Length}х{table.States.Length}):", Type: 8);
for (int i = 0; i < table.States[0].Cells.Length / 2; i++)
for (int j = 0; j < Laba5_1.CurrentPartition.BBlocks.Count; j++)
RG.Columns[1].Rows[2 + j + i * Laba5_1.CurrentPartition.BBlocks.Count].Value2 = $"x{SubScripts[i+1]} x b{SubScripts[j+1]}";
for (int i = 0; i < table.States.Length; i++)
{
RG.Columns[i + 2].Rows[1].Value2 = stateLetter + SubScripts[(i + 1)];
for (int j = 0; j < table.States[i].Cells.Length; j++)
switch (displayMode)
{
case DisplayMode.OnlyStates:
RG.Columns[i + 2].Rows[j + 2].Value2 =
table.States[i].Cells[j].State != -1 ?
stateLetter + (table.States[i].Cells[j].State + 1) : "--";
break;
case DisplayMode.OnlyOutput:
RG.Columns[i + 2].Rows[j + 2].Value2 =
table.States[i].Cells[j].Output != -1 ?
"y" + table.States[i].Cells[j].Output : "--";
break;
case DisplayMode.Everything:
RG.Columns[i + 2].Rows[j + 2].Value2 =
(table.States[i].Cells[j].State != -1 ?
stateLetter + (table.States[i].Cells[j].State + 1) : "--") + "/"
+ (table.States[i].Cells[j].Output != -1 ?
"y" + table.States[i].Cells[j].Output : "--");
break;
}
}
}
public static void DisplayTable(AutomataTableCombined table, DisplayMode displayMode = DisplayMode.Everything, bool displayFirst = true)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox($"Куда вставить таблицу ({table.States[0].Cells.Length+1}х{table.States.Length+1}):", Type: 8);
for (int i = 0; i < table.States[0].Cells.Length; i++)
RG.Columns[1].Rows[i + 2].Value2 = $"x{SubScripts[i + 1]}{(displayFirst ? $"(x1{i + 1})" : "")}";
for (int i = 0; i < table.States.Length; i++)
{
RG.Columns[i + 2].Rows[1].Value2 = $"S{i + 1}(S1{table.States[i].Number[0] + 1}, S2{table.States[i].Number[1] + 1})";
for (int j = 0; j < table.States[i].Cells.Length; j++)
switch (displayMode)
{
case DisplayMode.OnlyStates:
RG.Columns[i + 2].Rows[j + 2].Value2 =
$"S{Laba5.ReverseState(table, table.States[i].Cells[j].State) + 1}(S1{table.States[i].Cells[j].State[0] + 1}, S2{table.States[i].Cells[j].State[1] + 1})";
break;
case DisplayMode.OnlyOutput:
RG.Columns[i + 2].Rows[j + 2].Value2 =
"y" + table.States[i].Cells[j].Output;
break;
case DisplayMode.Everything:
RG.Columns[i + 2].Rows[j + 2].Value2 =
$"S{Laba5.ReverseState(table, table.States[i].Cells[j].State) + 1}(S1{table.States[i].Cells[j].State[0] + 1}, S2{table.States[i].Cells[j].State[1] + 1})" +
"/y" + table.States[i].Cells[j].Output;
break;
}
}
}
public static void DisplayTable(OutputTranslation table, string upperRow = "y1")
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox($"Куда вставить таблицу переводов ({table.Translation.GetLength(0) + 1}х{table.Translation.GetLength(1) + 1}):", Type: 8);
for (int i = 0; i < table.Translation.GetLength(1); i++)
RG.Columns[1].Rows[i + 2].Value2 = $"y2{i + 1}";
for (int i = 0; i < table.Translation.GetLength(0); i++)
{
RG.Columns[i + 2].Rows[1].Value2 = $"{upperRow}{i + 1}";
for (int j = 0; j < table.Translation.GetLength(1); j++)
{
RG.Columns[i + 2].Rows[j + 2].Value2 =
upperRow[0].ToString() + table.Translation[i, j];
}
}
}
public static void DisplayTable(AutomataTableRelative table, int num, bool bin = false, bool delay = false)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox($"Куда вставить таблицу переходов автомата {(char)(66 + num)} ({table.Rows.Count}х{table.StateCount}):", Type: 8);
for (int i = 0; i < table.StateCount; i++)
RG.Columns[2 + i].Rows[1].Value2 = bin ? $"{i}" : $"{(char)(98 + num)}{SubScripts[i + 1]}";
for (int i = 0; i < table.Rows.Count; i++)
{
RG.Columns[1].Rows[2 + i].Value2 = bin ? table.Rows[i].BinName : table.Rows[i].Name;
for (int j = 0; j < table.Rows[i].Cells.Count; j++)
{
RG.Columns[2 + j].Rows[2 + i].Value2 = table.Rows[i].Cells[j].State == -1 ? "--" : (table.Rows[i].Cells[j].State == -2 ? "*" :
(bin ? $"{Math.Abs(table.Rows[i].Cells[j].State - 1)}" : $"{(char)(98 + num)}{table.Rows[i].Cells[j].State + 1}"));
}
}
}
public static void DisplayTables(List<AutomataTableRelative> tables)
{
for (int i = 0; i < tables.Count; i++)
{
DisplayTable(tables[i], i, false);
}
}
public static void DisplayTable(AutomataTableG table, bool bin = false)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox($"Куда вставить таблицу функции g:", Type: 8);
for (int i = 0; i < table.States.Length; i++)
{
RG.Columns[2 + i].Rows[1].Value2 = $"{table.Titles[i]}";
RG.Columns[2 + i].Rows[2].Value2 = bin ? $"{table.BinTitles[i]}" : $"{i + 1}";
}
for (int i = 0; i < table.Inputs; i++)
{
RG.Columns[1].Rows[i + 3].NumberFormat = "";
RG.Columns[1].Rows[i + 3].Value2 = bin ? $"{Laba7.MakeBinary(i, table.Inputs)}" : $"x{SubScripts[i+1]}";
for (int j = 0; j < table.States.Length; j++)
RG.Columns[j + 2].Rows[i + 3].Value2 = table.States[j].Cells[i].Output != -1 ?
(bin ? $"{table.States[j].Cells[i].Output - 1}" : "y" + table.States[j].Cells[i].Output) : "--";
}
}
private static void DisplayTable(ImplicatorsTable table, Range RG, int order)
{
RG.Rows[1].Columns[order * 4 + 2].Value2 = "№";
if (order == 0)
RG.Rows[1].Columns[3].Value2 = "Члены СДНФ";
else RG.Rows[1].Columns[order * 4 + 3].Value2 = "Импликанты";
for (int i = 0; i < table.Implicants.Count; i++)
{
RG.Rows[i + 2].Columns[order * 4 + 1].Value2 = $"{i+1}";
RG.Rows[i + 2].Columns[order * 4 + 2].NumberFormat = "@";
RG.Rows[i + 2].Columns[order * 4 + 2].Value2 = string.Join("-", table.Levels[i].Distinct());
RG.Rows[i + 2].Columns[order * 4 + 3].Value2 = table.ToString(i);
}
}
public static void DisplayTable(List<ImplicatorsTable> table)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox($"Куда вставить таблицы испликаторов:", Type: 8);
for (int i = 0; i < table.Count; i++)
{
DisplayTable(table[i], RG, i);
}
}
public static void DisplayTable(IntersectionTable table)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox($"Куда вставить таблицы испликаторов:", Type: 8);
RG.Rows[1].Columns[1].Value2 = "Простые импликанты";
RG.Rows[1].Columns[2].Value2 = "Члены СДНФ";
for (int i = 0; i < table.CDNFAmount; i++)
RG.Rows[2].Columns[2 + i].Value2 = i + 1;
for (int i = 0; i < table.Implicants.Count; i++)
{
RG.Rows[3 + i].Columns[1].Value2 = ToString(table.Implicants[i]);
for (int j = 0; j < table.CDNFAmount; j++)
RG.Rows[3 + i].Columns[2 + j].Value2 = table.Bools[i][j] ? "X" : "";
}
}
private static string ToString(List<TriggerFunctionItem> items)
{
string res = "";
for (int j = 0; j < items.Count; j++)
{
res += $"{items[j].Symbol}{(items[j].Inverse ? "\u0305" : "")}{Common.SubScripts[items[j].Number]}";
}
return res;
}
public static void DisplayList(List<int> ints, string msg = "Куда вставить список:")
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox(msg, Type: 8);
for (int i = 0; i < ints.Count; i++)
{
RG.Columns[1].Rows[i+1].Value2 = ints[i];
}
}
public static void DisplayList(List<List<int>> ints, string msg = "Куда вставить список:")
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox(msg, Type: 8);
for (int i = 0; i < ints.Count; i++)
{
RG.Columns[1].Rows[i + 1].Value2 = string.Join(", ", ints[i]);
}
}
public static void DisplayList(List<List<List<int>>> ints, char ch, string msg = null)
{
if (msg == null) msg = $"Куда вставить {ch} разбиения:";
Range RG = (Range)Globals.ThisAddIn.Application.InputBox(msg, Type: 8);
for (int i = 0; i < ints.Count; i++)
{
RG.Columns[1].Rows[i + 1].Value2 = ch.ToString() + SubScripts[i + 1].ToString();
for (int j = 0; j < ints[i].Count; j++)
{
for (int k = 0; k < ints[i][j].Count; k++) ints[i][j][k]++;
RG.Columns[j + 2].Rows[i + 1].Value2 = string.Join("", ints[i][j]);
for (int k = 0; k < ints[i][j].Count; k++) ints[i][j][k]--;
}
}
}
public static void DisplayList(List<TriggerFunction> list)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox("Куда вставить функции возбуждения:", Type: 8);
for (int i = 0; i < list.Count; i++)
{
RG.Columns[1].Rows[i + 1].Value2 = list[i].ToString();
}
}
public static void DisplayList(List<IntersectionTable> list)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox("Куда вставить таблицы Квайна:", Type: 8);
for (int i = 0; i < list.Count; i++)
{
RG.Columns[1].Rows[i + 1].Value2 = list[i].ToString();
}
}
public static void DisplayList(List<SimpleTriggerFunction> list)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox("Куда вставить упрощенные функции возбуждения:", Type: 8);
for (int i = 0; i < list.Count; i++)
{
RG.Columns[1].Rows[i + 1].Value2 = list[i].ToString();
}
}
}
}
+94
View File
@@ -0,0 +1,94 @@
namespace Automata_theory
{
partial class Laba6Pi
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column1,
this.Column2});
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(244, 150);
this.dataGridView1.TabIndex = 1;
this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
//
// Column1
//
this.Column1.HeaderText = "1";
this.Column1.Name = "Column1";
//
// Column2
//
this.Column2.HeaderText = "2";
this.Column2.Name = "Column2";
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 168);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 2;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Laba6Img
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(271, 199);
this.Controls.Add(this.button1);
this.Controls.Add(this.dataGridView1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "Laba6Img";
this.Text = "Лаба 6";
this.Load += new System.EventHandler(this.Laba6Img_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.Button button1;
}
}
+66
View File
@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Automata_theory
{
public partial class Laba6Pi : Form
{
public Laba6Pi()
{
InitializeComponent();
}
private void Laba6Img_Load(object sender, EventArgs e)
{
for (int i = 0; i < 3; i++)
{
dataGridView1.Rows.Add();
}
}
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
}
private bool CheckCells()
{
List<List<List<int>>> result = new List<List<List<int>>>();
try
{
for (int i = 0; i < 3; i++)
{
List<List<int>> list = new List<List<int>>();
for (int j = 0; j < 2; j++)
{
string value = dataGridView1.Rows[i].Cells[j].Value.ToString();
List<int> ints = new List<int>();
for (int k = 0; k < value.Length; k++)
{
ints.Add(int.Parse($"{value[k]}") - 1);
}
list.Add(ints);
}
result.Add(list);
}
}
catch { return false; }
Ribbon1.ExternalPi = result;
Ribbon1.IsPiEnteredExternally = true;
return true;
}
private void button1_Click(object sender, EventArgs e)
{
if (CheckCells())
this.Close();
}
}
}
+132
View File
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
+338
View File
@@ -0,0 +1,338 @@
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// this is all good, no need to touch anything here
namespace Automata_theory
{
public partial class Laba4
{
public static AutomataTableBase CurrentTable { get; set; }
public static AngerPoll CurrentAngerPoll { get; set; }
public static AutomataTableBase NewTable { get; set; }
public static AngerPoll CalculateAngerPoll(AutomataTableBase table)
{
AngerPoll angerPoll = new AngerPoll(table);
return angerPoll;
}
public static void DisplayAngerPoll(AutomataTableBase table, AngerPoll angerPoll)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox($"Куда вставить треугольную таблицу:", Type: 8);
for (int i = 2; i < table.States.Length + 1; i++)
{
RG.Columns[1].Rows[i - 1].Value2 = "s" + Common.SubScripts[i];
//RG.Columns[1].Rows[i - 1].Value2 = "s" + i;
for (int j = i; j < table.States.Length + 1; j++)
{
RG.Columns[i].Rows[j - 1].Value2 =
angerPoll.States1[i - 2, j - 1] == -1 ? ("X " + angerPoll.States2[i - 2, j - 1]).TrimEnd() :
angerPoll.States[i - 2, j - 1] == 1 ? "V" : (angerPoll.States[i - 2, j - 1] == -1 ? "X\n" + angerPoll.States2[i - 2, j - 1] : angerPoll.States[i - 2, j - 1].ToString());
if (angerPoll.States[i - 2, j - 1] == 1) RG.Columns[i].Rows[j - 1].Interior.Color = Color.FromArgb(198, 239, 206);
else if (angerPoll.States[i - 2, j - 1] == -1) RG.Columns[i].Rows[j - 1].Interior.Color = Color.FromArgb(255, 199, 206);
else RG.Columns[i].Rows[j - 1].Interior.Color = Color.FromArgb(255, 235, 156);
}
}
for (int i = 1; i < table.States.Length; i++)
RG.Columns[i + 1].Rows[table.States.Length] = "s" + Common.SubScripts[i];
}
public static AutomataTableBase CalculateNew(AngerPoll angerPoll, AutomataTableBase table)
{
AutomataTableBase newTable = new AutomataTableBase(angerPoll.Sets.Count, table.States[0].Cells.Length);
for (int i = 0; i < newTable.States.Length; i++)
{
AutomataStateBase automataState = new AutomataStateBase(table.States[0].Cells.Length, i);
for (int j = 0; j < newTable.States[i].Cells.Length; j++)
{
int forState = 0, forOutput = 0;
AutomataCellBase automataCell =
new AutomataCellBase(ReverseState(angerPoll.Sets,
table.States[angerPoll.Sets[i][forState]].Cells[j].State),
table.States[angerPoll.Sets[i][forOutput]].Cells[j].Output);
for (; forState < angerPoll.Sets[i].Count && automataCell.State == -1 && angerPoll.Sets[i].Count > 1; forState++)
{
automataCell =
new AutomataCellBase(ReverseState(angerPoll.Sets,
table.States[angerPoll.Sets[i][forState]].Cells[j].State),
table.States[angerPoll.Sets[i][forOutput]].Cells[j].Output);
}
for (; forOutput < angerPoll.Sets[i].Count && automataCell.Output == -1 && angerPoll.Sets[i].Count > 1; forOutput++)
{
automataCell =
new AutomataCellBase(ReverseState(angerPoll.Sets,
table.States[angerPoll.Sets[i][forState]].Cells[j].State),
table.States[angerPoll.Sets[i][forOutput]].Cells[j].Output);
}
automataState.Cells[j] = automataCell;
}
newTable.States[i] = automataState;
}
newTable.Outputs = table.Outputs;
return newTable;
}
public static int ReverseState(List<List<int>> states, int inputState)
{
if (inputState == -1) return -1;
for (int i = 0; i < states.Count; i++)
for (int j = 0; j < states[i].Count; j++)
if (states[i][j] == inputState)
return i;
throw new Exception();
}
}
public class AngerPoll
{
public AngerPoll(AutomataTableBase table)
{
InitTable(table.States.Length);
CheckConflict(table);
CheckSimilarity(table);
CheckConditional(table);
CalculateSets();
}
private void InitTable(int size)
{
_states = new int[size, size];
for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++)
_states[i, j] = -2;
}
private void CheckConflict(AutomataTableBase table)
{
for (int i = 0; i < _states.GetLength(0); i++)
{
for (int j = 0; j < _states.GetLength(1); j++)
{
bool flag = true;
for (int k = 0; k < table.States[0].Cells.Length; k++)
{
if (!flag) break;
if (!(table.States[i].Cells[k].Output ==
table.States[j].Cells[k].Output ||
table.States[i].Cells[k].Output == -1 ||
table.States[j].Cells[k].Output == -1))
flag = false;
}
if (!flag) _states[i, j] = -1;
}
}
_1 = _states;
}
private void CheckSimilarity(AutomataTableBase table)
{
for (int i = 0; i < _states.GetLength(0); i++)
{
for (int j = 0; j < _states.GetLength(1); j++)
{
if (_states[i, j] == -1) continue;
bool flag = true;
for (int k = 0; k < table.States[0].Cells.Length; k++)
{
if (!flag) break;
if (!(table.States[i].Cells[k].State ==
table.States[j].Cells[k].State ||
table.States[i].Cells[k].State == -1 ||
table.States[j].Cells[k].State == -1))
flag = false;
}
_states[i, j] = flag ? 1 : 0;
}
}
}
private void CheckConditional(AutomataTableBase table)
{
_2 = new string[_states.GetLength(0), _states.GetLength(1)];
bool isDone = false;
int counter = 0;
while (!isDone && counter < 100)
{
isDone = true;
for (int i = 0; i < _states.GetLength(0); i++)
{
for (int j = 0; j < _states.GetLength(1); j++)
{
if (_states[i, j] != 0) continue;
bool flag = true; int answer = 0;
for (int k = 0; k < table.States[0].Cells.Length; k++)
{
if (counter == 0 && table.States[i].Cells[k].State + 1 != table.States[j].Cells[k].State + 1)
{
_2[i, j] += $"{table.States[i].Cells[k].State + 1}, {table.States[j].Cells[k].State + 1}\n";
}
if (!flag) break;
if (table.States[i].Cells[k].State != -1 &&
table.States[j].Cells[k].State != -1 &&
_states[table.States[i].Cells[k].State,
table.States[j].Cells[k].State] == -1)
flag = false;
if (table.States[i].Cells[k].State != -1 &&
table.States[j].Cells[k].State != -1 &&
_states[table.States[i].Cells[k].State,
table.States[j].Cells[k].State] == 0)
{
isDone = false;
counter++;
answer = Convert.ToInt32($"{table.States[i].Cells[k].State + 1}" +
$"{table.States[j].Cells[k].State + 1}");
}
}
_states[i, j] = flag ? (counter < 99 ? 0 : (answer == 0 ? 1 : answer)) : -1;
}
}
}
}
private void CalculateSets()
{
List<int[]> skipCell = new List<int[]>();
for (int i = 0; i < _states.GetLength(0); i++)
{
for (int j = _states.GetLength(1) - 1; j > i; j--)
{
if (Contains(skipCell, new int[] { i, j })) continue;
if (_states[i, j] == 1)
{
int vertical = -1, horizontal = -1;
bool hasVertical = false, hasHorizontal = false;
for (int k = j - 1; k > i; k--)
if (_states[i, k] == 1)
{
hasVertical = true;
vertical = i;
break;
//skipCell.Add(new int[] { i, k });
}
for (int k = i + 1; k < j; k++)
if (_states[k, j] == 1)
{
hasHorizontal = true;
horizontal = k;
break;
//skipCell.Add(new int[] { k, j });
}
if (hasVertical && hasHorizontal)
{
skipCell.Add(new int[] { horizontal, j });
skipCell.Add(new int[] { i, horizontal });
_sets.Add(new List<int> { vertical, horizontal, j });
_setsDisp.Add(new List<int> { vertical + 1, horizontal + 1, j + 1 });
}
else
{
_sets.Add(new List<int> { i, j });
_setsDisp.Add(new List<int> { i + 1, j + 1 });
}
}
}
}
for (int i = 0; i < _states.GetLength(0); i++)
{
bool skip = false;
for (int j = 0; j < _sets.Count; j++)
{
for (int k = 0; k < _sets[j].Count; k++)
if (_sets[j][k] == i)
{
skip = true;
break;
}
if (skip) break;
}
if (skip) continue;
else
{
_sets.Add(new List<int> { i });
_setsDisp.Add(new List<int> { i + 1 });
}
}
}
private bool Contains(List<int[]> cells, int[] cell)
{
for (int i = 0; i < cells.Count; i++)
if (cells[i][0] == cell[0] && cells[i][1] == cell[1])
return true;
return false;
}
private int[,] _states;
private int[,] _1;
private string[,] _2;
private List<List<int>> _sets = new List<List<int>>();
private List<List<int>> _setsDisp = new List<List<int>>();
public int[,] States { get { return _states; } }
public int[,] States1 { get { return _1; } }
public string[,] States2 { get { return _2; } }
public List<List<int>> Sets { get { return _sets; } }
public List<List<int>> SetsDisp { get { return _setsDisp; } }
}
public class AutomataTableBase
{
public AutomataTableBase(int statesAmount, int inputAmount)
{
_states = new AutomataStateBase[statesAmount];
for (int i = 0; i < statesAmount; i++)
_states[i] = new AutomataStateBase(inputAmount, i);
Inputs = inputAmount;
}
private AutomataStateBase[] _states;
public int Outputs;
public int Inputs;
public AutomataStateBase[] States { get { return _states; } }
}
public class AutomataStateBase
{
public AutomataStateBase(int inputs, int number)
{
_cells = new AutomataCellBase[inputs];
Number = number;
}
public int Number { get; private set; }
private AutomataCellBase[] _cells;
public AutomataCellBase[] Cells { get { return _cells; } }
}
public class AutomataCellBase
{
public AutomataCellBase(int state, int output)
{
_state = state;
_output = output;
}
private int _state = -1;
private int _output = -1;
public int State { get { return _state; } }
public int Output { get { return _output; } }
}
}
+289
View File
@@ -0,0 +1,289 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Automata_theory
{
partial class Laba5_1
{
public static AutomataTableBase CurrentTable { get; set; }
public static SPPartition CurrentPartition { get; set; }
public static AutomataTableBase CurrentSP1 { get; set; }
public static AutomataTableSP CurrentSP2 { get; set; }
}
public class SPPartition
{
public SPPartition(AutomataTableBase table)
{
if (CalculateBBlocks(table))
{
CalculateCBlocks();
ReadyBlocks();
CalculateProduct();
CalculateTable();
isGood = true;
}
else
{
MessageBox.Show("Нет СП разбиений", "Лаба 5.1", MessageBoxButtons.OK, MessageBoxIcon.Information);
isGood = false;
}
}
private bool CalculateBBlocks(AutomataTableBase table)
{
for (int i = 0; i < table.States.Length; i++)
for (int j = i + 1; j < table.States.Length; j++)
{
List<List<int>> blocks = CalculateSuggestion(table, 0, 2);
if (blocks.Count > 1)
{
_bBlocks = blocks;
return true;
}
}
return false;
}
private List<List<int>> CalculateSuggestion(AutomataTableBase table, int first, int second)
{
List<List<int>> result = new List<List<int>> { new List<int> { first, second } };
List<List<int>> toSkip = new List<List<int>> { new List<int> { first, second } };
result = CalculateState(result, table);
while (!CheckStop(result, table))
{
for (int i = 0; i < result.Count; i++)
{
List<int> block = new List<int>(result[i]);
if (Contains(toSkip, result[i])) continue;
result = CalculateState(result, table, i);
toSkip.Add(block);
i = 0;
if (CheckStop(result, table)) break;
}
}
return result;
}
private bool Contains(List<List<int>> list, List<int> item)
{
for (int i = 0; i < list.Count; i++)
{
if (list[i].Count == item.Count)
{
bool flag = true;
for (int j = 0; j < item.Count; j++)
if (list[i][j] != item[j])
{
flag = false;
break;
}
if (flag) return true;
}
}
return false;
}
private List<List<int>> CalculateState(List<List<int>> blocks, AutomataTableBase table, int index = 0)
{
List<List<int>> result = new List<List<int>>(blocks);
for (int i = 0; i < table.Inputs; i++)
{
List<int> block = new List<int> { };
for (int j = 0; j < blocks[index].Count; j++)
if (!block.Contains(table.States[blocks[index][j]].Cells[i].State))
block.Add(table.States[blocks[index][j]].Cells[i].State);
block.Sort();
result.Insert(index + 1, block);
}
result = CleanBlocks(result);
return result;
}
private List<List<int>> CleanBlocks(List<List<int>> blocks)
{
blocks.Sort((a, b) => a[0].CompareTo(b[0]));
for (int i = 0; i < blocks.Count; i++)
for (int j = i + 1; j < blocks.Count; j++)
for (int k = 0; k < blocks[j].Count; k++)
if (blocks[i].Contains(blocks[j][k]))
{
for (int t = 0; t < blocks[j].Count; t++)
if (!blocks[i].Contains(blocks[j][t]))
blocks[i].Add(blocks[j][t]);
blocks.RemoveAt(j); i = 0; j = 0; break;
}
for (int i = 0; i < blocks.Count; i++)
blocks[i].Sort();
blocks.Sort((a, b) => a[0].CompareTo(b[0]));
return blocks;
}
private bool CheckStop(List<List<int>> blocks, AutomataTableBase table)
{
List<int> checks = new List<int>();
for (int i = 0; i < table.States.Length; i++)
checks.Add(i);
for (int i = 0; i < blocks.Count; i++)
for (int j = 0; j < blocks[i].Count; j++)
checks.Remove(blocks[i][j]);
for (int i = 1; i < blocks.Count; i++)
if (blocks[i].Count != blocks[0].Count) return false;
return checks.Count == 0;
}
private void ReadyBlocks()
{
for (int i = 0; i < _bBlocks.Count; i++)
_bBlocks[i].Sort();
_bBlocks.Sort((a, b) => a[0].CompareTo(b[0]));
_bBlocksDisplay = new List<List<int>>();
for (int i = 0; i < _bBlocks.Count; i++)
{
List<int> block = new List<int>();
for (int j = 0; j < _bBlocks[i].Count; j++)
block.Add(i);
_bBlocksDisplay.Add(block);
}
for (int i = 0; i < _bBlocks.Count; i++)
for (int j = 0; j < _bBlocks[i].Count; j++)
_bBlocksDisplay[i][j] = _bBlocks[i][j] + 1;
for (int i = 0; i < _cBlocks.Count; i++)
_cBlocks[i].Sort();
_cBlocks.Sort((a, b) => a[0].CompareTo(b[0]));
_cBlocksDisplay = new List<List<int>>();
for (int i = 0; i < _cBlocks.Count; i++)
{
List<int> block = new List<int>();
for (int j = 0; j < _cBlocks[i].Count; j++)
block.Add(i);
_cBlocksDisplay.Add(block);
}
for (int i = 0; i < _cBlocks.Count; i++)
for (int j = 0; j < _cBlocks[j].Count; j++)
_cBlocksDisplay[i][j] = _cBlocks[i][j] + 1;
}
private void CalculateCBlocks()
{
for (int i = 0; i < _bBlocks[0].Count; i++)
{
List<int> block = new List<int>();
for (int j = 0; j < _bBlocks.Count; j++)
{
block.Add(_bBlocks[j][i]);
}
_cBlocks.Add(block);
}
}
private void CalculateProduct()
{
_states = new int[_bBlocks.Count, _cBlocks.Count];
for (int i = 0; i < _bBlocks.Count; i++)
for (int j = 0; j < _cBlocks.Count; j++)
_states[i, j] = GetMutual(_bBlocks[i], _cBlocks[j]);
}
private int GetMutual(List<int> first, List<int> second)
{
for (int i = 0; i < first.Count; i++)
for (int j = 0; j < second.Count; j++)
if (first[i] == second[j]) return first[i];
throw new Exception();
}
private void CalculateTable()
{
Laba5_1.CurrentSP1 = new AutomataTableBase(_bBlocks.Count, Laba5_1.CurrentTable.Inputs);
for (int i = 0; i < _bBlocks.Count; i++)
{
for (int j = 0; j < Laba5_1.CurrentSP1.Inputs; j++)
{
Laba5_1.CurrentSP1.States[i].Cells[j] =
new AutomataCellBase(ReverseState(_bBlocks, Laba5_1.CurrentTable.States[_bBlocks[i][0]].Cells[j].State), 0);
}
}
Laba5_1.CurrentSP2 = new AutomataTableSP(_cBlocks.Count, Laba5_1.CurrentTable.Inputs * 2);
for (int i = 0; i < _cBlocks.Count; i++) // for each c state
{
for (int j = 0; j < Laba5_1.CurrentTable.Inputs; j++) // for each input
{
for (int k = 0; k < _bBlocks.Count; k++) // for each b state
{
if (i == 0) Laba5_1.CurrentSP2.Header.Add(new int[] { j+1, k+1 }); // add title if first pass of c state
// access (x and b)th input of sp2 and set state and output
Laba5_1.CurrentSP2.States[i].Cells[j * 2 + k] =
new AutomataCellBase(
ReverseState(_cBlocks, Laba5_1.CurrentTable.States[_states[k, i]].Cells[j].State),
Laba5_1.CurrentTable.States[_states[k, i]].Cells[j].Output );
}
}
}
}
private int ReverseState(List<List<int>> states, int state)
{
for (int i = 0; i < states.Count; i++)
{
for (int j = 0; j < states[i].Count; j++)
{
if (states[i][j] == state) return i;
}
}
return -1;
}
private List<List<int>> _bBlocks = new List<List<int>>();
private List<List<int>> _bBlocksDisplay;
private List<List<int>> _cBlocks = new List<List<int>>();
private List<List<int>> _cBlocksDisplay;
private int[,] _states;
private bool isGood;
public List<List<int>> BBlocks { get { return _bBlocks; } }
public List<List<int>> BBlocksDisplay { get { return _bBlocksDisplay; } }
public List<List<int>> CBlocks { get { return _cBlocks; } }
public List<List<int>> CBlocksDisplay { get { return _cBlocksDisplay; } }
public int[,] States { get { return _states; } }
public bool IsGood { get { return isGood; } }
}
public class AutomataTableSP
{
public AutomataTableSP(int statesAmount, int inputAmount)
{
_states = new AutomataStateBase[statesAmount];
for (int i = 0; i < statesAmount; i++)
_states[i] = new AutomataStateBase(inputAmount, i);
Inputs = inputAmount;
}
private AutomataStateBase[] _states;
private List<int[]> _header = new List<int[]>();
public int Inputs;
public List<int[]> Header { get { return _header; } }
public AutomataStateBase[] States { get { return _states; } }
}
}
+183
View File
@@ -0,0 +1,183 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Windows.Forms.AxHost;
namespace Automata_theory
{
public partial class Laba5
{
public static AutomataTableBase AutomataA { get; set; }
public static AutomataTableBase AutomataB { get; set; }
public static AutomataTableCombined SeriesTable { get; set; }
public static AutomataTableCombined ParallelTable { get; set; }
public static OutputTranslation TranslationParallel { get; set; }
public static AutomataTableCombined FeedbackTable { get; set; }
public static OutputTranslation TranslationFeedback { get; set; }
public static AutomataTableCombined CombineSeries(AutomataTableBase A, AutomataTableBase B)
{
AutomataTableCombined combined = new AutomataTableCombined(A.States.Length * B.States.Length, A.Inputs);
for (int i = 0; i < A.States.Length; i++) // for each A state
{
for (int j = 0; j < B.States.Length; j++) // for each B state
{
combined.Titles.Add(new int[] { i, j });
AutomataStateCombined state = new AutomataStateCombined(A.Inputs, new int[] { i, j });
for (int k = 0; k < A.Inputs; k++) // for each input
{
state.Cells[k] =
new AutomataCellCombined(new int[] { A.States[i].Cells[k].State, B.States[j].Cells[A.States[i].Cells[k].Output - 1].State },
B.States[j].Cells[A.States[i].Cells[k].Output - 1].Output);
}
combined.States[i * B.States.Length + j] = state;
}
}
return combined;
}
public static int ReverseState(AutomataTableCombined table, int[] state)
{
for (int i = 0; i < table.Titles.Count; i++)
if (table.Titles[i][0] == state[0] && table.Titles[i][1] == state[1])
return i;
return -1;
}
public static AutomataTableCombined CombineParallel(AutomataTableBase A, AutomataTableBase B)
{
AutomataTableCombined combined = new AutomataTableCombined(A.States.Length * B.States.Length, A.Inputs);
TranslationParallel = new OutputTranslation(new int[] { A.Outputs, B.Outputs });
for (int i = 0; i < A.States.Length; i++) // for each A state
{
for (int j = 0; j < B.States.Length; j++) // for each B state
{
combined.Titles.Add(new int[] { i, j });
AutomataStateCombined state = new AutomataStateCombined(A.Inputs, new int[] { i, j });
for (int k = 0; k < A.Inputs; k++) // for each input
{
state.Cells[k] =
new AutomataCellCombined(new int[] { A.States[i].Cells[k].State, B.States[j].Cells[k].State },
TranslationParallel.Translation[A.States[i].Cells[k].Output - 1, B.States[j].Cells[k].Output - 1]);
}
combined.States[i * B.States.Length + j] = state;
}
}
return combined;
}
public static AutomataTableCombined CombineFeedback(AutomataTableBase A, AutomataTableBase B, int inputs, int iterations)
{
AutomataTableCombined combined = new AutomataTableCombined(A.States.Length * B.States.Length, inputs);
TranslationFeedback = new OutputTranslation(new int[] { inputs, B.Outputs }, A.Inputs);
for (int i = 0; i < A.States.Length; i++) // for each A state
{
for (int j = 0; j < B.States.Length; j++) // for each B state
{
combined.Titles.Add(new int[] { i, j });
AutomataStateCombined state = new AutomataStateCombined(inputs, new int[] { i, j });
for (int k = 0; k < inputs; k++) // for each input
{
state.Cells[k] = CalculateFeedback(A, B, i, j, k, iterations);
}
combined.States[i * B.States.Length + j] = state;
}
}
return combined;
}
private static AutomataCellCombined CalculateFeedback(AutomataTableBase A, AutomataTableBase B, int stateA, int stateB, int input, int iterations)
{
int finalInput = TranslationFeedback.Translation[input, 0] - 1;
int output = A.States[stateA].Cells[finalInput].Output;
int newStateA = A.States[stateA].Cells[finalInput].State;
int newStateB = B.States[stateB].Cells[ A.States[stateA].Cells[finalInput].Output-1 ].State;
int finalOutput = output - 1, finalStateA = newStateA, finalStateB = newStateB;
for (int i = 0; i < iterations; i++)
{
finalInput = TranslationFeedback.Translation[input, B.States[finalStateB].Cells[ finalOutput ].Output - 1] - 1;
finalOutput = A.States[finalStateA].Cells[finalInput].Output - 1;
finalStateB = B.States[finalStateB].Cells[ finalOutput ].State;
finalStateA = A.States[finalStateA].Cells[finalInput].State;
}
//int newFinalInput = TranslationFeedback.Translation[input, B.States[stateB].Cells[ A.States[stateA].Cells[finalInput].Output - 1 ].Output - 1] - 1;
//int output = A.States[stateA].Cells[finalInput].Output;
//newStateB = B.States[newStateB].Cells[ A.States[newStateA].Cells[newFinalInput].Output - 1 ].State;
//newStateA = A.States[newStateA].Cells[newFinalInput].State;
return new AutomataCellCombined(new int[] { finalStateA, finalStateB }, finalOutput + 1);
}
}
public class OutputTranslation
{
public OutputTranslation(int[] inputs, int outputs = -1)
{
_translation = new int[inputs[0], inputs[1]];
for (int i = 0; i < inputs[0]; i++)
{
for (int j = 0; j < inputs[1]; j++)
{
_translation[i, j] = outputs == -1 ? i + j + 1 : outputs - ((i + j + 1) % outputs);
}
}
}
private int[,] _translation;
public int[,] Translation { get { return _translation; } }
}
public class AutomataTableCombined
{
public AutomataTableCombined(int statesAmount, int inputAmount)
{
_states = new AutomataStateCombined[statesAmount];
for (int i = 0; i < statesAmount; i++)
_states[i] = new AutomataStateCombined(inputAmount, new int[] {i});
Inputs = inputAmount;
}
private AutomataStateCombined[] _states;
private List<int[]> _titles = new List<int[]>();
public int Inputs;
public AutomataStateCombined[] States { get { return _states; } }
public List<int[]> Titles { get { return _titles; } }
}
public class AutomataStateCombined
{
public AutomataStateCombined(int inputs, int[] number)
{
_cells = new AutomataCellCombined[inputs];
Number = number;
}
public int[] Number { get; private set; }
private AutomataCellCombined[] _cells;
public AutomataCellCombined[] Cells { get { return _cells; } }
}
public class AutomataCellCombined
{
public AutomataCellCombined(int[] state, int output)
{
_state = state;
_output = output;
}
private int[] _state = new int[2];
private int _output = -1;
public int[] State { get { return _state; } }
public int Output { get { return _output; } }
}
}
+467
View File
@@ -0,0 +1,467 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.AxHost;
namespace Automata_theory
{
partial class Laba6
{
public static Partitions Partitions { get; set; }
public static int GetPartitionsCount(int statesAmount)
{
if (statesAmount <= 4)
return 2;
if (statesAmount <= 8)
return 3;
else if (statesAmount <= 16)
return 4;
throw new ArgumentOutOfRangeException();
}
}
public class Partitions
{
public Partitions(AutomataTableBase table, int partitions, bool doPi, List<List<List<int>>> P = null)
{
this.partitions = partitions;
do
{
MakePiPartitions(table, doPi, P);
}
while (GetIntersectionOfAllSets(pi).Count < table.States.Length);
MakeTables(table);
MakeTauPartitions(table);
MakeEtaPartitions(table);
CalculateDependancies();
CalculateTranslations(table);
CalculateFunctionG(table);
}
private void MakePiPartitions(AutomataTableBase table, bool doPi, List<List<List<int>>> P)
{
if (doPi)
{
this.pi = P;
return;
}
this.pi = GenerateLists(partitions, table.States.Length);
}
static List<List<List<int>>> GenerateLists(int a, int b)
{
List<List<List<int>>> result = new List<List<List<int>>>();
Random rand = new Random();
for (int i = 0; i < a; i++)
{
List<List<int>> list1 = new List<List<int>>();
List<int> numbers = new List<int>();
for (int j = 0; j < b; j++)
{
numbers.Add(j);
}
Shuffle(numbers, rand);
int midPoint = numbers.Count / 2;
List<int> subset1 = numbers.GetRange(0, midPoint);
List<int> subset2 = numbers.GetRange(midPoint, b - midPoint);
list1.Add(subset1);
list1.Add(subset2);
result.Add(list1);
}
return result;
}
static void Shuffle(List<int> list, Random rand)
{
int n = list.Count;
while (n > 1)
{
n--;
int k = rand.Next(n + 1);
int value = list[k];
list[k] = list[n];
list[n] = value;
}
}
private List<List<int>> GetIntersectionOfAllSets(List<List<List<int>>> listOfSets)
{
if (listOfSets == null || listOfSets.Count == 0)
{
// Handle invalid input, return an empty list or throw an exception as needed
return new List<List<int>>();
}
// Initialize the result with the first set
List<List<int>> result = listOfSets[0];
// Iterate through the rest of the sets and find the intersection
for (int i = 1; i < listOfSets.Count; i++)
{
result = IntersectSets(result, listOfSets[i]);
}
return result;
}
private List<List<int>> IntersectSets(List<List<int>> set1, List<List<int>> set2)
{
var intersection = new List<List<int>>();
foreach (var subset1 in set1)
{
foreach (var subset2 in set2)
{
var commonElements = subset1.Intersect(subset2).ToList();
if (commonElements.Count > 0)
{
intersection.Add(commonElements);
}
}
}
return intersection;
}
private void MakeTables(AutomataTableBase table)
{
for (int i = 0; i < partitions; i++) // for each partition
{
AutomataTableBase newTable = new AutomataTableBase(table.States.Length, table.Inputs);
for (int j = 0; j < table.States.Length; j++) // for each state
{
newTable.States[j] = new AutomataStateBase(table.Inputs, j);
for (int k = 0; k < table.Inputs; k++) // for each input
{
newTable.States[j].Cells[k] = new AutomataCellBase(ReverseState(pi[i], table.States[j].Cells[k].State), -1);
}
}
tables.Add(newTable);
}
}
private int ReverseState(List<List<int>> sets, int state, bool invert = false)
{
for (int i = 0; i < sets.Count; i++)
{
for (int j = 0; j < sets[i].Count; j++)
{
if (sets[i][j] == state) return invert ? Math.Abs(i - 1) : i;
}
}
return -1;
}
private void MakeTauPartitions(AutomataTableBase table)
{
for (int i = 0; i < partitions; i++) // for each partition
{
tau.Add(new List<List<int>>());
List<int> skip = new List<int>();
for (int j = 0; j < tables[i].States.Length; j++) // for each state
{
if (skip.Contains(j)) continue;
List<int> set = new List<int>() { j };
List<int> input = new List<int>();
for (int k = 0; k < tables[i].Inputs; k++) // for each input
{
input.Add(tables[i].States[j].Cells[k].State);
}
for (int k = j + 1; k < tables[i].States.Length; k++) // for each state after current
{
bool flag = true;
for (int u = 0; u < tables[i].Inputs; u++) // for each input
{
if (tables[i].States[k].Cells[u].State != tables[i].States[j].Cells[u].State)
{ flag = false; break; }
}
if (flag) { set.Add(k); skip.Add(k); }
}
tau[i].Add(set);
}
}
}
private void MakeEtaPartitions(AutomataTableBase table)
{
for (int i = 0; i < partitions; i++) // for each partition
{
eta.Add(new List<List<int>>());
List<int> skip = new List<int>();
for (int j = 0; j < tables[i].Inputs; j++) // for each state -> input
{
if (skip.Contains(j)) continue;
List<int> set = new List<int>() { j };
List<int> input = new List<int>();
for (int k = 0; k < tables[i].States.Length; k++) // for each input -> state
{
input.Add(tables[i].States[k].Cells[j].State);
}
for (int k = j + 1; k < tables[i].Inputs; k++) // for each state after current -> input after
{
bool flag = true;
for (int u = 0; u < tables[i].Inputs; u++) // for each input -> state
{
if (tables[i].States[u].Cells[k].State != tables[i].States[u].Cells[j].State)
{ flag = false; break; }
}
if (flag) { set.Add(k); skip.Add(k); }
}
eta[i].Add(set);
}
}
}
private void CalculateDependancies()
{
//for (int i = 0; i < partitions; i++)
//{
// for (int j = 0; j < partitions; j++)
// {
// if (j == i) continue;
// List<List<int>> intersections = IntersectSets(pi[i], pi[j]);
// if (IsSetOfSetsContained())
// }
//}
// TODO: Make the algorithm properly
for (int i = 0; i < partitions; i++)
{
dependancies.Add(new List<int>());
for (int j = 0; j < partitions; j++)
{
if (i == j) continue;
dependancies[i].Add(j);
}
}
}
private void CalculateTranslations(AutomataTableBase table)
{
//---
Laba7.TriggerFunctions = new List<TriggerFunction>();
//---
for (int i = 0; i < partitions; i++)
{
Laba7.TriggerFunctions.Add(new TriggerFunction());
relativeTables.Add(new AutomataTableRelative());
relativeTables[i].StateCount = 2;
List<int> ints = new List<int>();
for (int j = 0; j < Math.Pow(2, dependancies[i].Count); j++)
ints.Add(j);
for (int j = 0; j < ints.Count; j++) // для каждой комбинации зависимостей
{
List<int> states = new List<int>(); // состояния пи разбиения (после итерации должно остаться одно)
states.AddRange(pi[i][0]); states.AddRange(pi[i][1]);
int currentState = ints[j];
for (int k = 0; k < dependancies[i].Count; k++)
{
states = states.Intersect(pi[dependancies[i][k]][currentState & 1]).ToList();
currentState >>= 1;
} // вычислили все состояния (должен быть длины 1)
for (int k = 0; k < eta[i].Count; k++)
{
List<AutomataCellRelative> cells = new List<AutomataCellRelative>(); // создаем новый ряд для двух состояний
for (int u = 0; u < 2; u++) // для каждого (двух) состояний
{
List<int> newStates = new List<int>(states);
newStates = newStates.Intersect(pi[i][u]).ToList();
if (newStates.Count == 0)
cells.Add(new AutomataCellRelative(-2));
else
{
int st = ReverseState(pi[i], table.States[newStates[0]].Cells[eta[i][k][0]].State);
cells.Add(new AutomataCellRelative(st));
if (st == 0 && u == 1)
Laba7.TriggerFunctions[i].AddNewRule($"{Laba7.MakeBinary(k, eta[i].Count)}",
$"{ReturnCorrectBinary(Convert.ToString(ints[j], 2).PadLeft(partitions - 1, '0'), $"{u}", i)}");
}
}
relativeTables[i].Rows.Add(
new AutomataRowRelative(GenerateUserFriendlyName(dependancies[i].Count, 98 + i, k, ints[j]),
$"{Laba7.MakeBinary(ints[j], partitions - 1, true)} {Laba7.MakeBinary(k, eta[i].Count)}", cells));
}
}
}
}
private string ReturnCorrectBinary(string a, string b, int c)
{
string result = ""; bool flag = false;
for (int i = 0; i < a.Length; i++)
{
if (i == c) { result += b; flag = true; }
result += a[i];
}
if (!flag) result += b;
return result;
}
private string GenerateUserFriendlyName(int numOfStates, int skipLetter, int input, int state)
{
string result = ""; int nextLetter = 98;
for (int i = 0; i < numOfStates; i++)
{
if (nextLetter == skipLetter) nextLetter++;
result += $"{(char)(nextLetter)}{Common.SubScripts[Math.Abs((state & 1) + 1)]} * ";
nextLetter++; state >>= 1;
}
result = result.Substring(0, result.Length - 3);
result += $", x{input + 1}";
return result;
}
private void CalculateFunctionG(AutomataTableBase table)
{
tableG = new AutomataTableG(table);
Laba7.TriggerFunctions.Add(new TriggerFunction());
for (int i = 0; i < table.States.Length; i++)
{
List<int> ints = new List<int>();
for (int j = 0; j < pi.Count; j++)
{
if (pi[j][0].Contains(i)) ints.Add(1);
else ints.Add(0);
} // foud where is this state number in each pi partition
string title = "";
for (int j = 0; j < ints.Count; j++)
title += $"{(char)(98 + j)}{Common.SubScripts[ints[j] == 0 ? 2 : 1]} * ";
title = title.Substring(0, title.Length - 3);
tableG.Titles[i] = title;
tableG.BinTitles[i] = string.Join(" ", ints.Select(x => Math.Abs(x -1)));
for (int j = 0; j < tableG.Inputs; j++)
if (table.States[i].Cells[j].Output == 2)
Laba7.TriggerFunctions[partitions].AddNewRule(Laba7.MakeBinary(j, tableG.Inputs), tableG.BinTitles[i]);
}
}
public static List<int> IntersectSets(List<List<int>> list)
{
if (list == null || list.Count == 0)
{
return new List<int>();
}
List<int> commonNumbers = new List<int>(list[0]);
foreach (List<int> intList in list)
{
commonNumbers = commonNumbers.Intersect(intList).ToList();
}
return commonNumbers;
}
private List<List<int>> dependancies = new List<List<int>>();
private int partitions;
private List<List<List<int>>> pi = new List<List<List<int>>>();
private List<List<List<int>>> tau = new List<List<List<int>>>();
private List<List<List<int>>> eta = new List<List<List<int>>>();
private List<AutomataTableBase> tables = new List<AutomataTableBase>();
private List<AutomataTableRelative> relativeTables = new List<AutomataTableRelative>();
private AutomataTableG tableG;
public int Count { get { return partitions; } }
public List<List<List<int>>> Pi { get { return pi; } set { pi = value; } }
public List<List<List<int>>> Tau { get { return tau; } }
public List<List<List<int>>> Eta { get { return eta; } }
public List<AutomataTableBase> Tables { get { return tables; } }
public List<AutomataTableRelative> RelativeTables { get { return relativeTables; } }
public AutomataTableG TableG { get { return tableG; } }
}
public class AutomataTableG
{
public AutomataTableG(AutomataTableBase table)
{
_states = new AutomataStateBase[table.States.Length];
for (int i = 0; i < table.States.Length; i++)
{
_states[i] = new AutomataStateBase(table.Inputs, i);
for (int j = 0; j < table.Inputs; j++)
{
_states[i].Cells[j] = new AutomataCellBase(table.States[i].Cells[j].State, table.States[i].Cells[j].Output);
}
}
Inputs = table.Inputs;
Outputs = table.Outputs;
_titles = new string[table.States.Length];
_binTitles = new string[table.States.Length];
}
private AutomataStateBase[] _states;
private string[] _titles;
private string[] _binTitles;
public int Outputs;
public int Inputs;
public AutomataStateBase[] States { get { return _states; } }
public string[] Titles { get { return _titles; } set { _titles = value; } }
public string[] BinTitles { get { return _binTitles; } set { _binTitles = value; } }
}
public class AutomataTableRelative
{
public AutomataTableRelative()
{
_rows = new List<AutomataRowRelative>();
}
public int StateCount;
private List<AutomataRowRelative> _rows;
public List<AutomataRowRelative> Rows { get { return _rows; } set { _rows = value; } }
}
public class AutomataRowRelative
{
public AutomataRowRelative(string name)
{
_name = name;
_cells = new List<AutomataCellRelative> ();
}
public AutomataRowRelative(string name, string binName, List<AutomataCellRelative> cells)
{
_name = name;
_binName = binName;
_cells = cells;
}
private string _name = string.Empty;
public string Name { get { return _name; } }
private string _binName = string.Empty;
public string BinName { get { return _binName; } }
private List<AutomataCellRelative> _cells;
public List<AutomataCellRelative> Cells { get { return _cells; } }
}
public class AutomataCellRelative
{
public AutomataCellRelative(int state)
{
_state = state;
}
private int _state = -1;
public int State { get { return _state; } }
}
}
+144
View File
@@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Automata_theory
{
public partial class Laba7
{
public static List<TriggerFunction> TriggerFunctions = new List<TriggerFunction>();
public static string MakeBinary(int num, int maxnum, bool forStates = false)
{
if (forStates)
{
string result = "";
for (int i = 0; i < maxnum; i++)
{
result += $"{num & 1} ";
num >>= 1;
}
return string.Join("", result.Substring(0, result.Length - 1).Reverse());
}
string mn = Convert.ToString(maxnum-1, 2);
int power = (int)Math.Pow(2, mn.Length);
string n = Convert.ToString(power - num - 1, 2);
int zeros = mn.Length - n.Length;
for (int i = 0; i < zeros; i++)
n = "0" + n;
return n;
}
}
public class TriggerFunction
{
public TriggerFunction()
{
_items = new List<List<TriggerFunctionItem>>();
}
public void AddNewRule(string row, string col)
{
_items.Add(new List<TriggerFunctionItem>());
int inc = 1;
for (int i = 0; i < row.Length; i++)
{
if (row[i] == ' ') continue;
if (row[i] == '1') AddItem(new TriggerFunctionItem('a', inc, false)); //res += $"a{Common.SubScripts[inc]} \u22c5 ";
else AddItem(new TriggerFunctionItem('a', inc, true)); //$"a\u0305{Common.SubScripts[inc]} \u22c5 "; // \u22c5 - ⋅
inc++;
}
inc = 1;
for (int i = 0; i < col.Length; i++)
{
if (col[i] == ' ') continue;
if (col[i] == '2') { inc++; continue; }
if (col[i] == '1') AddItem(new TriggerFunctionItem('t', inc, false)); //res += $"t{Common.SubScripts[inc]} \u22c5 ";
else AddItem(new TriggerFunctionItem('t', inc, true));//res += $"t\u0305{Common.SubScripts[inc]} \u22c5 "; // \u22c5 - ⋅
inc++;
}
}
private void AddItem(TriggerFunctionItem item)
{
_items[_items.Count - 1].Add(item);
}
public string ToString(int layer = 0, int num = 0)
{
if (layer == 0)
{
string res = "F = ";
for (int i = 0; i < _items.Count; i++)
{
for (int j = 0; j < _items[i].Count; j++)
{
res += $"{_items[i][j].Symbol}{(_items[i][j].Inverse ? "\u0305" : "")}{Common.SubScripts[_items[i][j].Number]} \u22c5 ";
}
res = res.Remove(res.Length - 3, 3);
res += " \u22c1 ";
}
res = res.Remove(res.Length - 3, 3);
return res;
}
else if (layer == 1)
{
string res = "";
for (int j = 0; j < _items[num].Count; j++)
{
res += $"{_items[num][j].Symbol}{(_items[num][j].Inverse ? "\u0305" : "")}{Common.SubScripts[_items[num][j].Number]}";
}
return res;
}
else
throw new ArgumentOutOfRangeException();
}
private List<List<TriggerFunctionItem>> _items;
private List<int> _names;
public List<List<TriggerFunctionItem>> Items { get { return _items; } }
public List<int> Names { get { return _names; } }
}
public class TriggerFunctionItem
{
public TriggerFunctionItem(char sym, int num, bool inv)
{
_symbol = sym;
_number = num;
_inverse = inv;
}
public TriggerFunctionItem(TriggerFunctionItem item)
{
_symbol = item._symbol;
_number = item._number;
_inverse = item._inverse;
}
public static bool operator == (TriggerFunctionItem item1, TriggerFunctionItem item2)
{
if (item1.Inverse == item2.Inverse && item1.Number == item2.Number && item1.Symbol == item2.Symbol)
return true;
return false;
}
public static bool operator != (TriggerFunctionItem item1, TriggerFunctionItem item2)
{
if (item1.Inverse == item2.Inverse && item1.Number == item2.Number && item1.Symbol == item2.Symbol)
return false;
return true;
}
private char _symbol;
private int _number;
private bool _inverse;
public char Symbol { get { return _symbol; } }
public int Number { get { return _number; } }
public bool Inverse { get { return _inverse; } }
}
}
+324
View File
@@ -0,0 +1,324 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Automata_theory
{
public partial class Laba8
{
public static List<List<ImplicatorsTable>> ImplicatorsTables;
public static List<IntersectionTable> IntersectionsTables;
public static List<SimpleTriggerFunction> SimpleTriggersFunctions;
public static void SimplifyFunctions()
{
ImplicatorsTables = new List<List<ImplicatorsTable>>(Laba7.TriggerFunctions.Count);
IntersectionsTables = new List<IntersectionTable>();
SimpleTriggersFunctions = new List<SimpleTriggerFunction>();
CalculateSimplerFunctions();
}
private static void CalculateSimplerFunctions()
{
for (int i = 0; i < Laba7.TriggerFunctions.Count; i++) // for each function
{
ImplicatorsTables.Add(new List<ImplicatorsTable>());
ImplicatorsTable currentTable = new ImplicatorsTable();
for (int j = 0; j < Laba7.TriggerFunctions[i].Items.Count; j++)
{
currentTable.AddEntry(Laba7.TriggerFunctions[i].Items[j], new List<int>() { j + 1 }, new List<int>() { j });
}
ImplicatorsTables[i].Add(currentTable);
while (currentTable.Implicants.Count != 0)
{
currentTable = Iterate(currentTable);
ImplicatorsTables[i].Add(currentTable);
}
ImplicatorsTables[i].RemoveAt(ImplicatorsTables[i].Count - 1);
IntersectionTable intersectionTable = new IntersectionTable(ImplicatorsTables[i]);
IntersectionsTables.Add(intersectionTable);
SimpleTriggersFunctions.Add(new SimpleTriggerFunction(IntersectionsTables[i], ImplicatorsTables[i]));
}
}
public static ImplicatorsTable Iterate(ImplicatorsTable table)
{
ImplicatorsTable result = new ImplicatorsTable();
for (int i = 0; i < table.Implicants.Count; i++)
{
for (int j = i + 1; j < table.Implicants.Count; j++)
{
List<TriggerFunctionItem> list1 = new List<TriggerFunctionItem>();
List<TriggerFunctionItem> list2 = new List<TriggerFunctionItem>();
list1.AddRange(table.Implicants[i]);
list2.AddRange(table.Implicants[j]);
int counter = 0, index = -1;
for (int k = 0; k < list1.Count; k++)
{
if (list1[k].Number == list2[k].Number && list1[k].Symbol == list2[k].Symbol && list1[k].Inverse == !list2[k].Inverse)
{ counter++; index = k; }
if (list1[k].Number != list2[k].Number || list1[k].Symbol != list2[k].Symbol)
{ counter = -1; break; }
}
if (counter == 1)
{
List<TriggerFunctionItem> res = new List<TriggerFunctionItem>();
res.AddRange(NewList(table.Implicants[i]));
res = RemoveItem(res, list1[index]);
List<int> ints = new List<int>();
ints.AddRange(NewList(table.Level[i]));
ints.AddRange(NewList(table.Level[j]));
if (!ContainsEqual(result, res, new List<int> { i + 1, j + 1 }, ints))
result.AddEntry(res, new List<int> { i+1, j+1 }, ints);
}
if (result.Implicants.Count > 50) return result;
}
}
return result;
}
public static List<TriggerFunctionItem> RemoveItem(List<TriggerFunctionItem> list, TriggerFunctionItem item)
{
for (int i = 0; i < list.Count;i++)
{
if (list[i] == item)
{
list.RemoveAt(i);
}
}
return list;
}
private static List<TriggerFunctionItem> NewList(List<TriggerFunctionItem> list)
{
List<TriggerFunctionItem> result = new List<TriggerFunctionItem>();
for (int i = 0; i < list.Count;i++)
{
result.Add(new TriggerFunctionItem(list[i]));
}
return result;
}
private static List<int> NewList(List<int> list)
{
List<int> result = new List<int>();
for (int i = 0; i < list.Count; i++)
{
result.Add(list[i]);
}
return result;
}
private static bool ContainsEqual(ImplicatorsTable list, List<TriggerFunctionItem> item, List<int> levels, List<int> level)
{
for (int i = 0; i < list.Implicants.Count; i++)
{
if (Equals(list.Implicants[i], item))
{
list.Level[i].AddRange(level);
list.Levels[i].AddRange(levels);
return true;
}
}
return false;
}
public static bool Equals(List<TriggerFunctionItem> a, List<TriggerFunctionItem> b)
{
if (a.Count != b.Count) return false;
for (int i = 0; i < a.Count; i++)
{
if (a[i] != b[i]) return false;
}
return true;
}
}
public class ImplicatorsTable
{
public ImplicatorsTable()
{
implicants = new List<List<TriggerFunctionItem>>();
levels = new List<List<int>>();
level = new List<List<int>>();
}
public void AddEntry(List<TriggerFunctionItem> implicant, List<int> levels, List<int> level)
{
implicants.Add(implicant);
this.levels.Add(levels);
this.level.Add(level);
}
public string ToString(int index)
{
string res = "";
for (int j = 0; j < implicants[index].Count; j++)
{
res += $"{implicants[index][j].Symbol}{(implicants[index][j].Inverse ? "\u0305" : "")}{Common.SubScripts[implicants[index][j].Number]}";
}
return res;
}
private List<List<TriggerFunctionItem>> implicants;
private List<List<int>> levels;
private List<List<int>> level;
public List<List<TriggerFunctionItem>> Implicants { get { return implicants; } }
public List<List<int>> Levels { get { return levels; } }
public List<List<int>> Level { get { return level; } }
}
public class IntersectionTable
{
public IntersectionTable(List<ImplicatorsTable> table)
{
_implicants = new List<List<TriggerFunctionItem>>();
_bools = new List<List<bool>>();
_CDNF = table[0].Implicants.Count;
List<int> ignore = new List<int>(), ignoreOld = new List<int>();
for (int i = table.Count - 1; i > 0; i--)
{
ignoreOld = ignore;
ignore = new List<int>();
for (int j = 0; j < table[i].Implicants.Count; j++)
{
if (ignoreOld.Contains(j))
{
List<int> ints = new List<int>();
for (int h = 0; h < table[i].Levels[j].Count; h++)
ints.Add(table[i].Levels[j][h] - 1);
ignore.AddRange(ints);
continue;
}
_implicants.Add(table[i].Implicants[j]);
List<bool> bools = new List<bool>();
for (int k = 0; k < table[0].Implicants.Count; k++)
{
if (table[i].Level[j].Contains(k))
{
bools.Add(true);
List<int> ints = new List<int>();
for (int h = 0; h < table[i].Levels[j].Count; h++)
ints.Add(table[i].Levels[j][h] - 1);
ignore.AddRange(ints);
}
else bools.Add(false);
}
_bools.Add(bools);
}
}
}
public int Intersections(int cdnfAddress)
{
int result = 0;
for (int i = 0; i < _bools.Count; i++)
{
result += Convert.ToInt32(_bools[i][cdnfAddress]);
}
return result;
}
public override string ToString()
{
return "";
}
private int _CDNF;
public int CDNFAmount { get { return _CDNF; } }
private List<List<bool>> _bools; // first - implicants, second - CDNF
public List<List<bool>> Bools { get { return _bools; } }
private List<List<TriggerFunctionItem>> _implicants;
public List<List<TriggerFunctionItem>> Implicants { get { return _implicants; } }
}
public class SimpleTriggerFunction
{
public SimpleTriggerFunction(IntersectionTable table, List<ImplicatorsTable> implicators)
{
_items = new List<List<TriggerFunctionItem>> ();
List<int> done = new List<int> ();
List<int> items = new List<int> ();
for (int i = 0; i < table.CDNFAmount; i++) // for every state in intersections table
if (table.Intersections(i) == 1) // if only one intersection in the state
for (int j = 0; j < table.Implicants.Count; j++) // for every implicant in table to check for the one intersecting with the state
if (table.Bools[j][i]) // if intersection detected, thats the one
{
items.Add(j); // add to list of implicants to add rules about
done.AddRange(ReturnLevelsOfImplicant(implicators, table.Implicants[j]).Select(x => x - 1)); // add to list of states that are covered by implicants
}
for (int i = 0; i < items.Count; i++) // for every item in list of implicant numbers
AddNewRule(table.Implicants[items[i]]); // add them to the list of rules
done = done.Distinct().ToList(); // leave only distinct
for (int i = 0; i < table.CDNFAmount; i++) // for every state in intersections table
if (done.Contains(i)) continue; // if state is covered by implicant, skip
else AddNewRule(implicators[0].Implicants[i]); // if not, add base rule to the list of rules
}
private List<int> ReturnLevelsOfImplicant(List<ImplicatorsTable> implicators, List<TriggerFunctionItem> item)
{
for (int i = implicators.Count - 1; i > 0; i--)
{
for (int j = 0; j < implicators[i].Levels.Count; j++)
{
if (Laba8.Equals(implicators[i].Implicants[j], item))
{
return implicators[i].Levels[j];
}
}
}
return null;
}
private void AddNewRule(List<TriggerFunctionItem> item)
{
List<TriggerFunctionItem> n = new List<TriggerFunctionItem>();
for (int i = 0; i < item.Count; i++)
{
n.Add(new TriggerFunctionItem(item[i].Symbol, item[i].Number, item[i].Inverse));
}
_items.Add(n);
}
public string ToString(int layer = 0, int num = 0)
{
if (layer == 0)
{
string res = "F = ";
for (int i = 0; i < _items.Count; i++)
{
for (int j = 0; j < _items[i].Count; j++)
{
res += $"{_items[i][j].Symbol}{(_items[i][j].Inverse ? "\u0305" : "")}{Common.SubScripts[_items[i][j].Number]} \u22c5 ";
}
res = res.Remove(res.Length - 3, 3);
res += " \u22c1 ";
}
res = res.Remove(res.Length - 3, 3);
return res;
}
else if (layer == 1)
{
string res = "";
for (int j = 0; j < _items[num].Count; j++)
{
res += $"{_items[num][j].Symbol}{(_items[num][j].Inverse ? "\u0305" : "")}{Common.SubScripts[_items[num][j].Number]}";
}
return res;
}
else
throw new ArgumentOutOfRangeException();
}
private List<List<TriggerFunctionItem>> _items;
private List<int> _names;
public List<List<TriggerFunctionItem>> Items { get { return _items; } }
public List<int> Names { get { return _names; } }
}
}
@@ -0,0 +1,38 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Automata theory")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Automata theory")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("46578950-62cc-4428-865e-e4fd844f2772")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+62
View File
@@ -0,0 +1,62 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Automata_theory.Properties {
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[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() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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("Automata_theory.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
+117
View File
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+26
View File
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Automata_theory.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.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;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
+646
View File
@@ -0,0 +1,646 @@
namespace Automata_theory
{
partial class Ribbon1 : Microsoft.Office.Tools.Ribbon.RibbonBase
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
public Ribbon1()
: base(Globals.Factory.GetRibbonFactory())
{
InitializeComponent();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
Microsoft.Office.Tools.Ribbon.RibbonTab tab2;
Microsoft.Office.Tools.Ribbon.RibbonGroup group1;
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl1 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl2 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl3 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl4 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl5 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl6 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl7 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl8 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl9 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl10 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl11 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl12 = this.Factory.CreateRibbonDropDownItem();
Microsoft.Office.Tools.Ribbon.RibbonButton createAngerPoll;
Microsoft.Office.Tools.Ribbon.RibbonDialogLauncher ribbonDialogLauncherImpl1 = this.Factory.CreateRibbonDialogLauncher();
this.dropDown1 = this.Factory.CreateRibbonDropDown();
this.OpenButton = this.Factory.CreateRibbonButton();
this.group3 = this.Factory.CreateRibbonGroup();
this.outputAngerPoll = this.Factory.CreateRibbonButton();
this.setsButton = this.Factory.CreateRibbonButton();
this.combinedButton = this.Factory.CreateRibbonButton();
this.group6 = this.Factory.CreateRibbonGroup();
this.enterLab4DataButton = this.Factory.CreateRibbonButton();
this.separator6 = this.Factory.CreateRibbonSeparator();
this.statesPartitionsButton = this.Factory.CreateRibbonButton();
this.outputsLaba6Button = this.Factory.CreateRibbonButton();
this.transPartitionsButton = this.Factory.CreateRibbonButton();
this.group7 = this.Factory.CreateRibbonGroup();
this.encodeButton = this.Factory.CreateRibbonButton();
this.triggerFunctionButton = this.Factory.CreateRibbonButton();
this.group8 = this.Factory.CreateRibbonGroup();
this.implicatorsButton = this.Factory.CreateRibbonButton();
this.calcButton = this.Factory.CreateRibbonButton();
this.simplifiedButton = this.Factory.CreateRibbonButton();
this.group5 = this.Factory.CreateRibbonGroup();
this.blocksSPButton = this.Factory.CreateRibbonButton();
this.box1 = this.Factory.CreateRibbonBox();
this.label1 = this.Factory.CreateRibbonLabel();
this.A1SetsButton = this.Factory.CreateRibbonButton();
this.A1StatesButton = this.Factory.CreateRibbonButton();
this.box2 = this.Factory.CreateRibbonBox();
this.label2 = this.Factory.CreateRibbonLabel();
this.A2SetsButton = this.Factory.CreateRibbonButton();
this.A2StatesButton = this.Factory.CreateRibbonButton();
this.A2OutputButton = this.Factory.CreateRibbonButton();
this.group4 = this.Factory.CreateRibbonGroup();
this.selectAutomatasButton = this.Factory.CreateRibbonButton();
this.seriesButton = this.Factory.CreateRibbonButton();
this.parallelButton = this.Factory.CreateRibbonButton();
this.separator4 = this.Factory.CreateRibbonSeparator();
this.iterationsBox = this.Factory.CreateRibbonEditBox();
this.inputsBox = this.Factory.CreateRibbonEditBox();
this.feedbackButton = this.Factory.CreateRibbonButton();
this.tab1 = this.Factory.CreateRibbonTab();
tab2 = this.Factory.CreateRibbonTab();
group1 = this.Factory.CreateRibbonGroup();
createAngerPoll = this.Factory.CreateRibbonButton();
tab2.SuspendLayout();
group1.SuspendLayout();
this.group3.SuspendLayout();
this.group6.SuspendLayout();
this.group7.SuspendLayout();
this.group8.SuspendLayout();
this.group5.SuspendLayout();
this.box1.SuspendLayout();
this.box2.SuspendLayout();
this.group4.SuspendLayout();
this.tab1.SuspendLayout();
this.SuspendLayout();
//
// tab2
//
tab2.Groups.Add(group1);
tab2.Groups.Add(this.group3);
tab2.Groups.Add(this.group6);
tab2.Groups.Add(this.group7);
tab2.Groups.Add(this.group8);
tab2.Groups.Add(this.group5);
tab2.Groups.Add(this.group4);
tab2.Label = "Автоматы";
tab2.Name = "tab2";
//
// group1
//
group1.Items.Add(this.dropDown1);
group1.Items.Add(this.OpenButton);
group1.KeyTip = "O";
group1.Label = "Методички";
group1.Name = "group1";
//
// dropDown1
//
ribbonDropDownItemImpl1.Label = "Лаба 1";
ribbonDropDownItemImpl1.OfficeImageId = "ConstrainNumeric";
ribbonDropDownItemImpl2.Label = "Лаба 2";
ribbonDropDownItemImpl2.OfficeImageId = "FunctionsLogicalInsertGallery";
ribbonDropDownItemImpl3.Label = "Лаба 3";
ribbonDropDownItemImpl3.OfficeImageId = "GroupTableSize";
ribbonDropDownItemImpl4.Label = "Лаба 4";
ribbonDropDownItemImpl4.OfficeImageId = "SlideMiniature";
ribbonDropDownItemImpl5.Label = "Лаба 5";
ribbonDropDownItemImpl5.OfficeImageId = "OrganizationChartSelectBranch";
ribbonDropDownItemImpl6.Label = "Лаба 6";
ribbonDropDownItemImpl6.OfficeImageId = "OrganizationChartInsert";
ribbonDropDownItemImpl7.Label = "Лаба 7";
ribbonDropDownItemImpl7.OfficeImageId = "DecimalsDecrease";
ribbonDropDownItemImpl8.Label = "Лаба 8";
ribbonDropDownItemImpl8.OfficeImageId = "FontSizeDecrease";
ribbonDropDownItemImpl9.Label = "Лаба 9";
ribbonDropDownItemImpl10.Label = "Лаба 10";
ribbonDropDownItemImpl11.Label = "Лаба 11";
ribbonDropDownItemImpl12.Label = "Лаба 12";
this.dropDown1.Items.Add(ribbonDropDownItemImpl1);
this.dropDown1.Items.Add(ribbonDropDownItemImpl2);
this.dropDown1.Items.Add(ribbonDropDownItemImpl3);
this.dropDown1.Items.Add(ribbonDropDownItemImpl4);
this.dropDown1.Items.Add(ribbonDropDownItemImpl5);
this.dropDown1.Items.Add(ribbonDropDownItemImpl6);
this.dropDown1.Items.Add(ribbonDropDownItemImpl7);
this.dropDown1.Items.Add(ribbonDropDownItemImpl8);
this.dropDown1.Items.Add(ribbonDropDownItemImpl9);
this.dropDown1.Items.Add(ribbonDropDownItemImpl10);
this.dropDown1.Items.Add(ribbonDropDownItemImpl11);
this.dropDown1.Items.Add(ribbonDropDownItemImpl12);
this.dropDown1.Label = "№";
this.dropDown1.Name = "dropDown1";
this.dropDown1.ShowLabel = false;
//
// OpenButton
//
this.OpenButton.Label = "Открыть";
this.OpenButton.Name = "OpenButton";
this.OpenButton.OfficeImageId = "ExportWord";
this.OpenButton.ScreenTip = "Открыть методичку";
this.OpenButton.ShowImage = true;
this.OpenButton.SuperTip = "Открыть методичку с выбранным номером";
this.OpenButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.OpenButton_Click);
//
// group3
//
this.group3.Items.Add(createAngerPoll);
this.group3.Items.Add(this.outputAngerPoll);
this.group3.Items.Add(this.setsButton);
this.group3.Items.Add(this.combinedButton);
this.group3.KeyTip = "4";
this.group3.Label = "Минимизация";
this.group3.Name = "group3";
//
// createAngerPoll
//
createAngerPoll.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
createAngerPoll.KeyTip = "E";
createAngerPoll.Label = "Ввести таблицу";
createAngerPoll.Name = "createAngerPoll";
createAngerPoll.OfficeImageId = "GroupCreateTables";
createAngerPoll.ScreenTip = "Ввод таблицы";
createAngerPoll.ShowImage = true;
createAngerPoll.SuperTip = "Вводит изначальную таблицу и вычисляет таблицу Ангера-Полла";
createAngerPoll.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.createAngerPoll_Click);
//
// outputAngerPoll
//
this.outputAngerPoll.Label = "Ангер-Полл";
this.outputAngerPoll.Name = "outputAngerPoll";
this.outputAngerPoll.OfficeImageId = "ViewGridlinesWord";
this.outputAngerPoll.ScreenTip = "Вывод ступенчатой таблицы";
this.outputAngerPoll.ShowImage = true;
this.outputAngerPoll.SuperTip = "Выводит ступенчатую таблицу Ангера-Полла, сформированную по введенному автомату";
this.outputAngerPoll.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.outputAngerPoll_Click);
//
// setsButton
//
this.setsButton.Enabled = false;
this.setsButton.KeyTip = "A";
this.setsButton.Label = "Множества";
this.setsButton.Name = "setsButton";
this.setsButton.OfficeImageId = "DiagramAutoLayoutClassic";
this.setsButton.ScreenTip = "Выводит множества";
this.setsButton.ShowImage = true;
this.setsButton.SuperTip = "Выводит множества, полученные объединением с помощью метода Анегра-Полла";
this.setsButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.setsButton_Click);
//
// combinedButton
//
this.combinedButton.Enabled = false;
this.combinedButton.Label = "Таблица";
this.combinedButton.Name = "combinedButton";
this.combinedButton.OfficeImageId = "QuerySelectQueryType";
this.combinedButton.ScreenTip = "Выводит совместную таблицу";
this.combinedButton.ShowImage = true;
this.combinedButton.SuperTip = "Выводит совместную таблицу автомата, полученного посредством минимизации по метод" +
"у Ангера-Полла";
this.combinedButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.combinedButton_Click);
//
// group6
//
this.group6.DialogLauncher = ribbonDialogLauncherImpl1;
this.group6.Items.Add(this.enterLab4DataButton);
this.group6.Items.Add(this.separator6);
this.group6.Items.Add(this.statesPartitionsButton);
this.group6.Items.Add(this.outputsLaba6Button);
this.group6.Items.Add(this.transPartitionsButton);
this.group6.Label = "Декомпозиция";
this.group6.Name = "group6";
this.group6.DialogLauncherClick += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.group6_DialogLauncherClick);
//
// enterLab4DataButton
//
this.enterLab4DataButton.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.enterLab4DataButton.Label = "Ввести таблицу";
this.enterLab4DataButton.Name = "enterLab4DataButton";
this.enterLab4DataButton.OfficeImageId = "RelationshipDesignAllRelationships";
this.enterLab4DataButton.ScreenTip = "Ввод таблицы";
this.enterLab4DataButton.ShowImage = true;
this.enterLab4DataButton.SuperTip = "Вводит таблицу, полученную в результате минимизации и производит декомпозицию";
this.enterLab4DataButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.enterLab4DataButton_Click);
//
// separator6
//
this.separator6.Name = "separator6";
//
// statesPartitionsButton
//
this.statesPartitionsButton.Enabled = false;
this.statesPartitionsButton.Label = "Cостояния";
this.statesPartitionsButton.Name = "statesPartitionsButton";
this.statesPartitionsButton.OfficeImageId = "ExportMoreMenu";
this.statesPartitionsButton.ShowImage = true;
this.statesPartitionsButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.statesPartitionsButton_Click);
//
// outputsLaba6Button
//
this.outputsLaba6Button.Enabled = false;
this.outputsLaba6Button.Label = "Выводы";
this.outputsLaba6Button.Name = "outputsLaba6Button";
this.outputsLaba6Button.OfficeImageId = "ExportSharePointList";
this.outputsLaba6Button.ScreenTip = "Отоброжает выводы автомата";
this.outputsLaba6Button.ShowImage = true;
this.outputsLaba6Button.SuperTip = "Отображает выводы автомата g, полученного в результате декомпозиции";
this.outputsLaba6Button.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.outputsLaba6Button_Click);
//
// transPartitionsButton
//
this.transPartitionsButton.Enabled = false;
this.transPartitionsButton.Label = "Переходы";
this.transPartitionsButton.Name = "transPartitionsButton";
this.transPartitionsButton.OfficeImageId = "OutlineDemoteToBodyText";
this.transPartitionsButton.ScreenTip = "Вывод переходов состояний";
this.transPartitionsButton.ShowImage = true;
this.transPartitionsButton.SuperTip = "Выводит переходы состояний для каждого компонентного автомата";
this.transPartitionsButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.transPartitionsButton_Click);
//
// group7
//
this.group7.Items.Add(this.encodeButton);
this.group7.Items.Add(this.triggerFunctionButton);
this.group7.Label = "Кодирование";
this.group7.Name = "group7";
//
// encodeButton
//
this.encodeButton.Enabled = false;
this.encodeButton.Label = "Кодирование";
this.encodeButton.Name = "encodeButton";
this.encodeButton.OfficeImageId = "EquationMatrixGallery";
this.encodeButton.ShowImage = true;
this.encodeButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.encodeButton_Click);
//
// triggerFunctionButton
//
this.triggerFunctionButton.Enabled = false;
this.triggerFunctionButton.Label = "Функции возб.";
this.triggerFunctionButton.Name = "triggerFunctionButton";
this.triggerFunctionButton.OfficeImageId = "FunctionWizard";
this.triggerFunctionButton.ShowImage = true;
this.triggerFunctionButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.triggerFunctionButton_Click);
//
// group8
//
this.group8.Items.Add(this.implicatorsButton);
this.group8.Items.Add(this.calcButton);
this.group8.Items.Add(this.simplifiedButton);
this.group8.Label = "Минимизация ф-ций";
this.group8.Name = "group8";
//
// implicatorsButton
//
this.implicatorsButton.Enabled = false;
this.implicatorsButton.Label = "Импликанты";
this.implicatorsButton.Name = "implicatorsButton";
this.implicatorsButton.OfficeImageId = "EquationNormalText";
this.implicatorsButton.ShowImage = true;
this.implicatorsButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.implicatorsButton_Click);
//
// calcButton
//
this.calcButton.Enabled = false;
this.calcButton.Label = "Таблицы";
this.calcButton.Name = "calcButton";
this.calcButton.OfficeImageId = "AdpDiagramTableModesMenu";
this.calcButton.ShowImage = true;
this.calcButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.calcButton_Click);
//
// simplifiedButton
//
this.simplifiedButton.Enabled = false;
this.simplifiedButton.Label = "Упрощ. функ.";
this.simplifiedButton.Name = "simplifiedButton";
this.simplifiedButton.OfficeImageId = "AfterUpdate";
this.simplifiedButton.ShowImage = true;
this.simplifiedButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.simplifiedButton_Click);
//
// group5
//
this.group5.Items.Add(this.blocksSPButton);
this.group5.Items.Add(this.box1);
this.group5.Items.Add(this.box2);
this.group5.KeyTip = "5";
this.group5.Label = "Разбиения";
this.group5.Name = "group5";
//
// blocksSPButton
//
this.blocksSPButton.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.blocksSPButton.KeyTip = "E";
this.blocksSPButton.Label = "SP разбиение";
this.blocksSPButton.Name = "blocksSPButton";
this.blocksSPButton.OfficeImageId = "TableColumnSelect";
this.blocksSPButton.ScreenTip = "Ввод таблицы";
this.blocksSPButton.ShowImage = true;
this.blocksSPButton.SuperTip = "Вводит изначальную таблицу автомата и производит его SP разбиение";
this.blocksSPButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.blocksSPButton_Click);
//
// box1
//
this.box1.Items.Add(this.label1);
this.box1.Items.Add(this.A1SetsButton);
this.box1.Items.Add(this.A1StatesButton);
this.box1.Name = "box1";
//
// label1
//
this.label1.Label = "A1";
this.label1.Name = "label1";
//
// A1SetsButton
//
this.A1SetsButton.Enabled = false;
this.A1SetsButton.KeyTip = "A";
this.A1SetsButton.Label = " ";
this.A1SetsButton.Name = "A1SetsButton";
this.A1SetsButton.OfficeImageId = "DiagramAutoLayoutClassic";
this.A1SetsButton.ScreenTip = "Вывод множеств";
this.A1SetsButton.ShowImage = true;
this.A1SetsButton.ShowLabel = false;
this.A1SetsButton.SuperTip = "Вывод множеств полученного автомата А1";
this.A1SetsButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.A1SetsButton_Click);
//
// A1StatesButton
//
this.A1StatesButton.Enabled = false;
this.A1StatesButton.KeyTip = "S";
this.A1StatesButton.Label = "button2";
this.A1StatesButton.Name = "A1StatesButton";
this.A1StatesButton.OfficeImageId = "GroupImport";
this.A1StatesButton.ScreenTip = "Вывод состояний";
this.A1StatesButton.ShowImage = true;
this.A1StatesButton.ShowLabel = false;
this.A1StatesButton.SuperTip = "Вывод таблицы состояний полученного автомата А1";
this.A1StatesButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.A1StatesButton_Click);
//
// box2
//
this.box2.Items.Add(this.label2);
this.box2.Items.Add(this.A2SetsButton);
this.box2.Items.Add(this.A2StatesButton);
this.box2.Items.Add(this.A2OutputButton);
this.box2.Name = "box2";
//
// label2
//
this.label2.Label = "A2";
this.label2.Name = "label2";
//
// A2SetsButton
//
this.A2SetsButton.Enabled = false;
this.A2SetsButton.ImageName = "DiagramAutoLayoutClassic";
this.A2SetsButton.KeyTip = "A";
this.A2SetsButton.Label = "button3";
this.A2SetsButton.Name = "A2SetsButton";
this.A2SetsButton.OfficeImageId = "DiagramAutoLayoutClassic";
this.A2SetsButton.ScreenTip = "Вывод множеств";
this.A2SetsButton.ShowImage = true;
this.A2SetsButton.ShowLabel = false;
this.A2SetsButton.SuperTip = "Вывод множеств полученного автомата А2";
this.A2SetsButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.A2SetsButton_Click);
//
// A2StatesButton
//
this.A2StatesButton.Enabled = false;
this.A2StatesButton.KeyTip = "S";
this.A2StatesButton.Label = "button4";
this.A2StatesButton.Name = "A2StatesButton";
this.A2StatesButton.OfficeImageId = "GroupExport";
this.A2StatesButton.ScreenTip = "Вывод состояний";
this.A2StatesButton.ShowImage = true;
this.A2StatesButton.ShowLabel = false;
this.A2StatesButton.SuperTip = "Вывод таблицы состояний полученного автомата А1";
this.A2StatesButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.A2StatesButton_Click);
//
// A2OutputButton
//
this.A2OutputButton.Enabled = false;
this.A2OutputButton.KeyTip = "X";
this.A2OutputButton.Label = "button6";
this.A2OutputButton.Name = "A2OutputButton";
this.A2OutputButton.OfficeImageId = "ExportSharePointList";
this.A2OutputButton.ScreenTip = "Вывод выводов";
this.A2OutputButton.ShowImage = true;
this.A2OutputButton.ShowLabel = false;
this.A2OutputButton.SuperTip = "Вывод таблицы выходов полученного автомата А1";
this.A2OutputButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.A2OutputButton_Click);
//
// group4
//
this.group4.Items.Add(this.selectAutomatasButton);
this.group4.Items.Add(this.seriesButton);
this.group4.Items.Add(this.parallelButton);
this.group4.Items.Add(this.separator4);
this.group4.Items.Add(this.iterationsBox);
this.group4.Items.Add(this.inputsBox);
this.group4.Items.Add(this.feedbackButton);
this.group4.KeyTip = "5";
this.group4.Label = "Подключения";
this.group4.Name = "group4";
//
// selectAutomatasButton
//
this.selectAutomatasButton.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.selectAutomatasButton.KeyTip = "E";
this.selectAutomatasButton.Label = "Ввести автоматы";
this.selectAutomatasButton.Name = "selectAutomatasButton";
this.selectAutomatasButton.OfficeImageId = "AdpStoredProcedureQuerySelect";
this.selectAutomatasButton.ScreenTip = "Ввод двух автоматов";
this.selectAutomatasButton.ShowImage = true;
this.selectAutomatasButton.SuperTip = "Ввод двух автоматов, которые необходимо соединить одним из данных способов";
this.selectAutomatasButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.selectAutomatasButton_Click);
//
// seriesButton
//
this.seriesButton.Enabled = false;
this.seriesButton.KeyTip = "S";
this.seriesButton.Label = "Посл.";
this.seriesButton.Name = "seriesButton";
this.seriesButton.OfficeImageId = "OutlineDemoteToBodyText";
this.seriesButton.ScreenTip = "Последовательное соединение";
this.seriesButton.ShowImage = true;
this.seriesButton.SuperTip = "Вывод совмещенной таблицы автомата, полученного в результате последовательного по" +
"дключения автоматов";
this.seriesButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.seriesButton_Click);
//
// parallelButton
//
this.parallelButton.Enabled = false;
this.parallelButton.KeyTip = "P";
this.parallelButton.Label = "Парал.";
this.parallelButton.Name = "parallelButton";
this.parallelButton.OfficeImageId = "DatabaseRelationships";
this.parallelButton.ScreenTip = "Параллельное соединение";
this.parallelButton.ShowImage = true;
this.parallelButton.SuperTip = "Вывод совмещенной таблицы автомата, полученного в результате параллельного подклю" +
"чения автоматов, а так же функции преобразования";
this.parallelButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.parallelButton_Click);
//
// separator4
//
this.separator4.Name = "separator4";
//
// iterationsBox
//
this.iterationsBox.Enabled = false;
this.iterationsBox.KeyTip = "IT";
this.iterationsBox.Label = "Итер.:";
this.iterationsBox.Name = "iterationsBox";
this.iterationsBox.OfficeImageId = "MailDelete";
this.iterationsBox.ScreenTip = "Количество итераций";
this.iterationsBox.ShowImage = true;
this.iterationsBox.SizeString = "1";
this.iterationsBox.SuperTip = "Выбор количества итераций при подключении с обратной связью";
this.iterationsBox.Text = null;
this.iterationsBox.TextChanged += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.iterationsBox_TextChanged);
//
// inputsBox
//
this.inputsBox.Enabled = false;
this.inputsBox.KeyTip = "IN";
this.inputsBox.Label = "Вход.:";
this.inputsBox.Name = "inputsBox";
this.inputsBox.OfficeImageId = "MailDelete";
this.inputsBox.ScreenTip = "Количество входов ";
this.inputsBox.ShowImage = true;
this.inputsBox.SizeString = "1";
this.inputsBox.SuperTip = "Выбор количества входов при подключении с обратной связью";
this.inputsBox.Text = null;
this.inputsBox.TextChanged += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.inputsBox_TextChanged);
//
// feedbackButton
//
this.feedbackButton.Enabled = false;
this.feedbackButton.KeyTip = "F";
this.feedbackButton.Label = "Обрат. св.";
this.feedbackButton.Name = "feedbackButton";
this.feedbackButton.OfficeImageId = "MailMergeMatchFields";
this.feedbackButton.ScreenTip = "Обратная связь";
this.feedbackButton.ShowImage = true;
this.feedbackButton.SuperTip = "Вывод совмещенной таблицы автомата, полученного в результате подключения автомато" +
"в методом обратной связи, а так же функции преобразования";
this.feedbackButton.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.feedbackButton_Click);
//
// tab1
//
this.tab1.ControlId.ControlIdType = Microsoft.Office.Tools.Ribbon.RibbonControlIdType.Office;
this.tab1.Label = "TabAddIns";
this.tab1.Name = "tab1";
//
// Ribbon1
//
this.Name = "Ribbon1";
this.RibbonType = "Microsoft.Excel.Workbook";
this.Tabs.Add(this.tab1);
this.Tabs.Add(tab2);
tab2.ResumeLayout(false);
tab2.PerformLayout();
group1.ResumeLayout(false);
group1.PerformLayout();
this.group3.ResumeLayout(false);
this.group3.PerformLayout();
this.group6.ResumeLayout(false);
this.group6.PerformLayout();
this.group7.ResumeLayout(false);
this.group7.PerformLayout();
this.group8.ResumeLayout(false);
this.group8.PerformLayout();
this.group5.ResumeLayout(false);
this.group5.PerformLayout();
this.box1.ResumeLayout(false);
this.box1.PerformLayout();
this.box2.ResumeLayout(false);
this.box2.PerformLayout();
this.group4.ResumeLayout(false);
this.group4.PerformLayout();
this.tab1.ResumeLayout(false);
this.tab1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
internal Microsoft.Office.Tools.Ribbon.RibbonTab tab1;
internal Microsoft.Office.Tools.Ribbon.RibbonButton OpenButton;
internal Microsoft.Office.Tools.Ribbon.RibbonDropDown dropDown1;
internal Microsoft.Office.Tools.Ribbon.RibbonGroup group3;
internal Microsoft.Office.Tools.Ribbon.RibbonGroup group4;
internal Microsoft.Office.Tools.Ribbon.RibbonButton selectAutomatasButton;
internal Microsoft.Office.Tools.Ribbon.RibbonGroup group5;
internal Microsoft.Office.Tools.Ribbon.RibbonButton blocksSPButton;
internal Microsoft.Office.Tools.Ribbon.RibbonBox box1;
internal Microsoft.Office.Tools.Ribbon.RibbonLabel label1;
internal Microsoft.Office.Tools.Ribbon.RibbonButton A1SetsButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton A1StatesButton;
internal Microsoft.Office.Tools.Ribbon.RibbonBox box2;
internal Microsoft.Office.Tools.Ribbon.RibbonLabel label2;
internal Microsoft.Office.Tools.Ribbon.RibbonButton A2SetsButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton A2StatesButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton A2OutputButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton seriesButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton parallelButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton feedbackButton;
internal Microsoft.Office.Tools.Ribbon.RibbonSeparator separator4;
internal Microsoft.Office.Tools.Ribbon.RibbonEditBox iterationsBox;
internal Microsoft.Office.Tools.Ribbon.RibbonEditBox inputsBox;
private Microsoft.Office.Tools.Ribbon.RibbonButton setsButton;
internal Microsoft.Office.Tools.Ribbon.RibbonGroup group6;
internal Microsoft.Office.Tools.Ribbon.RibbonButton combinedButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton statesPartitionsButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton outputsLaba6Button;
internal Microsoft.Office.Tools.Ribbon.RibbonButton outputAngerPoll;
internal Microsoft.Office.Tools.Ribbon.RibbonButton transPartitionsButton;
internal Microsoft.Office.Tools.Ribbon.RibbonGroup group7;
internal Microsoft.Office.Tools.Ribbon.RibbonButton encodeButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton triggerFunctionButton;
internal Microsoft.Office.Tools.Ribbon.RibbonGroup group8;
internal Microsoft.Office.Tools.Ribbon.RibbonButton simplifiedButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton implicatorsButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton calcButton;
internal Microsoft.Office.Tools.Ribbon.RibbonButton enterLab4DataButton;
internal Microsoft.Office.Tools.Ribbon.RibbonSeparator separator6;
}
partial class ThisRibbonCollection
{
internal Ribbon1 Ribbon1
{
get { return this.GetRibbon<Ribbon1>(); }
}
}
}
+297
View File
@@ -0,0 +1,297 @@
using Microsoft.Office.Tools.Ribbon;
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Diagnostics;
namespace Automata_theory
{
public partial class Ribbon1
{
public static bool IsPiEnteredExternally = false;
public static List<List<List<int>>> ExternalPi;
public static bool IsLaba4Ready = false;
// stuff opener
private void OpenButton_Click(object sender, RibbonControlEventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = "C:\\Program Files\\Microsoft Office\\root\\Office16\\WINWORD.EXE",
Arguments = $"Automata\\{dropDown1.SelectedItemIndex}.docx"
};
Process process = new Process
{
StartInfo = startInfo
};
process.Start();
process.Exited += (object ssender, EventArgs ee) =>
{
process.Close();
process.Dispose();
};
}
#region Laba4
private void createAngerPoll_Click(object sender, RibbonControlEventArgs e)
{
Laba4.CurrentTable = Common.CreateTable("Выберите исходную таблицу:");
Laba4.CurrentAngerPoll = Laba4.CalculateAngerPoll(Laba4.CurrentTable);
Laba4.NewTable = Laba4.CalculateNew(Laba4.CurrentAngerPoll, Laba4.CurrentTable);
setsButton.Enabled = true;
combinedButton.Enabled = true;
IsLaba4Ready = true;
enterLab4DataButton.Label = "Разбить";
enterLab4DataButton.OfficeImageId = "TableAutoFormat";
enterLab4DataButton.ScreenTip = "Выполнить разбиения автомата";
enterLab4DataButton.SuperTip = "Выполняет разбиение автомата, полученного в результате минимизации и выводит \u03c0, \u03c4 и \u03b7 разбиения.";
}
private void outputAngerPoll_Click(object sender, RibbonControlEventArgs e)
{
Laba4.DisplayAngerPoll(Laba4.CurrentTable, Laba4.CurrentAngerPoll);
}
private void setsButton_Click(object sender, RibbonControlEventArgs e)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox("Куда вставить множества:", Type: 8);
for (int i = 0; i < Laba4.CurrentAngerPoll.Sets.Count; i++)
{
RG.Columns[1].Rows[i + 1].Value2 = string.Join(", ", Laba4.CurrentAngerPoll.SetsDisp[i]);
}
}
private void statesButton_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayTable(Laba4.NewTable, Common.DisplayMode.OnlyStates, "b");
}
private void outputButton_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayTable(Laba4.NewTable, Common.DisplayMode.OnlyOutput, "b");
}
private void combinedButton_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayTable(Laba4.NewTable, Common.DisplayMode.Everything, "b");
}
private void group6_DialogLauncherClick(object sender, RibbonControlEventArgs e)
{
Laba6Pi form = new Laba6Pi();
form.ShowDialog();
}
#endregion
#region Laba 5.1
private void blocksSPButton_Click(object sender, RibbonControlEventArgs e)
{
Laba5_1.CurrentTable = Common.CreateTable("Выберите автомат:");
Laba5_1.CurrentPartition = new SPPartition(Laba5_1.CurrentTable);
if (Laba5_1.CurrentPartition.IsGood)
{
Range RG = (Range)Globals.ThisAddIn.Application.InputBox("Куда вставить произведение автоматов А1 и А2:", Type: 8);
for (int i = 0; i < Laba5_1.CurrentPartition.States.GetLength(0); i++)
{
for (int j = 0; j < Laba5_1.CurrentPartition.States.GetLength(1); j++)
{
RG.Columns[1 + j + i * Laba5_1.CurrentPartition.States.GetLength(1)].Rows[1].Value2 = $"b{i + 1} x c{j + 1}";
RG.Columns[1 + j + i * Laba5_1.CurrentPartition.States.GetLength(1)].Rows[2].Value2 = $"s{Laba5_1.CurrentPartition.States[i, j] + 1}";
}
}
A1SetsButton.Enabled = true;
A2SetsButton.Enabled = true;
A1StatesButton.Enabled = true;
A2StatesButton.Enabled = true;
A2OutputButton.Enabled = true;
}
}
private void A1SetsButton_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayList(Laba5_1.CurrentPartition.BBlocksDisplay);
}
private void A1StatesButton_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayTable(Laba5_1.CurrentSP1, Common.DisplayMode.OnlyStates, "b");
}
private void A2SetsButton_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayList(Laba5_1.CurrentPartition.CBlocksDisplay);
}
private void A2StatesButton_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayTable(Laba5_1.CurrentSP2, Common.DisplayMode.OnlyStates, "c");
}
private void A2OutputButton_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayTable(Laba5_1.CurrentSP2, Common.DisplayMode.OnlyOutput, "c");
}
#endregion
#region Laba 5
int iter = -1, inp = -1;
private void selectAutomatasButton_Click(object sender, RibbonControlEventArgs e)
{
Laba5.AutomataA = Common.CreateTable("Выберите автомат А:");
Laba5.AutomataB = Common.CreateTable("Выберите автомат В:");
seriesButton.Enabled = true;
parallelButton.Enabled = true;
iterationsBox.Enabled = true;
inputsBox.Enabled = true;
}
private void seriesButton_Click(object sender, RibbonControlEventArgs e)
{
Laba5.SeriesTable = Laba5.CombineSeries(Laba5.AutomataA, Laba5.AutomataB);
Common.DisplayTable(Laba5.SeriesTable, Common.DisplayMode.Everything);
}
private void parallelButton_Click(object sender, RibbonControlEventArgs e)
{
Laba5.ParallelTable = Laba5.CombineParallel(Laba5.AutomataA, Laba5.AutomataB);
Common.DisplayTable(Laba5.ParallelTable, Common.DisplayMode.Everything, false);
Common.DisplayTable(Laba5.TranslationParallel);
}
private void feedbackButton_Click(object sender, RibbonControlEventArgs e)
{
Laba5.FeedbackTable = Laba5.CombineFeedback(Laba5.AutomataA, Laba5.AutomataB, inp, iter);
Common.DisplayTable(Laba5.FeedbackTable, Common.DisplayMode.Everything, false);
Common.DisplayTable(Laba5.TranslationFeedback, "x");
}
private void iterationsBox_TextChanged(object sender, RibbonControlEventArgs e)
{
if (int.TryParse(iterationsBox.Text, out iter))
{
iterationsBox.ShowImage = false;
iterationsBox.OfficeImageId = "";
if (iter > -1 && inp > 0)
feedbackButton.Enabled = true;
else feedbackButton.Enabled = false;
}
else
{
iterationsBox.ShowImage = true;
iterationsBox.OfficeImageId = "MailDelete";
}
}
private void inputsBox_TextChanged(object sender, RibbonControlEventArgs e)
{
if (int.TryParse(inputsBox.Text, out inp))
{
inputsBox.ShowImage = false;
inputsBox.OfficeImageId = "";
if (iter > -1 && inp > 0)
feedbackButton.Enabled = true;
else feedbackButton.Enabled = false;
}
else
{
inputsBox.ShowImage = true;
inputsBox.OfficeImageId = "MailDelete";
}
}
#endregion
#region Laba 6
private void enterLab4DataButton_Click(object sender, RibbonControlEventArgs e)
{
if (IsLaba4Ready)
{
Combine();
}
else
{
Laba4.NewTable = Common.CreateTable("Введите таблицу полученную в результате лабы 4");
Combine();
}
}
private void Combine()
{
Laba6.Partitions = new Partitions(Laba4.NewTable, Laba6.GetPartitionsCount(Laba4.NewTable.States.Length), IsPiEnteredExternally, ExternalPi);
Common.DisplayList(Laba6.Partitions.Pi, '\u03c0');
Common.DisplayList(Laba6.Partitions.Tau, '\u03c4');
Common.DisplayList(Laba6.Partitions.Eta, '\u03b7');
statesPartitionsButton.Enabled = true;
outputsLaba6Button.Enabled = true;
transPartitionsButton.Enabled = true;
//----
encodeButton.Enabled = true;
triggerFunctionButton.Enabled = true;
//---
implicatorsButton.Enabled = true;
}
private void outputsLaba6Button_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayTable(Laba6.Partitions.TableG);
}
private void statesPartitionsButton_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayTables(Laba6.Partitions.Tables, Common.DisplayMode.OnlyStates);
}
private void transPartitionsButton_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayTables(Laba6.Partitions.RelativeTables);
}
#endregion
#region Laba 7
private void encodeButton_Click(object sender, RibbonControlEventArgs e)
{
for (int i = 0; i < Laba6.Partitions.Count; i++)
Common.DisplayTable(Laba6.Partitions.RelativeTables[i], i, true);
Common.DisplayTable(Laba6.Partitions.TableG, true);
}
private void triggerFunctionButton_Click(object sender, RibbonControlEventArgs e)
{
//MessageBox.Show(Laba7.Encode("1 1 011", "0"));
Common.DisplayList(Laba7.TriggerFunctions);
}
#endregion
#region Laba 8
private void implicatorsButton_Click(object sender, RibbonControlEventArgs e)
{
Laba8.SimplifyFunctions();
for (int i = 0; i < Laba8.ImplicatorsTables.Count; i++)
Common.DisplayTable(Laba8.ImplicatorsTables[i]);
calcButton.Enabled = true;
simplifiedButton.Enabled = true;
}
private void calcButton_Click(object sender, RibbonControlEventArgs e)
{
for (int i = 0; i < Laba8.IntersectionsTables.Count; i++)
Common.DisplayTable(Laba8.IntersectionsTables[i]);
}
private void simplifiedButton_Click(object sender, RibbonControlEventArgs e)
{
Common.DisplayList(Laba8.SimpleTriggersFunctions);
}
#endregion
}
}
+129
View File
@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="tab2.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="group1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="createAngerPoll.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
+237
View File
@@ -0,0 +1,237 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#pragma warning disable 414
namespace Automata_theory {
///
[Microsoft.VisualStudio.Tools.Applications.Runtime.StartupObjectAttribute(0)]
[global::System.Security.Permissions.PermissionSetAttribute(global::System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
public sealed partial class ThisAddIn : Microsoft.Office.Tools.AddInBase {
internal Microsoft.Office.Tools.CustomTaskPaneCollection CustomTaskPanes;
internal Microsoft.Office.Tools.SmartTagCollection VstoSmartTags;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
private global::System.Object missing = global::System.Type.Missing;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
internal Microsoft.Office.Interop.Excel.Application Application;
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
public ThisAddIn(global::Microsoft.Office.Tools.Excel.ApplicationFactory factory, global::System.IServiceProvider serviceProvider) :
base(factory, serviceProvider, "AddIn", "ThisAddIn") {
Globals.Factory = factory;
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void Initialize() {
base.Initialize();
this.Application = this.GetHostItem<Microsoft.Office.Interop.Excel.Application>(typeof(Microsoft.Office.Interop.Excel.Application), "Application");
Globals.ThisAddIn = this;
global::System.Windows.Forms.Application.EnableVisualStyles();
this.InitializeCachedData();
this.InitializeControls();
this.InitializeComponents();
this.InitializeData();
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void FinishInitialization() {
this.InternalStartup();
this.OnStartup();
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void InitializeDataBindings() {
this.BeginInitialization();
this.BindToData();
this.EndInitialization();
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void InitializeCachedData() {
if ((this.DataHost == null)) {
return;
}
if (this.DataHost.IsCacheInitialized) {
this.DataHost.FillCachedData(this);
}
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void InitializeData() {
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void BindToData() {
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
private void StartCaching(string MemberName) {
this.DataHost.StartCaching(this, MemberName);
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
private void StopCaching(string MemberName) {
this.DataHost.StopCaching(this, MemberName);
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
private bool IsCached(string MemberName) {
return this.DataHost.IsCached(this, MemberName);
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void BeginInitialization() {
this.BeginInit();
this.CustomTaskPanes.BeginInit();
this.VstoSmartTags.BeginInit();
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void EndInitialization() {
this.VstoSmartTags.EndInit();
this.CustomTaskPanes.EndInit();
this.EndInit();
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void InitializeControls() {
this.CustomTaskPanes = Globals.Factory.CreateCustomTaskPaneCollection(null, null, "CustomTaskPanes", "CustomTaskPanes", this);
this.VstoSmartTags = Globals.Factory.CreateSmartTagCollection(null, null, "VstoSmartTags", "VstoSmartTags", this);
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void InitializeComponents() {
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
private bool NeedsFill(string MemberName) {
return this.DataHost.NeedsFill(this, MemberName);
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void OnShutdown() {
this.VstoSmartTags.Dispose();
this.CustomTaskPanes.Dispose();
base.OnShutdown();
}
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
internal sealed partial class Globals {
///
private Globals() {
}
private static ThisAddIn _ThisAddIn;
private static global::Microsoft.Office.Tools.Excel.ApplicationFactory _factory;
private static ThisRibbonCollection _ThisRibbonCollection;
internal static ThisAddIn ThisAddIn {
get {
return _ThisAddIn;
}
set {
if ((_ThisAddIn == null)) {
_ThisAddIn = value;
}
else {
throw new System.NotSupportedException();
}
}
}
internal static global::Microsoft.Office.Tools.Excel.ApplicationFactory Factory {
get {
return _factory;
}
set {
if ((_factory == null)) {
_factory = value;
}
else {
throw new System.NotSupportedException();
}
}
}
internal static ThisRibbonCollection Ribbons {
get {
if ((_ThisRibbonCollection == null)) {
_ThisRibbonCollection = new ThisRibbonCollection(_factory.GetRibbonFactory());
}
return _ThisRibbonCollection;
}
}
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
internal sealed partial class ThisRibbonCollection : Microsoft.Office.Tools.Ribbon.RibbonCollectionBase {
///
internal ThisRibbonCollection(global::Microsoft.Office.Tools.Ribbon.RibbonFactory factory) :
base(factory) {
}
}
}
+5
View File
@@ -0,0 +1,5 @@
<hostitem:hostItem hostitem:baseType="Microsoft.Office.Tools.AddInBase" hostitem:namespace="Automata_theory" hostitem:className="ThisAddIn" hostitem:identifier="ThisAddIn" hostitem:primaryCookie="AddIn" hostitem:master="true" hostitem:factoryType="Microsoft.Office.Tools.Excel.ApplicationFactory" hostitem:startupIndex="0" xmlns:hostitem="http://schemas.microsoft.com/2004/VisualStudio/Tools/Applications/HostItem.xsd">
<hostitem:hostObject hostitem:name="Application" hostitem:identifier="Application" hostitem:type="Microsoft.Office.Interop.Excel.Application" hostitem:cookie="Application" hostitem:modifier="Internal" />
<hostitem:hostControl hostitem:name="CustomTaskPanes" hostitem:identifier="CustomTaskPanes" hostitem:type="Microsoft.Office.Tools.CustomTaskPaneCollection" hostitem:primaryCookie="CustomTaskPanes" hostitem:modifier="Internal" />
<hostitem:hostControl hostitem:name="VstoSmartTags" hostitem:identifier="VstoSmartTags" hostitem:type="Microsoft.Office.Tools.SmartTagCollection" hostitem:primaryCookie="VstoSmartTags" hostitem:modifier="Internal" />
</hostitem:hostItem>
+36
View File
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Excel;
namespace Automata_theory
{
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}