예제 #1
0
            public Nor() : base(2)
            {
                List <Gate>     gates     = new List <Gate>();
                List <GateLink> gateLinks = new List <GateLink>();

                for (var i = 0; i < 4; i++)
                {
                    gates.Add(new Gate(i));
                }

                Gate A  = gates.Where(g => g.Id == 0).FirstOrDefault();
                Gate B  = gates.Where(g => g.Id == 1).FirstOrDefault();
                Gate C  = gates.Where(g => g.Id == 2).FirstOrDefault();
                Gate D  = gates.Where(g => g.Id == 3).FirstOrDefault();
                var  f0 = new GateLink(0, A, A);
                var  f1 = new GateLink(1, B, B);
                var  f2 = new GateLink(2, f0, f1);
                var  f3 = new GateLink(3, f2, f2);

                gateLinks.Add(f0);
                gateLinks.Add(f1);
                gateLinks.Add(f2);
                gateLinks.Add(f3);

                Set(gates, gateLinks);
            }
예제 #2
0
            public And() : base(2)
            {
                List <Gate>     gates     = new List <Gate>();
                List <GateLink> gateLinks = new List <GateLink>();

                for (var i = 0; i < 2; i++)
                {
                    gates.Add(new Gate(i));
                }

                Gate A    = gates.Where(g => g.Id == 0).FirstOrDefault();
                Gate B    = gates.Where(g => g.Id == 1).FirstOrDefault();
                var  link = new GateLink(0, A, B);

                gateLinks.Add(link);
                gateLinks.Add(new GateLink(1, link, link));
                Set(gates, gateLinks);
            }
예제 #3
0
            public Or() : base(2)
            {
                List <Gate>     gates     = new List <Gate>();
                List <GateLink> gateLinks = new List <GateLink>();

                for (var i = 0; i < 3; i++)
                {
                    gates.Add(new Gate(i));
                }

                Gate A     = gates.Where(g => g.Id == 0).FirstOrDefault();
                Gate B     = gates.Where(g => g.Id == 1).FirstOrDefault();
                Gate C     = gates.Where(g => g.Id == 2).FirstOrDefault();
                var  link1 = new GateLink(0, A, A);
                var  link2 = new GateLink(1, B, B);

                gateLinks.Add(link1);
                gateLinks.Add(link2);
                gateLinks.Add(new GateLink(2, link1, link2));

                Set(gates, gateLinks);
            }
예제 #4
0
 public GateLink(int v, GateLink from, GateLink from2)
 {
     Id     = v;
     _from  = from;
     _from2 = from2;
 }
예제 #5
0
 public GateLink(int v, GateLink from, Gate c)
 {
     Id     = v;
     _from  = from;
     this.c = c;
 }