|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
CalculatorImpl.java | - | 0% | 0% | 0% |
|
1 |
// Copyright 2004, 2005 The Apache Software Foundation
|
|
2 |
//
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
5 |
// You may obtain a copy of the License at
|
|
6 |
//
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
//
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
// See the License for the specific language governing permissions and
|
|
13 |
// limitations under the License.
|
|
14 |
|
|
15 |
package org.apache.hivemind.examples.impl;
|
|
16 |
|
|
17 |
import org.apache.hivemind.examples.Adder;
|
|
18 |
import org.apache.hivemind.examples.Calculator;
|
|
19 |
import org.apache.hivemind.examples.Divider;
|
|
20 |
import org.apache.hivemind.examples.Multiplier;
|
|
21 |
import org.apache.hivemind.examples.Subtracter;
|
|
22 |
|
|
23 |
/**
|
|
24 |
* Implementation of the {@link org.apache.hivemind.examples.Calculator}
|
|
25 |
* service interface. Acts as a facade, delegating each operation to other
|
|
26 |
* services. The <code>hivemind.BuilderFactory</code>
|
|
27 |
*
|
|
28 |
* @author Howard Lewis Ship
|
|
29 |
*/
|
|
30 |
public class CalculatorImpl implements Calculator |
|
31 |
{ |
|
32 |
private Adder _adder;
|
|
33 |
private Subtracter _subtracter;
|
|
34 |
private Multiplier _multiplier;
|
|
35 |
private Divider _divider;
|
|
36 |
|
|
37 | 0 |
public double add(double arg0, double arg1) |
38 |
{ |
|
39 | 0 |
return _adder.add(arg0, arg1);
|
40 |
} |
|
41 |
|
|
42 | 0 |
public double subtract(double arg0, double arg1) |
43 |
{ |
|
44 | 0 |
return _subtracter.subtract(arg0, arg1);
|
45 |
} |
|
46 |
|
|
47 | 0 |
public double multiply(double arg0, double arg1) |
48 |
{ |
|
49 | 0 |
return _multiplier.multiply(arg0, arg1);
|
50 |
} |
|
51 |
|
|
52 | 0 |
public double divide(double arg0, double arg1) |
53 |
{ |
|
54 | 0 |
return _divider.divide(arg0, arg1);
|
55 |
} |
|
56 |
|
|
57 | 0 |
public void setAdder(Adder adder) |
58 |
{ |
|
59 | 0 |
_adder = adder; |
60 |
} |
|
61 |
|
|
62 | 0 |
public void setDivider(Divider divider) |
63 |
{ |
|
64 | 0 |
_divider = divider; |
65 |
} |
|
66 |
|
|
67 | 0 |
public void setMultiplier(Multiplier multiplier) |
68 |
{ |
|
69 | 0 |
_multiplier = multiplier; |
70 |
} |
|
71 |
|
|
72 | 0 |
public void setSubtracter(Subtracter subtracter) |
73 |
{ |
|
74 | 0 |
_subtracter = subtracter; |
75 |
} |
|
76 |
|
|
77 |
} |
|
78 |
|
|