Improved the efficiency of trigger() of Gates

Removed the need of triggering the output of a gate while assuming a value for its result while finding out its actual result (for example in AND gates) by changing the _updateResult() function
Now, the outputConnector is triggered only once (per change in input) at the end after the result is calculated.