Represents one match in a session.
More...
Inherits IComparable< Match >.
|
| Match (IPlayer player1, IPlayer player2) |
| Create a new match. More...
|
|
override string | ToString () |
| A string representation of this match. More...
|
|
int | CompareTo (Match other) |
| Compares this match with another match. Comparisons are made using an internal ID, except if the players are the same and in the same order, in which case matches are considered equal, even if they have different internal IDs. More...
|
|
override int | GetHashCode () |
| Returns a hash code for this match. More...
|
|
override bool | Equals (object obj) |
| Is the current match equal to the given object? Equality is verified if obj is a Match object, and if it contains the same players in the same positions. More...
|
|
Represents one match in a session.
Definition at line 13 of file Match.cs.
◆ Match()
Create a new match.
- Parameters
-
player1 | First player in match (white). |
player2 | Second player in match (red). |
Definition at line 45 of file Match.cs.
◆ CompareTo()
int CompareTo |
( |
Match |
other | ) |
|
Compares this match with another match. Comparisons are made using an internal ID, except if the players are the same and in the same order, in which case matches are considered equal, even if they have different internal IDs.
- Parameters
-
other | The match to compare the current match with. |
- Returns
- Zero if players are the same and are in the same order.
- Negative value if current match was created before match given in other .
- Positive value if current match was created after match given in other .
◆ Equals()
override bool Equals |
( |
object |
obj | ) |
|
|
inline |
Is the current match equal to the given object? Equality is verified if obj is a Match object, and if it contains the same players in the same positions.
- Parameters
-
obj | Object to check for equality with this match. |
- Returns
true
if this match is equal to obj , false
otherwise.
Definition at line 91 of file Match.cs.
◆ GetHashCode()
override int GetHashCode |
( |
| ) |
|
Returns a hash code for this match.
- Returns
- Hash code obtain from the string concatenation of the player's names.
◆ ToString()
override string ToString |
( |
| ) |
|
A string representation of this match.
- Returns
- A string representation of this match.
◆ player1
First player in this match (white).
Definition at line 22 of file Match.cs.
◆ player2
Second player in this match (ref).
Definition at line 25 of file Match.cs.
◆ Swapped
A match with the players swapped.
A new match instance.
Definition at line 40 of file Match.cs.
◆ this[PColor color]
Initial value:
: throw new InvalidOperationException(
$"Invalid player color")
Indexer for getting a player based on his color.
- Parameters
-
- Returns
- The player associated with the given color.
- Exceptions
-
System.InvalidOperationException | Thrown when an invalid color is given. |
Definition at line 33 of file Match.cs.
The documentation for this struct was generated from the following file: