Record Class GameEvent.NextPieceChanged
java.lang.Object
java.lang.Record
edu.uw.tcss.model.GameEvent.NextPieceChanged
- Record Components:
piece- the next movable piecetimestamp- when the event was created (milliseconds since epoch)
- All Implemented Interfaces:
GameEvent
- Enclosing interface:
GameEvent
public static record GameEvent.NextPieceChanged(GameControls.IndividualPiece piece, long timestamp)
extends Record
implements GameEvent
Event fired when the next movable piece changes.
This occurs when the current movable piece freezes into place and
a new next piece is selected.
This event provides type-safe access to the next piece that will become active. When fired, this event is associated with property name "NextPieceChanged".
Usage Example:
game.addPropertyChangeListener(evt -> {
if (evt.getNewValue() instanceof GameEvent.NextPieceChanged e) {
updateNextPiecePreview(e.piece());
}
});
- Version:
- Winter 2025
- Author:
- Charles Bryan
-
Nested Class Summary
Nested classes/interfaces inherited from interface GameEvent
GameEvent.CurrentPieceChanged, GameEvent.FrozenBlocksChanged, GameEvent.GameStateChanged, GameEvent.NextPieceChanged, GameEvent.RowsCleared -
Constructor Summary
ConstructorsConstructorDescriptionNextPieceChanged(GameControls.IndividualPiece piece, long timestamp) Creates an instance of aNextPieceChangedrecord class. -
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.piece()Returns the value of thepiecerecord component.longReturns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface GameEvent
getPropertyName
-
Constructor Details
-
Method Details
-
toString
-
hashCode
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
piece
-
timestamp
-