Add methods to BaseAlgorithm to avoid many isInstanceOf checks.