Package cc.redberry.rings.poly.multivar
Class MonomialSet<Term extends AMonomial<Term>>
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Term>
,Map<DegreeVector,Term>
,NavigableMap<DegreeVector,Term>
,SortedMap<DegreeVector,Term>
public final class MonomialSet<Term extends AMonomial<Term>> extends TreeMap<DegreeVector,Term> implements Iterable<Term>, Cloneable
Sorted set of monomials -- basic underlying data structure of multivariate polynomials.
- Since:
- 1.0
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
Constructor Summary
Constructors Constructor Description MonomialSet(Comparator<? super DegreeVector> comparator)
MonomialSet(SortedMap<DegreeVector,? extends Term> m)
Constructs a new monomial set containing the same mappings and using the same ordering as the specified sorted map. -
Method Summary
Modifier and Type Method Description Term
add(Term term)
Add monomial to this setIterator<Term>
ascendingIterator()
MonomialSet<Term>
clone()
Collection<Term>
collection()
int[]
degrees()
default int
degreeSum()
Returns the sum ofdegrees()
Iterator<Term>
descendingIterator()
Term
first()
First monomial in this setint
hashCode()
Iterator<Term>
iterator()
Term
last()
Last monomial in this setdefault Term
lt()
int
size()
int
skeletonHashCode()
Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, 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, remove, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, values
Methods inherited from class java.util.AbstractMap
equals, isEmpty, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface java.util.Map
equals, getOrDefault, isEmpty, remove
-
Constructor Details
-
MonomialSet
-
MonomialSet
Constructs a new monomial set containing the same mappings and using the same ordering as the specified sorted map. This method runs in linear time.- Parameters:
m
- the sorted map whose mappings are to be placed in this monomial set, and whose comparator is to be used to sort this map
-
-
Method Details
-
iterator
-
add
Add monomial to this set- Parameters:
term
- monomial- Returns:
- this
-
first
First monomial in this set -
last
Last monomial in this set -
ascendingIterator
-
descendingIterator
-
collection
-
degrees
public int[] degrees() -
clone
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceMap<DegreeVector,Term extends AMonomial<Term>>
- Overrides:
hashCode
in classAbstractMap<DegreeVector,Term extends AMonomial<Term>>
-
skeletonHashCode
public int skeletonHashCode() -
lt
-
size
int size() -
degreeSum
default int degreeSum()Returns the sum ofdegrees()
- Returns:
- sum of
degrees()
-