286N/A/*
286N/A * reserved comment block
286N/A * DO NOT REMOVE OR ALTER!
286N/A */
286N/A/*
286N/A * Copyright 1999-2004 The Apache Software Foundation.
286N/A *
286N/A * Licensed under the Apache License, Version 2.0 (the "License");
286N/A * you may not use this file except in compliance with the License.
286N/A * You may obtain a copy of the License at
286N/A *
286N/A * http://www.apache.org/licenses/LICENSE-2.0
286N/A *
286N/A * Unless required by applicable law or agreed to in writing, software
286N/A * distributed under the License is distributed on an "AS IS" BASIS,
286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286N/A * See the License for the specific language governing permissions and
286N/A * limitations under the License.
286N/A */
286N/A/*
286N/A * $Id: Minus.java,v 1.2.4.1 2005/09/14 21:31:44 jeffsuttor Exp $
286N/A */
286N/Apackage com.sun.org.apache.xpath.internal.operations;
286N/A
286N/Aimport com.sun.org.apache.xpath.internal.XPathContext;
286N/Aimport com.sun.org.apache.xpath.internal.objects.XNumber;
286N/Aimport com.sun.org.apache.xpath.internal.objects.XObject;
286N/A
286N/A/**
286N/A * The binary '-' operation expression executer.
286N/A */
286N/Apublic class Minus extends Operation
286N/A{
286N/A static final long serialVersionUID = -5297672838170871043L;
286N/A
286N/A /**
286N/A * Apply the operation to two operands, and return the result.
286N/A *
286N/A *
286N/A * @param left non-null reference to the evaluated left operand.
286N/A * @param right non-null reference to the evaluated right operand.
286N/A *
286N/A * @return non-null reference to the XObject that represents the
286N/A * result of the operation.
286N/A *
286N/A * @throws javax.xml.transform.TransformerException
286N/A */
286N/A public XObject operate(XObject left, XObject right)
286N/A throws javax.xml.transform.TransformerException
286N/A {
286N/A return new XNumber(left.num() - right.num());
286N/A }
286N/A
286N/A /**
286N/A * Evaluate this operation directly to a double.
286N/A *
286N/A * @param xctxt The runtime execution context.
286N/A *
286N/A * @return The result of the operation as a double.
286N/A *
286N/A * @throws javax.xml.transform.TransformerException
286N/A */
286N/A public double num(XPathContext xctxt)
286N/A throws javax.xml.transform.TransformerException
286N/A {
286N/A
286N/A return (m_left.num(xctxt) - m_right.num(xctxt));
286N/A }
286N/A
286N/A}