Package de.Keyle.MyPet.api.gui
Record Class SoundSpec.Choice
java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.gui.SoundSpec.Choice
- Record Components:
options- the specs to choose between; must not be empty
- All Implemented Interfaces:
SoundSpec
- Enclosing interface:
SoundSpec
Picks uniformly among other specs on each play.
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.Keyle.MyPet.api.gui.SoundSpec
SoundSpec.Choice, SoundSpec.Fixed, SoundSpec.Range, SoundSpec.Silent -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.options()Returns the value of theoptionsrecord component.@Nullable Soundresolve(RandomGenerator random) Resolves this spec into a playable sound.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Choice
Rejects an empty option list and defensively copies the rest.
-
-
Method Details
-
resolve
Description copied from interface:SoundSpecResolves this spec into a playable sound.- Specified by:
resolvein interfaceSoundSpec- Parameters:
random- generator used to pick an option and sample any ranges- Returns:
- the sound to play, or
nullforSoundSpec.Silent
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
options
Returns the value of theoptionsrecord component.- Returns:
- the value of the
optionsrecord component
-