jeops.examples.fibonacci
Class Fibonacci

java.lang.Object
  |
  +--jeops.examples.fibonacci.Fibonacci

public class Fibonacci
extends java.lang.Object

This class models an encapsulation for a solution for the Fibonacci series.

Version:
0.01 15 Mar 1998
Author:
Carlos Figueira Filho (csff@cin.ufpe.br)

Field Summary
 int n
          The order of this element of the series.
 Fibonacci son1
          The first subproblem used to solve this recursion.
 Fibonacci son2
          The second subproblem used to solve this recursion.
 int value
          The value of the element in the series.
 
Constructor Summary
Fibonacci(int n)
          Class constructor.
 
Method Summary
 int getN()
          Returns the order of this element of the series.
 Fibonacci getSon1()
          Returns the first subproblem used to solve this recursion.
 Fibonacci getSon2()
          Returns the second subproblem used to solve this recursion.
 int getValue()
          Returns the value of this element of the series.
 void setSon1(Fibonacci newValue)
          Defines the first subproblem used to solve this recursion.
 void setSon2(Fibonacci newValue)
          Defines the second subproblem used to solve this recursion.
 void setValue(int newValue)
          Defines the value of this element in the series.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

n

public int n
The order of this element of the series.

value

public int value
The value of the element in the series.

son1

public Fibonacci son1
The first subproblem used to solve this recursion.

son2

public Fibonacci son2
The second subproblem used to solve this recursion.
Constructor Detail

Fibonacci

public Fibonacci(int n)
Class constructor.
Parameters:
n - the order of the series.
Method Detail

getN

public int getN()
Returns the order of this element of the series.
Returns:
the order of this element of the series.

getSon1

public Fibonacci getSon1()
Returns the first subproblem used to solve this recursion.
Returns:
the first subproblem used to solve this recursion

getSon2

public Fibonacci getSon2()
Returns the second subproblem used to solve this recursion.
Returns:
the second subproblem used to solve this recursion

getValue

public int getValue()
Returns the value of this element of the series.
Returns:
the value of this element of the series, or -1 if the value hasb't been calculated yet.

setSon1

public void setSon1(Fibonacci newValue)
Defines the first subproblem used to solve this recursion.
Parameters:
newValue - the first subproblem used to solve this recursion.

setSon2

public void setSon2(Fibonacci newValue)
Defines the second subproblem used to solve this recursion.
Parameters:
newValue - the second subproblem used to solve this recursion.

setValue

public void setValue(int newValue)
Defines the value of this element in the series.
Parameters:
newValue - the value of this element in the series.