public static final class AbstractMultiSet.MultiplicityImpl extends Object implements MultiSet.Multiplicity
mult.
Unlike ints we have real Objects
which can be stored in a map, e.g. AbstractMultiSet.obj2mult
and unlike Integers these objects are mutable.| Modifier and Type | Field and Description |
|---|---|
private int |
mult
A positive integer representing a multiplicity.
|
| Modifier | Constructor and Description |
|---|---|
private |
MultiplicityImpl(int mult)
Creates a new
Multiplicity instance
representing a positive multiplicity. |
| Modifier and Type | Method and Description |
|---|---|
int |
add(int mult)
Adds the specified multiplicity (which may well be negative)
to the wrapped multiplicity
mult which is thus modified. |
int |
compareTo(MultiSet.Multiplicity mult)
Defines the natural ordering on natural numbers.
|
protected static AbstractMultiSet.MultiplicityImpl |
create(int mult) |
boolean |
equals(Object obj)
Returns
true if and only if
obj is also an instance of Multiplicity>
and if the wrapped multiplicities coincide. |
int |
get()
Returns the wrapped multiplicity.
|
int |
hashCode() |
int |
set(int mult)
Sets the multiplicity wrapped by this object
to the specified value.
|
String |
toString() |
private MultiplicityImpl(int mult)
Multiplicity instance
representing a positive multiplicity.mult - a strictly positive int value
representing a multiplicity.IllegalArgumentException - if mult is not strictly positive.set(int)protected static AbstractMultiSet.MultiplicityImpl create(int mult)
public int set(int mult)
set in interface MultiSet.Multiplicitymult - a strictly positive int value
representing the old multiplicity.IllegalArgumentException - if mult is not strictly positive.public int add(int mult)
mult which is thus modified.add in interface MultiSet.Multiplicitymult - an int such that this.mult + mult > 0
holds.this.mult + mult.IllegalArgumentException - if this.mult + mult < 0 holds.IllegalStateException - if this.mult + mult == 0 holds.
This cannot occur: if it does this is a bug within this class.public int get()
get in interface MultiSet.Multiplicitymult.public int compareTo(MultiSet.Multiplicity mult)
compareTo in interface MultiSet.MultiplicitycompareTo in interface Comparable<MultiSet.Multiplicity>mult - a Multiplicity which should in fact
be another MultiSet.Multiplicity.mult-values.NullPointerException - for mult == null.ClassCastException - if mult is neither null
nor an instance of MultiSet.Multiplicity.public boolean equals(Object obj)
true if and only if
obj is also an instance of Multiplicity>
and if the wrapped multiplicities coincide.equals in interface MultiSet.Multiplicityequals in class Objectobj - an Object value
which may well be null.boolean value which indicates
whether obj is also an instance
of Multiplicity>
and whether the wrapped multiplicity coincides with this one.compareTo(eu.simuline.util.MultiSet.Multiplicity)Copyright © 2012–2018 Simuline Organization (l2r). All rights reserved.