public final class

TurnBasedMatchEntity

extends Object
implements SafeParcelable TurnBasedMatch
java.lang.Object
   ↳ com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatchEntity

Class Overview

Data object representing the data for a turn-based match. This is immutable, and therefore safe to cache or store. Note, however, that the data it represents may grow stale.

This class exists solely to support parceling these objects and should not be used directly.

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
From interface com.google.android.gms.common.internal.safeparcel.SafeParcelable
From interface com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch
Fields
public static final TurnBasedMatchEntityCreator CREATOR
[Expand]
Inherited Fields
From interface com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch
Public Methods
boolean canRematch()
Return whether or not this match can be rematched.
int describeContents()
boolean equals(Object obj)
TurnBasedMatch freeze()
Freeze a volatile representation into an immutable representation.
Bundle getAutoMatchCriteria()
Retrieves the automatch criteria used to create or join this match, if any.
int getAvailableAutoMatchSlots()
Return the maximum number of available automatch slots for this match.
long getCreationTimestamp()
String getCreatorId()
byte[] getData()
Return the current (game-specific) data for this match.
String getDescription()
void getDescription(CharArrayBuffer dataOut)
Loads the match description into the given CharArrayBuffer.
Participant getDescriptionParticipant()
Get the participant representing the primary opponent in the match.
String getDescriptionParticipantId()
Get the ID of another participant in the match that can be used when describing the participants the user is playing with.
Game getGame()
long getLastUpdatedTimestamp()
Return the timestamp at which the match was last modified.
String getLastUpdaterId()
Return the ID of the participant who updated the match most recently.
String getMatchId()
int getMatchNumber()
Return the match sequence number for this match.
Participant getParticipant(String participantId)
Get a participant in a match by its ID.
String getParticipantId(String playerId)
Get the participant ID for a given player.
ArrayList<String> getParticipantIds()
Get the IDs of the participants of the given match.
int getParticipantStatus(String participantId)
Get the status of a participant in a match.
ArrayList<Participant> getParticipants()
Retrieve the Participants for this object.
String getPendingParticipantId()
Return the ID of the participant that is considered pending.
byte[] getPreviousMatchData()
Return the match data from the previous match, if available.
String getRematchId()
Return the match ID of the rematch that was created from this match, if any.
int getStatus()
int getTurnStatus()
int getVariant()
int getVersion()
Return the current version of the match.
int hashCode()
boolean isDataValid()
Check to see if this object is valid for use.
boolean isLocallyModified()
Return whether or not this match has been locally modified.
String toString()
void writeToParcel(Parcel out, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable
From interface com.google.android.gms.common.data.Freezable
From interface com.google.android.gms.games.multiplayer.Participatable
From interface com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch

Fields

public static final TurnBasedMatchEntityCreator CREATOR

Public Methods

public boolean canRematch ()

Return whether or not this match can be rematched. This will return true when the match has complete and has not already been rematched.

Returns
  • Whether or not this match can be rematched.

public int describeContents ()

public boolean equals (Object obj)

public TurnBasedMatch freeze ()

Freeze a volatile representation into an immutable representation. Objects returned from this call are safe to cache.

Note that the output of freeze may not be identical to the parent object, but should be equal. In other words:

 
 Freezable f1 = new Freezable();
 Freezable f2 = f1.freeze();
 f1 == f2 may not be true.
 f1.equals(f2) will be true.
 
 

Returns
  • A concrete implementation of the data object.

public Bundle getAutoMatchCriteria ()

Retrieves the automatch criteria used to create or join this match, if any. May be null if the match has no automatch properties.

Returns
  • A bundle containing the automatch criteria for this match.

public int getAvailableAutoMatchSlots ()

Return the maximum number of available automatch slots for this match. If automatch criteria were not specified during match creation, or if all slots have been filled, this will return 0.

Returns
  • The maximum number of additional players that can be added to this match.

public long getCreationTimestamp ()

public String getCreatorId ()

public byte[] getData ()

Return the current (game-specific) data for this match.

Returns
  • Byte array representing the current (game-specific) match state data.

public String getDescription ()

public void getDescription (CharArrayBuffer dataOut)

Loads the match description into the given CharArrayBuffer.

Parameters
dataOut The buffer to load the data into.

public Participant getDescriptionParticipant ()

Get the participant representing the primary opponent in the match.

Note that this will return null if there is no primary opponent. This could happen if an automatch slot has not been filled.

Returns
  • The participant representing the primary opponent in the match.

public String getDescriptionParticipantId ()

Get the ID of another participant in the match that can be used when describing the participants the user is playing with. For example, in a four player match this might be used to state "Martha (and 2 others)".

Note that this will return null if there is no primary opponent. This could happen if an automatch slot has not been filled.

Returns
  • The participant ID of the primary opponent in the match.

public Game getGame ()

public long getLastUpdatedTimestamp ()

Return the timestamp at which the match was last modified.

Returns
  • The server timestamp at which the match was last modified.

public String getLastUpdaterId ()

Return the ID of the participant who updated the match most recently.

Returns
  • The ID of the last participant who updated this Match object.

public String getMatchId ()

public int getMatchNumber ()

Return the match sequence number for this match. This number starts at 1, and increases every time a rematch is created.

Returns
  • The match sequence number for this match.

public Participant getParticipant (String participantId)

Get a participant in a match by its ID. Note that the participant ID must correspond to a participant in this match, or this method will throw an exception.

Parameters
participantId Match-local ID of the participant to retrieve status for.
Returns
  • The participant corresponding to the given ID.

public String getParticipantId (String playerId)

Get the participant ID for a given player. This will only return a non-null ID if the player is actually a participant in the match and that player's identity is visible to the current player. Note that this will always return non-null for the current player.

To find the player ID for the current player, use getCurrentPlayerId(GoogleApiClient).

Parameters
playerId Player ID to find participant ID for.
Returns
  • The participant ID corresponding to given player, or null if none found.

public ArrayList<String> getParticipantIds ()

Get the IDs of the participants of the given match.

Returns
  • The IDs of the participants in this match. These are returned in the participant order of the match. Note that these are not stable across matches.

public int getParticipantStatus (String participantId)

Get the status of a participant in a match. Note that the participant ID must correspond to a participant in this match, or this method will throw an exception.

Parameters
participantId Match-local ID of the participant to retrieve status for.
Returns

public ArrayList<Participant> getParticipants ()

Retrieve the Participants for this object. This is a list of all Participants applicable to the given object.

Returns

public String getPendingParticipantId ()

Return the ID of the participant that is considered pending. If no participant is considered pending (ie, the match is over, etc), this function will return null.

Returns
  • The ID of the participant that is considered pending, if any. Returns null if no participant is pending.

public byte[] getPreviousMatchData ()

Return the match data from the previous match, if available. Note that this is only provided on the first turn of a rematched match.

Returns
  • Byte array of data from the previous match of a rematch, or null if not available.

public String getRematchId ()

Return the match ID of the rematch that was created from this match, if any. This will only be non-null if a rematch has been created.

Returns
  • The match ID of the rematch, or null if no rematch exists.

public int getStatus ()

public int getTurnStatus ()

public int getVariant ()

public int getVersion ()

Return the current version of the match.

Returns
  • The current version of the match.

public int hashCode ()

public boolean isDataValid ()

Check to see if this object is valid for use. If the object is still volatile, this method will indicate whether or not the object can be safely used. The output of a call to freeze() will always be valid.

Returns
  • whether or not the object is valid for use.

public boolean isLocallyModified ()

Return whether or not this match has been locally modified. If this is true, the local device has match state which has not successfully synced to the server yet. In this state, further mutations to the match will fail with a status of STATUS_MATCH_ERROR_LOCALLY_MODIFIED.

Returns
  • Whether this match has local modifications or not.

public String toString ()

public void writeToParcel (Parcel out, int flags)