Class VariableAmount.Fixed
- java.lang.Object
-
- org.spongepowered.api.util.weighted.VariableAmount.Fixed
-
- All Implemented Interfaces:
DataSerializable,VariableAmount
- Enclosing interface:
- VariableAmount
public static class VariableAmount.Fixed extends java.lang.Object implements VariableAmount
Represents a fixed amount, calls toamountwill always return the same fixed value.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.util.weighted.VariableAmount
VariableAmount.BaseAndAddition, VariableAmount.BaseAndVariance, VariableAmount.Fixed, VariableAmount.OptionalAmount
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleamount(java.util.Random rand)Gets an instance of the variable amount depending on the given random object.intcontentVersion()Gets the content version of thisDataSerializable.booleanequals(java.lang.Object obj)inthashCode()DataContainertoContainer()Serializes this object into a comprehensibleDataContainer.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.spongepowered.api.util.weighted.VariableAmount
flooredAmount
-
-
-
-
Method Detail
-
amount
public double amount(java.util.Random rand)
Description copied from interface:VariableAmountGets an instance of the variable amount depending on the given random object.- Specified by:
amountin interfaceVariableAmount- Parameters:
rand- The random object- Returns:
- The amount
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toContainer
public DataContainer toContainer()
Description copied from interface:DataSerializableSerializes this object into a comprehensibleDataContainer.- Specified by:
toContainerin interfaceDataSerializable- Specified by:
toContainerin interfaceVariableAmount- Returns:
- A newly created DataContainer
-
contentVersion
public int contentVersion()
Description copied from interface:DataSerializableGets the content version of thisDataSerializable. The version may differ between instances of plugins and implementations such that theDataViewfromDataSerializable.toContainer()may include different information, or remove other information as they are no longer deemed necessary. The version goes hand in hand withDataContentUpdateras it is required when there exists anyDataViewof thisDataSerializablewith an "older" version.- Specified by:
contentVersionin interfaceDataSerializable- Specified by:
contentVersionin interfaceVariableAmount- Returns:
- The version of the content being serialized
-
-