-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComparison.cs
More file actions
56 lines (51 loc) · 1.69 KB
/
Copy pathComparison.cs
File metadata and controls
56 lines (51 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TabularMethod
{
public class Comparison
{
//The properties
public List<string> ChangedMinterms = new List<string>();
public List<string> LeftMinterms = new List<string>();
public bool IsNew = false;
//Minterms must be sorted and duplicates must be removed for this to work
public Comparison(List<string> minterms)
{
for (int i = 0; i < minterms.Count(); i++)
{
string first = minterms[i];
for (int j = i; j < minterms.Count(); j++)
{
string second = minterms[j];
if (Tools.DifferenceCounter(first, second) == 1)
{
IsNew = true;
var ch = first.ToCharArray();
ch[Tools.DifferenceFinder(first, second)] = 'X';
ChangedMinterms.Add(new string(ch));
}
}
}
for (int j = 0; j < minterms.Count(); j++)
{
foreach (string item in ChangedMinterms)
{
for (int i = 0; i < minterms.Count(); i++)
{
if (Tools.DifferenceCounter(item, minterms[i]) == 1)
{
minterms.Remove(minterms[i]);
}
}
}
}
foreach (string item in minterms)
{
LeftMinterms.Add(item);
}
}
}
}