Update PDFunction.java

Changed to not alter value of argument "function" and make creation of PDFunction clearer by using a switch statement.