org.apache.hadoop.examples.pi.math
Class Summation

java.lang.Object
  extended by org.apache.hadoop.examples.pi.math.Summation
All Implemented Interfaces:
Comparable<Summation>, Combinable<Summation>, Container<Summation>

public class Summation
extends Object
implements Container<Summation>, Combinable<Summation>

Represent the summation \sum \frac{2^e \mod n}{n}.


Field Summary
 ArithmeticProgression E
          Variable e in the summation.
 ArithmeticProgression N
          Variable n in the summation.
 
Constructor Summary
Summation(ArithmeticProgression N, ArithmeticProgression E)
          Constructor
 
Method Summary
 Summation combine(Summation that)
          Combine this with that.
 int compareTo(Summation that)
          
 double compute()
          Compute the value of the summation.
 boolean contains(Summation that)
          Does this contains that?
 boolean equals(Object obj)
          
 Summation getElement()
          
 Double getValue()
          Return the value of this summation
 int hashCode()
          Not supported
 Summation[] partition(int nParts)
          Partition the summation.
<T extends Container<Summation>>
List<Summation>
remainingTerms(List<T> sorted)
          Find the remaining terms.
 void setValue(double v)
          Set the value of this summation
 String toString()
          
static Summation valueOf(String s)
          Covert a String to a Summation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

N

public final ArithmeticProgression N
Variable n in the summation.


E

public final ArithmeticProgression E
Variable e in the summation.

Constructor Detail

Summation

public Summation(ArithmeticProgression N,
                 ArithmeticProgression E)
Constructor

Method Detail

getElement

public Summation getElement()

Specified by:
getElement in interface Container<Summation>
Returns:
The contained element.

getValue

public Double getValue()
Return the value of this summation


setValue

public void setValue(double v)
Set the value of this summation


toString

public String toString()

Overrides:
toString in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()
Not supported

Overrides:
hashCode in class Object

valueOf

public static Summation valueOf(String s)
Covert a String to a Summation.


compute

public double compute()
Compute the value of the summation.


compareTo

public int compareTo(Summation that)

Specified by:
compareTo in interface Comparable<Summation>

combine

public Summation combine(Summation that)
Combine this with that.

Specified by:
combine in interface Combinable<Summation>
Parameters:
that - Another object.
Returns:
The combined object.

remainingTerms

public <T extends Container<Summation>> List<Summation> remainingTerms(List<T> sorted)
Find the remaining terms.


contains

public boolean contains(Summation that)
Does this contains that?


partition

public Summation[] partition(int nParts)
Partition the summation.



Copyright © 2009 The Apache Software Foundation