@@ -0,0 +1,1930 @@
+/*%0A * This file is part of Mapyrus, software for plotting maps.%0A * Copyright (C) 2003 Simon Chenery.%0A *%0A * Mapyrus is free software; you can redistribute it and/or modify%0A * it under the terms of the GNU Lesser General Public License as published by%0A * the Free Software Foundation; either version 2 of the License, or%0A * (at your option) any later version.%0A *%0A * Mapyrus is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Lesser General Public License for more details.%0A *%0A * You should have received a copy of the GNU Lesser General Public License%0A * along with Mapyrus; if not, write to the Free Software%0A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA%0A */%0A%0A/*%0A * @(#) $Id$%0A */%0Apackage org.mapyrus.function;%0A%0Aimport org.mapyrus.Argument;%0Aimport org.mapyrus.ContextStack;%0Aimport org.mapyrus.MapyrusException;%0Aimport org.mapyrus.MapyrusMessages;%0A%0A/**%0A * Function returning square root of value.%0A * For example, sqrt(9) = 3.%0A */%0Apublic class Sqrt extends Function%0A%7B%0A%09/**%0A%09 * @see org.mapyrus.function.Function#evaluate(org.mapyrus.ContextStack, org.mapyrus.Argument, org.mapyrus.Argument)%0A%09 */%0A%09public Argument evaluate(ContextStack context, Argument arg1)%0A%09%09throws MapyrusException%0A%09%7B%0A%09%09double d = arg1.getNumericValue();%0A%09%09if (d %3C 0.0)%0A%09%09%09throw new MapyrusException(MapyrusMessages.get(MapyrusMessages.NUMERIC_OVERFLOW));%0A%09%0A%09%09d = Math.sqrt(d);%0A%09%09Argument retval = new Argument(d);%0A%09%09return(retval);%0A%09%7D%0A%0A%09/**%0A%09 * @see org.mapyrus.function.Function#getMaxArgumentCount()%0A%09 */%0A%09public int getMaxArgumentCount()%0A%09%7B%0A%09%09return(1);%0A%09%7D%0A%0A%09/**%0A%09 * @see org.mapyrus.function.Function#getMinArgumentCount()%0A%09 */%0A%09public int getMinArgumentCount()%0A%09%7B%0A%09%09return(1);%0A%09%7D%0A%0A%09/**%0A%09 * @see org.mapyrus.function.Function#getName()%0A%09 */%0A%09public String getName()%0A%09%7B%0A%09%09return(%22sqrt%22);%0A%09%7D%0A%7D%0A

Split functions out from Expression.java into separate classes.