aboutsummaryrefslogtreecommitdiff
path: root/Node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Node.cpp')
-rw-r--r--Node.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/Node.cpp b/Node.cpp
index 7832d30..eb3428e 100644
--- a/Node.cpp
+++ b/Node.cpp
@@ -1,12 +1,8 @@
-#include <iostream>
-
#include "Node.h"
#include "NodeFactory.h"
#include "Net.h"
#include "Exception.h"
-#include "prut.h"
-
Node::Node(const char * type) {
NodeFactory::assign(type, this);
}
@@ -17,19 +13,18 @@ void Node::addInput(Net * net) {
}
void Node::setOutput(Net * net){
- if (this->output == nullptr) {
- this->output = net;
- } else {
- throw CircuitException("Net already assigned");
- }
+ if (this->output != nullptr)
+ throw CircuitException("net already assigned");
+
+ this->output = net;
}
void Node::sim() {
size_t input_size = this->inputs.size();
if (this->min_inputs >= 0 && input_size < min_inputs)
- throw CircuitException("Too few inputs");
+ throw CircuitException("too few inputs");
if (this->max_inputs >= 0 && input_size > max_inputs)
- throw CircuitException("Too many inputs");
+ throw CircuitException("too many inputs");
// NodeOutput does not have an output itself
if (this->output == nullptr) return;