Record Class GameEvent.RowsCleared
java.lang.Object
java.lang.Record
edu.uw.tcss.model.GameEvent.RowsCleared
- Record Components:
count- the number of rows that were cleared (1-4 typically)timestamp- when the event was created (milliseconds since epoch)
- All Implemented Interfaces:
GameEvent
- Enclosing interface:
GameEvent
public static record GameEvent.RowsCleared(int count, long timestamp)
extends Record
implements GameEvent
Event fired when one or more lines clear from the frozen blocks.
This occurs when the current movable piece freezes into place and
completes one or more full rows.
This event provides type-safe access to the number of rows that were cleared in a single action. When fired, this event is associated with property name "RowsCleared".
Usage Example:
game.addPropertyChangeListener(evt -> {
if (evt.getNewValue() instanceof GameEvent.RowsCleared e) {
System.out.println(e.count() + " rows cleared!");
updateScore(e.count());
playAnimation(e.count());
}
});
- 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
ConstructorsConstructorDescriptionRowsCleared(int count, long timestamp) Creates an instance of aRowsClearedrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcount()Returns the value of thecountrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longReturns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface GameEvent
getPropertyName
-
Constructor Details
-
RowsCleared
-
-
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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
count
-
timestamp
-