Algebras generated by the Bergman and anti-Bergman projections and by multiplications by piecewise continuous functions