de.bezier.math.combinatorics
Class CombinatoricsBase

java.lang.Object
  extended by de.bezier.math.combinatorics.CombinatoricsBase
Direct Known Subclasses:
Combination, CombinatoricsBaseSet, Permutation, Variation

public abstract class CombinatoricsBase
extends java.lang.Object

Base class for Combination, Variation, Permutation and CombinatoricsBaseSet

You normaly should not be using this class on it's own ...


Constructor Summary
CombinatoricsBase()
           
CombinatoricsBase(int elements)
           
CombinatoricsBase(int elements, int length)
           
 
Method Summary
abstract  boolean hasMore()
          Check if there are more results available to be read.
abstract  int[] next()
          Return next result and update internal counter.
 int[] nextAndStep(int step)
          Return result and step foreward for given amount of steps (that is: skip results)
 int numberOfElements()
           
 java.math.BigInteger position()
          Return copy of the internal counter (number of results returned) as BigInteger
 int positionAsInt()
          Try to return internal counter (number of results returned) as int
 long positionAsLong()
          Try to return internal counter (number of results returned) as long
 float positionInPercent()
           
 float positionInPercent(int precision)
           
abstract  void rewind()
          Rewind, start over, reset, recycle.
 java.math.BigInteger total()
          Return total number of results as BigInteger (cloned)
 int totalAsInt()
          Try to return total number of results as int
 long totalAsLong()
          Try to return total number of results as long
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombinatoricsBase

public CombinatoricsBase()

CombinatoricsBase

public CombinatoricsBase(int elements)

CombinatoricsBase

public CombinatoricsBase(int elements,
                         int length)
Method Detail

numberOfElements

public int numberOfElements()
Returns:
Number of elements as given in parameter "elements" to constructor

positionInPercent

public float positionInPercent()
Returns:
Percent of how many results have been returned

positionInPercent

public float positionInPercent(int precision)
Parameters:
precision - Round down to this precision (digits after the dot)
Returns:
Percent of how many results have been returned

positionAsInt

public int positionAsInt()
Try to return internal counter (number of results returned) as int

Returns:
Internal counter as int

positionAsLong

public long positionAsLong()
Try to return internal counter (number of results returned) as long

Returns:
Internal counter as long

position

public java.math.BigInteger position()
Return copy of the internal counter (number of results returned) as BigInteger

Returns:
Internal counter
See Also:
BigInteger

totalAsInt

public int totalAsInt()
Try to return total number of results as int

Returns:
Total number of results as int
See Also:
BigInteger

totalAsLong

public long totalAsLong()
Try to return total number of results as long

Returns:
Total number of results as long
See Also:
BigInteger

total

public java.math.BigInteger total()
Return total number of results as BigInteger (cloned)

Returns:
Total number of results
See Also:
BigInteger

rewind

public abstract void rewind()
Rewind, start over, reset, recycle. To be implements by the real workers.


hasMore

public abstract boolean hasMore()
Check if there are more results available to be read. To be implements by the real workers.


next

public abstract int[] next()
Return next result and update internal counter. To be implements by the real workers.


nextAndStep

public int[] nextAndStep(int step)
Return result and step foreward for given amount of steps (that is: skip results)

Parameters:
step - How many steps to go forward after returning the result
Returns:
Current result, an array of indices, see comment at constructor in class Combination


processing library Combinatorics by Florian Jenett. (c) 2010-2011