Refactored code

Implemented common functionality of registers in the IRegister abstract
class. Replaced use of Tuple by Triple.
Implemented the setQubit operation in register.