View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2008 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  package ch.elca.el4j.tests.remoting.service;
18  
19  /**
20   * This interface is a calculator.
21   *
22   * @svnLink $Revision: 3873 $;$Date: 2009-08-04 13:59:45 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/tests/remoting/web/jar/src/main/java/ch/elca/el4j/tests/remoting/service/Calculator.java $
23   *
24   * @author Martin Zeltner (MZE)
25   */
26  public interface Calculator {
27  	/**
28  	 * This method calculates the area of a rectangle.
29  	 *
30  	 * @param a
31  	 *            Is the first side.
32  	 * @param b
33  	 *            Is the second side.
34  	 * @return Returns the area of the triangle.
35  	 */
36  	public double getArea(double a, double b);
37  	
38  	/**
39  	 * This method throws an exception for test reason.
40  	 *
41  	 * @throws CalculatorException will be thrown every time.
42  	 */
43  	public void throwMeAnException() throws CalculatorException;
44  	
45  	/**
46  	 * This method throws a special exception for test reason.
47  	 *
48  	 * @param action Is the dynamic part of the thrown exception.
49  	 * @throws SpecialCalculatorException will be thrown every time.
50  	 */
51  	public void throwMeASpecialException(String action)
52  		throws SpecialCalculatorException;
53  
54  	/**
55  	 * This method counts all uppercase letters of a text.
56  	 *
57  	 * @param text Is the object to analyze.
58  	 * @return Returns the number of uppercase letters.
59  	 */
60  	public int countNumberOfUppercaseLetters(String text);
61  	
62  	/**
63  	 * This method does an echo of the given object.
64  	 *
65  	 * @param o Is the object to echo.
66  	 * @return Returns the received object.
67  	 */
68  	public CalculatorValueObject echoValueObject(CalculatorValueObject o);
69  	
70  	/**
71  	 * Executes the given operation with <code>a</code> and <code>b</code> and
72  	 * returns the result.
73  	 *
74  	 * @param a Is the first parameter for the calculation.
75  	 * @param b Is the second parameter for the calculation.
76  	 * @param operation Is the operation to execute.
77  	 * @return Returns the calculated result.
78  	 */
79  	public double calculate(double a, double b, CalculatorOperation operation);
80  }