Encoders inherit more from Encoder() class

refactors encoders to share more common fields and methods in parent `base.Encoder` class. 
Should simplify creation of a new encoder, and assertion tests share more common paths, so better testing (for tests :) )
I'd like to get this done before I start on reimplementation in c++ https://github.com/numenta/nupic.core/issues/62

fixes #544 
fixes #981 
fixes #947 

Looks like you have tabs in some places. Make sure to always use 2 spaces rather than tab characters.