Package de.tilman_neumann.jml.partitions
Class IntegerPartition
java.lang.Object
java.util.AbstractMap<K,V>
java.util.TreeMap<T,java.lang.Integer>
de.tilman_neumann.util.SortedMultiset_BottomUp<java.lang.Integer>
de.tilman_neumann.jml.partitions.IntegerPartition
- All Implemented Interfaces:
Multiset<java.lang.Integer>
,SortedMultiset<java.lang.Integer>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<SortedMultiset<java.lang.Integer>>
,java.util.Map<java.lang.Integer,java.lang.Integer>
,java.util.NavigableMap<java.lang.Integer,java.lang.Integer>
,java.util.SortedMap<java.lang.Integer,java.lang.Integer>
public class IntegerPartition extends SortedMultiset_BottomUp<java.lang.Integer>
Integer partition, with nice String output.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,V extends java.lang.Object>
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K extends java.lang.Object,V extends java.lang.Object>
-
Constructor Summary
Constructors Constructor Description IntegerPartition(int[] elements)
Constructor from flat element array. -
Method Summary
Modifier and Type Method Description java.math.BigInteger
getNumberOfRealizations()
int
sum()
java.lang.String
toString()
Returns a sum-like representation of the additive multiset, with distinct keys separated by "+" and the multiplicity indicated by "*".Methods inherited from class de.tilman_neumann.util.SortedMultiset_BottomUp
add, add, addAll, addAll, addAll, compareTo, equals, getBiggestElement, getSmallestElement, getTopDownIterator, hashCode, intersect, remove, remove, removeAll, toList, toString, totalCount
Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, merge, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, putIfAbsent, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, values
Methods inherited from class java.util.AbstractMap
isEmpty
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, forEach, get, getOrDefault, isEmpty, merge, put, putAll, putIfAbsent, remove, replace, replace, replaceAll, size
Methods inherited from interface java.util.SortedMap
comparator, entrySet, firstKey, keySet, lastKey, values
-
Constructor Details
-
IntegerPartition
public IntegerPartition(int[] elements)Constructor from flat element array.- Parameters:
elements
-
-
-
Method Details
-
sum
public int sum()- Returns:
- the sum over all entries, taking into account their frequencies.
-
getNumberOfRealizations
public java.math.BigInteger getNumberOfRealizations()- Returns:
- The number of ways to realize this partition.
-
toString
public java.lang.String toString()Returns a sum-like representation of the additive multiset, with distinct keys separated by "+" and the multiplicity indicated by "*".
-