aboutsummaryrefslogtreecommitdiff
path: root/entries/nritschel/fib-java/src/FibonacciNumber.java
blob: fc9381fa8ef616389770d92076044c0ddab4d98d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
    }
}