Package eu.simuline.util
Interface MultiSet.Multiplicity
-
- All Superinterfaces:
java.lang.Comparable<MultiSet.Multiplicity>
- All Known Implementing Classes:
AbstractMultiSet.MultiplicityImpl,CollectionsExt.ImmutableMultiplicity
public static interface MultiSet.Multiplicity extends java.lang.Comparable<MultiSet.Multiplicity>
Represents the multiplicity of an entry of the enclosing multi-set.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intadd(int mult)Adds the specified multiplicity (which may well be negative) to the wrapped multiplicity which is thus modified.intcompareTo(MultiSet.Multiplicity mult)Defines the natural ordering on natural numbers.booleanequals(java.lang.Object obj)intget()Returns the wrapped multiplicity.intset(int mult)Sets the multiplicity wrapped by this object to the specified value.
-
-
-
Method Detail
-
set
int set(int mult)
Sets the multiplicity wrapped by this object to the specified value.- Parameters:
mult- a strictly positiveintvalue representing the old multiplicity.- Throws:
java.lang.IllegalArgumentException- ifmultis not strictly positive.java.lang.UnsupportedOperationException- if setting the multiplicity would modify this Multiplicity object in a way which is not supported.
-
add
int add(int mult)
Adds the specified multiplicity (which may well be negative) to the wrapped multiplicity which is thus modified.- Parameters:
mult- anintsuch thatthis.mult + mult > 0holds.- Returns:
- the new multiplicity
this.mult + mult. - Throws:
java.lang.IllegalArgumentException- ifthis.mult + mult < 0holds.java.lang.IllegalStateException- ifthis.mult + mult == 0holds. This cannot occur: if it does this is a bug within this class.java.lang.UnsupportedOperationException- if setting the multiplicity would modify this Multiplicity object in a way which is not supported.
-
get
int get()
Returns the wrapped multiplicity.
-
compareTo
int compareTo(MultiSet.Multiplicity mult)
Defines the natural ordering on natural numbers.- Specified by:
compareToin interfacejava.lang.Comparable<MultiSet.Multiplicity>- Parameters:
mult- aMultiplicitywhich should in fact be anotherMultiSet.Multiplicity.- Returns:
- the difference of the wrapped multiplicities.
- Throws:
java.lang.NullPointerException- formult == null.java.lang.ClassCastException- ifmultis neithernullnor an instance ofMultiSet.Multiplicity.
-
equals
boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-