aboutsummaryrefslogtreecommitdiff
path: root/entries/nritschel/fib-java/src/FibonacciNumber.java
diff options
context:
space:
mode:
Diffstat (limited to 'entries/nritschel/fib-java/src/FibonacciNumber.java')
-rw-r--r--entries/nritschel/fib-java/src/FibonacciNumber.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/entries/nritschel/fib-java/src/FibonacciNumber.java b/entries/nritschel/fib-java/src/FibonacciNumber.java
new file mode 100644
index 0000000..fc9381f
--- /dev/null
+++ b/entries/nritschel/fib-java/src/FibonacciNumber.java
@@ -0,0 +1,19 @@
+public class FibonacciNumber {
+ private final int number;
+ private Integer result;
+
+ public FibonacciNumber(int number) {
+ this.number = number;
+ }
+
+ public int getNumber() {
+ return number;
+ }
+
+ public int calculate(FibonacciCalculator calculator) {
+ if (result == null) {
+ result = calculator.calculateFibonacci(this);
+ }
+ return result;
+ }
+}