com.objectwave.utility
Class Combinatoric

java.lang.Object
  |
  +--com.objectwave.utility.Combinatoric

public class Combinatoric
extends java.lang.Object

The class Combinatoric contains methods for performing basic combinatoric operations such as counting numbers of permutations and combinations.

Version:
$Id: Combinatoric.java,v 2.1 2002/08/10 15:12:24 dave_hoag Exp $
Author:
dave_hoag

Constructor Summary
Combinatoric()
           
 
Method Summary
static java.math.BigInteger c(int n, int m)
           
static java.math.BigInteger factorial(int n)
           
static java.math.BigInteger p(int n)
           
static java.math.BigInteger p(int n, int m)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Combinatoric

public Combinatoric()
Method Detail

c

public static java.math.BigInteger c(int n,
                                     int m)
                              throws CombinatoricException
Parameters:
n - int
m - int
Returns:
BigInteger, the number of unordered subsets of m objects chosen from a group of n objects.
Throws:
CombinatoricException - unless n >= m >= 0

factorial

public static java.math.BigInteger factorial(int n)
                                      throws CombinatoricException
Parameters:
n - int
Returns:
BigInteger, the product of the numbers 1 ... n
Throws:
CombinatoricException - unless n >= 0

p

public static java.math.BigInteger p(int n)
                              throws CombinatoricException
Parameters:
n - int
Returns:
BigInteger, the number of possible ways of ordering n objects
Throws:
CombinatoricException - unless n >= 0

p

public static java.math.BigInteger p(int n,
                                     int m)
                              throws CombinatoricException
Parameters:
n - int
m - int
Returns:
BigInteger, the number of possible arrangements, or orderings, of m objects chosen from a group of n objects.
Throws:
CombinatoricException - unless n >= m >= 0