예제 #1
0
 /*
  * Default constructor.Although there are two standard inputs, one of them might be equal to null
  * (for example:NOT-gate)
  */
 public LogicGate(StatePoint A, StatePoint B)
 {
     output = new StatePoint(0,false);
     A.setOwner(this);
     B.setOwner(this);
     this.input1 = A;
     this.input2 = B;
 }
예제 #2
0
        public void disconnectTwoPoints(StatePoint A, StatePoint B)
        {
            int i = 0;
            bool mustRun = true;

            while (i < connections.Count && mustRun)
            {
                Connection c = connections.ElementAt(i);
                if (c.getStartPoint().Equals(A) && c.getEndPoint().Equals(B))
                {
                    connections.Remove(c);
                    mustRun = false;
                }
                //Trying to save some procedures.
            }
        }
예제 #3
0
 public void connectTwoPoints(StatePoint A, StatePoint B)
 {
     Connection c = new Connection(A, B);
     connections.Add(c);
 }
예제 #4
0
 public void addOutputPort(StatePoint A)
 {
     outputPorts.Add(A);
 }
예제 #5
0
 //Methods to add or remove input/output ports and logic gates
 public void addInputPort(StatePoint A)
 {
     inputPorts.Add(A);
 }
예제 #6
0
 public void removeOutputPort(StatePoint A)
 {
     outputPorts.Remove(A);
 }
예제 #7
0
 public void removeInputPort(StatePoint A)
 {
     inputPorts.Remove(A);
 }
예제 #8
0
 public Connection(StatePoint startPoint, StatePoint endPoint)
 {
     this.startPoint = startPoint;
     this.endPoint = endPoint;
 }