001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.el;
018
019import java.math.BigDecimal;
020import java.math.BigInteger;
021
022import javax.servlet.jsp.el.ELException;
023
024/**
025 *
026 * <p>This is the superclass for all binary arithmetic operators
027 * 
028 * @author Nathan Abramson - Art Technology Group
029 * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: bayard $
030 **/
031
032public abstract class ArithmeticOperator
033  extends BinaryOperator
034{
035  //-------------------------------------
036  /**
037   *
038   * Applies the operator to the given value
039   **/
040  public Object apply (Object pLeft,
041                       Object pRight)
042    throws ELException
043  {
044    return Coercions.applyArithmeticOperator (pLeft, pRight, this);
045  }
046
047  //-------------------------------------
048  /**
049   *
050   * Applies the operator to the given double values, returning a double
051   **/
052  public abstract double apply (double pLeft, double pRight);
053  
054  //-------------------------------------
055  /**
056   *
057   * Applies the operator to the given double values, returning a double
058   **/
059  public abstract long apply (long pLeft, long pRight);
060  
061  //-------------------------------------
062
063    /**
064     *
065     * Applies the operator to the given BigDecimal values, returning a
066     * BigDecimal.
067     **/
068    public abstract BigDecimal apply(BigDecimal pLeft, BigDecimal pRight);
069
070    //-------------------------------------
071
072    /**
073     *
074     * Applies the operator to the given BigInteger values, returning a
075     * BigInteger.
076     **/
077    public abstract BigInteger apply(BigInteger pLeft, BigInteger pRight);
078
079    //-------------------------------------
080}