Record Class GameEvent.CurrentPieceChanged
java.lang.Object
java.lang.Record
edu.uw.tcss.model.GameEvent.CurrentPieceChanged
- Record Components:
piece- the current movable piece with updated statetimestamp- when the event was created (milliseconds since epoch)
- All Implemented Interfaces:
GameEvent
- Enclosing interface:
GameEvent
public static record GameEvent.CurrentPieceChanged(GameControls.IndividualPiece piece, long timestamp)
extends Record
implements GameEvent
Event fired when the current movable piece changes state.
This occurs when the current piece moves, rotates, or changes
after a freeze event.
This event provides type-safe access to the current piece's state including its position and block type. When fired, this event is associated with property name "CurrentPieceChanged".
Usage Example:
game.addPropertyChangeListener(evt -> {
if (evt.getNewValue() instanceof GameEvent.CurrentPieceChanged e) {
redrawBoard(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
ConstructorsConstructorDescriptionCurrentPieceChanged(GameControls.IndividualPiece piece, long timestamp) Creates an instance of aCurrentPieceChangedrecord 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
-