Updated d. Converting your code to the generalized format (markdown)

Jeroen De Meerleer 2019-06-03 11:58:22 +02:00
parent 2a4fb49a18
commit 012ae27ebf

@ -1,4 +1,4 @@
Currently the project is in the phase of transforming from pairtwo-only to a generalized view for multiple programs. Before the 1.0 release the project was in the phase of transforming from pairtwo-only to a generalized view for multiple programs.
This makes it relatively easy to add other filetypes. However, this process requires rewriting and renaming some functions. This document is dedicated to these adjustments. This makes it relatively easy to add other filetypes. However, this process requires rewriting and renaming some functions. This document is dedicated to these adjustments.
## `Sws::readSws` renamed to `ReaderInterface::read` `Master` ## `Sws::readSws` renamed to `ReaderInterface::read` `Master`
@ -22,24 +22,22 @@ $sws = $reader->read('<filename>');
## Getting a ranking `Develop` ## Getting a ranking `Develop`
With the generalization, work has been put in fixing the tiebreaks. This also includes that the `Tournament::GetRanking()` method has changed. Most important is that it does not have a parameter for american sort anymore. With the generalization, work has been put in fixing the tiebreaks. This also includes that the `Tournament::GetRanking()` method has changed. Most important is that it does not have a parameter for american sort anymore.
When you try to get a ranking and want to display a certain tiebreak, all you need to do is to call the `Player::GetTiebreaks()` function. This will return an array of applied tiebreaks. If a tiebreak was not needed, it does not get calculated and will not exist in the array. When you try to get a ranking and want to display a certain tiebreak, all you need to do is to call the `Player::GetTiebreaks()` function. This will return an array of applied tiebreaks. Every tiebreak which was set as tiebreak to the tournament gets calculated. This means that if a tiebreak was not needed anymore of the calculation of the ranking, it does not get calculated anymore.
Currently not all and enough tiebreaks are implemented. Therefore this change is currently only available in `Develop`
## Changed getters and setters `Develop` ## Changed getters and setters `Develop`
### Getters ### Getters
| Property | Old code | New Code (getter) | Current Status | | Property | Old code | New Code (getter) | Current Status |
|------------------------------|-------------------------------------------------|------------------------------------------|----------------| |------------------------------|-------------------------------------------------|------------------------------------------|----------------|
| Player::Absent | `Player::getAbsent()` | `Player::getBinaryData('Absent')` | Consideration | | Player::Absent | `Player::getAbsent()` | `Player::getBinaryData('Absent')` | Final |
| Player::Club | `Player::getClub()` | `Player::getId('club')` | Final | | Player::Club | `Player::getClub()` | `Player::getId('Club')` | Final |
| Player::ExtraPts | `Player::getExtraPts()` | `Player::getBinaryData('XtraPts')` | Final | | Player::ExtraPts | `Player::getExtraPts()` | `Player::getBinaryData('XtraPts')` | Final |
| Player::FideElo | `Player::getFideElo()` | `Player::getElo('world')` | Final | | Player::FideElo | `Player::getFideElo()` | `Player::getElo('Fide')` | Final |
| Player::FideId | `Player::getFideId()` | `Player::getId('world')` | Final | | Player::FideId | `Player::getFideId()` | `Player::getId('Fide')` | Final |
| Player::KbsbElo | `Player::getKbsbElo()` | `Player::getElo('home')` | Final | | Player::KbsbElo | `Player::getKbsbElo()` | `Player::getElo('Nation')` | Final |
| Player::KbsbId | `Player::getKbsbId()` | `Player::getId('home')` | Final | | Player::KbsbId | `Player::getKbsbId()` | `Player::getId('Nation')` | Final |
| Player::NumberOfTies | `Player::getNumberofTies()` | `Player::getBinaryData('NumberOfTies')` | Final | | Player::NumberOfTies | `Player::getNumberofTies()` | `Player::getBinaryData('NumberOfTies')` | Final |
| Player::Points | `Player::getPoints()` | `Player::getBinaryData('Points')` | Final | | Player::Points | `Player::getPoints()` | `Player::getBinaryData('Points')`* | Final |
| Player::Rank | `Player::getRank()` | `Player::getBinaryData('Rank')` | Final | | Player::Rank | `Player::getRank()` | `Player::getBinaryData('Rank')` | Final |
| Player::ScoreAmerican | `Player::getScoreAmerican()` | `Player::getBinaryData('ScoreAmerican')` | Final | | Player::ScoreAmerican | `Player::getScoreAmerican()` | `Player::getBinaryData('ScoreAmerican')` | Final |
| Player::ScoreBucholtz | `Player::getScoreBucholtz()` | `Player::getBinaryData('ScoreBuchholz')` | Final | | Player::ScoreBucholtz | `Player::getScoreBucholtz()` | `Player::getBinaryData('ScoreBuchholz')` | Final |
@ -54,17 +52,19 @@ Currently not all and enough tiebreaks are implemented. Therefore this change is
| Sws::Players($i)_Namepos | `Sws::getBinaryData('Players($i)_Namepos')` | `Player::getBinaryData('NamePos')` | Final | | Sws::Players($i)_Namepos | `Sws::getBinaryData('Players($i)_Namepos')` | `Player::getBinaryData('NamePos')` | Final |
| Sws::Players($i)_TieMatch | `Sws::getBinaryData('Players($i)_TieMatch')` | `Player::getBinaryData('Tiematch')` | Final | | Sws::Players($i)_TieMatch | `Sws::getBinaryData('Players($i)_TieMatch')` | `Player::getBinaryData('Tiematch')` | Final |
*: Old method still exists, but has a different implementation that should return the same value
### Setters ### Setters
| Property | Old code | New Code (setter) | Current Status | | Property | Old code | New Code (setter) | Current Status |
|------------------------------|-----------------------------------------------------------------|--------------------------------------------------|----------------| |------------------------------|-----------------------------------------------------------------|--------------------------------------------------|----------------|
| Player::Absent | `Player::setAbsent($value)` | `Player::setBinaryData('Absent', $value)` | Consideration | | Player::Absent | `Player::setAbsent($value)` | `Player::setBinaryData('Absent', $value)` | Final |
| Player::Club | `Player::setClub($value)` | `Player::setId('club', $value)` | Final | | Player::Club | `Player::setClub($value)` | `Player::setId('Club', $value)` | Final |
| Player::ExtraPts | `Player::setExtraPts($value)` | `Player::setBinaryData('XtraPts', $value)` | Final | | Player::ExtraPts | `Player::setExtraPts($value)` | `Player::setBinaryData('XtraPts', $value)` | Final |
| Player::FideElo | `Player::setFideElo($value)` | `Player::setElo('world', $value)` | Final | | Player::FideElo | `Player::setFideElo($value)` | `Player::setElo('Fide', $value)` | Final |
| Player::FideId | `Player::setFideId($value)` | `Player::setId('world', $value)` | Final | | Player::FideId | `Player::setFideId($value)` | `Player::setId('Fide', $value)` | Final |
| Player::KbsbElo | `Player::setKbsbElo($value)` | `Player::setElo('home', $value)` | Final | | Player::KbsbElo | `Player::setKbsbElo($value)` | `Player::setElo('Nation', $value)` | Final |
| Player::KbsbId | `Player::setKbsbId($value)` | `Player::setId('home', $value)` | Final | | Player::KbsbId | `Player::setKbsbId($value)` | `Player::setId('Nation', $value)` | Final |
| Player::NumberOfTies | `Player::setNumberofTies($value)` | `Player::setBinaryData('NumberOfTies', $value)` | Final | | Player::NumberOfTies | `Player::setNumberofTies($value)` | `Player::setBinaryData('NumberOfTies', $value)` | Final |
| Player::Points | `Player::setPoints($value)` | `Player::setBinaryData('Points', $value)` | Final | | Player::Points | `Player::setPoints($value)` | `Player::setBinaryData('Points', $value)` | Final |
| Player::Rank | `Player::setRank($value)` | `Player::setBinaryData('Rank', $value)` | Final | | Player::Rank | `Player::setRank($value)` | `Player::setBinaryData('Rank', $value)` | Final |