refactor: generated equals ... toString for configs
This commit is contained in:
parent
b8e13f295c
commit
429cdd2e42
@ -33,4 +33,18 @@ public class CharacterProperties {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(characterID, name, HP, MP, AP, meleeDamage, rangedDamage, attackRange);
|
return Objects.hash(characterID, name, HP, MP, AP, meleeDamage, rangedDamage, attackRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "CharacterProperties{" +
|
||||||
|
"characterID=" + characterID +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
", HP=" + HP +
|
||||||
|
", MP=" + MP +
|
||||||
|
", AP=" + AP +
|
||||||
|
", meleeDamage=" + meleeDamage +
|
||||||
|
", rangedDamage=" + rangedDamage +
|
||||||
|
", attackRange=" + attackRange +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package uulm.teamname.marvelous.gamelibrary.config;
|
package uulm.teamname.marvelous.gamelibrary.config;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* POJO describing the PartyConfig as defined by the standard document
|
* POJO describing the PartyConfig as defined by the standard document
|
||||||
*/
|
*/
|
||||||
@ -39,4 +41,35 @@ public class PartyConfig {
|
|||||||
|
|
||||||
/** Max pause time. Optional */
|
/** Max pause time. Optional */
|
||||||
public int maxPauseTime;
|
public int maxPauseTime;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
PartyConfig that = (PartyConfig) o;
|
||||||
|
return maxRounds == that.maxRounds && maxRoundTime == that.maxRoundTime && maxGameTime == that.maxGameTime && maxAnimationTime == that.maxAnimationTime && spaceStoneCD == that.spaceStoneCD && mindStoneCD == that.mindStoneCD && realityStoneCD == that.realityStoneCD && powerStoneCD == that.powerStoneCD && timeStoneCD == that.timeStoneCD && soulStoneCD == that.soulStoneCD && mindStoneDMG == that.mindStoneDMG && maxPauseTime == that.maxPauseTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(maxRounds, maxRoundTime, maxGameTime, maxAnimationTime, spaceStoneCD, mindStoneCD, realityStoneCD, powerStoneCD, timeStoneCD, soulStoneCD, mindStoneDMG, maxPauseTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "PartyConfig{" +
|
||||||
|
"maxRounds=" + maxRounds +
|
||||||
|
", maxRoundTime=" + maxRoundTime +
|
||||||
|
", maxGameTime=" + maxGameTime +
|
||||||
|
", maxAnimationTime=" + maxAnimationTime +
|
||||||
|
", spaceStoneCD=" + spaceStoneCD +
|
||||||
|
", mindStoneCD=" + mindStoneCD +
|
||||||
|
", realityStoneCD=" + realityStoneCD +
|
||||||
|
", powerStoneCD=" + powerStoneCD +
|
||||||
|
", timeStoneCD=" + timeStoneCD +
|
||||||
|
", soulStoneCD=" + soulStoneCD +
|
||||||
|
", mindStoneDMG=" + mindStoneDMG +
|
||||||
|
", maxPauseTime=" + maxPauseTime +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package uulm.teamname.marvelous.gamelibrary.config;
|
package uulm.teamname.marvelous.gamelibrary.config;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* POJO describing the ScenarioConfig as defined by the standard document
|
* POJO describing the ScenarioConfig as defined by the standard document
|
||||||
*/
|
*/
|
||||||
@ -12,4 +15,28 @@ public class ScenarioConfig {
|
|||||||
|
|
||||||
/** A string containing the name of the scenario configuration (so basically the map title) */
|
/** A string containing the name of the scenario configuration (so basically the map title) */
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
ScenarioConfig that = (ScenarioConfig) o;
|
||||||
|
return Arrays.deepEquals(scenario, that.scenario) && Objects.equals(author, that.author) && Objects.equals(name, that.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = Objects.hash(author, name);
|
||||||
|
result = 31 * result + Arrays.hashCode(scenario);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ScenarioConfig{" +
|
||||||
|
"scenario=" + Arrays.deepToString(scenario) +
|
||||||
|
", author='" + author + '\'' +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user