From 1958336d297432f9b43b44ca24dbabb0cbf6e114 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 24 Apr 2017 22:25:29 -0400 Subject: [PATCH] Remove old code from evaluate functions for and and not gates. --- src/AndGate.cpp | 9 +++------ src/NandGate.cpp | 8 ++------ src/NotGate.cpp | 4 ---- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/AndGate.cpp b/src/AndGate.cpp index 5c13abf..e257945 100644 --- a/src/AndGate.cpp +++ b/src/AndGate.cpp @@ -10,14 +10,11 @@ AndGate::AndGate(int d, Wire* wire1, Wire* wire2, Wire* wire3) { } Event AndGate::evaluate(int evTime) { if (in1->getValue(evTime) == 0 || in2->getValue(evTime) == 0) { - if (out->getValue(evTime + delay) != 0) { - return Event(-1, 0, evTime + delay, out); - } + return Event(-1, 0, evTime + delay, out); + } else if(in1->getValue(evTime) == 1 && in2->getValue(evTime) == 1){ - if (out->getValue(evTime + delay) != 1) { - return Event(-1, 1, evTime + delay, out); - } + return Event(-1, 1, evTime + delay, out); } } diff --git a/src/NandGate.cpp b/src/NandGate.cpp index 1e64989..bc403ae 100644 --- a/src/NandGate.cpp +++ b/src/NandGate.cpp @@ -11,14 +11,10 @@ NandGate::NandGate(int d, Wire * wire1, Wire * wire2, Wire * wire3) Event NandGate::evaluate(int evTime) { if (in1->getValue(evTime) == 0 || in2->getValue(evTime) == 0) { - if (out->getValue(evTime + delay) != 1) { - return Event(-1, 1, evTime + delay, out); - } + return Event(-1, 1, evTime + delay, out); } else { - if (out->getValue(evTime + delay) != 0) { - return Event(-1, 0, evTime + delay, out); - } + return Event(-1, 0, evTime + delay, out); } } diff --git a/src/NotGate.cpp b/src/NotGate.cpp index 05eca8f..90e5684 100644 --- a/src/NotGate.cpp +++ b/src/NotGate.cpp @@ -10,14 +10,10 @@ NotGate::NotGate(int d, Wire* wire1, Wire* wire2) { Event NotGate::evaluate(int evTime) { if (in1->getValue(evTime) == 0) { - if (out->getValue(evTime + delay) != 0) { return Event(-1, 0, evTime + delay, out); - } } else{ - if (out->getValue(evTime + delay) != 1) { return Event(-1, 1, evTime + delay, out); - } } }