generator.engin.utils
Class Partition

java.lang.Object
  extended by generator.engin.utils.Partition

public class Partition
extends java.lang.Object

Partition

This class is used to split a real number into several real numbers for which the sum equals the original number. This class cannot be instancied as the only method it contains is static.

Copyright(c) 2005 Université Laval, LSFM research group.

Version:
1.0
Author:
Frédérick Lemay

Constructor Summary
Partition()
           
 
Method Summary
static java.util.ArrayList divide(double number, int numberOfParts)
          Split a real number into several smaller numbers for which the sum equals the original number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Partition

public Partition()
Method Detail

divide

public static java.util.ArrayList divide(double number,
                                         int numberOfParts)
                                  throws PartitionException
Split a real number into several smaller numbers for which the sum equals the original number.

Parameters:
number - the real number to divide
numberOfParts - the number of parts to create
Returns:
an array containing the generated numbers
Throws:
PartitionException - should the algorithm fail