added PieceWiseFunction, FunctionIterator and tests therefore