Java 11 migrate remaining p (#1122)
* Moves partial-response to Java 11 * Moves pipeline to Java 11 * Moves poison-pill to Java 11 * Moves priority-queue to Java 11 * Moves private-class-data to Java 11 * Moves producer-consumer to Java 11 * Moves promise to Java 11 * Moves property to Java 11 * Moves prototype to Java 11 * Moves proxy to Java 11 * Corrects checkstyle errors * Fixes build for pipeline pattern
This commit is contained in:
committed by
Ilkka Seppälä
parent
1401accb4f
commit
428efc7d53
@@ -49,36 +49,36 @@ public class App {
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
/* set up */
|
||||
Prototype charProto = new Character();
|
||||
var charProto = new Character();
|
||||
charProto.set(Stats.STRENGTH, 10);
|
||||
charProto.set(Stats.AGILITY, 10);
|
||||
charProto.set(Stats.ARMOR, 10);
|
||||
charProto.set(Stats.ATTACK_POWER, 10);
|
||||
|
||||
Character mageProto = new Character(Type.MAGE, charProto);
|
||||
var mageProto = new Character(Type.MAGE, charProto);
|
||||
mageProto.set(Stats.INTELLECT, 15);
|
||||
mageProto.set(Stats.SPIRIT, 10);
|
||||
|
||||
Character warProto = new Character(Type.WARRIOR, charProto);
|
||||
var warProto = new Character(Type.WARRIOR, charProto);
|
||||
warProto.set(Stats.RAGE, 15);
|
||||
warProto.set(Stats.ARMOR, 15); // boost default armor for warrior
|
||||
|
||||
Character rogueProto = new Character(Type.ROGUE, charProto);
|
||||
var rogueProto = new Character(Type.ROGUE, charProto);
|
||||
rogueProto.set(Stats.ENERGY, 15);
|
||||
rogueProto.set(Stats.AGILITY, 15); // boost default agility for rogue
|
||||
|
||||
/* usage */
|
||||
Character mag = new Character("Player_1", mageProto);
|
||||
var mag = new Character("Player_1", mageProto);
|
||||
mag.set(Stats.ARMOR, 8);
|
||||
LOGGER.info(mag.toString());
|
||||
|
||||
Character warrior = new Character("Player_2", warProto);
|
||||
var warrior = new Character("Player_2", warProto);
|
||||
LOGGER.info(warrior.toString());
|
||||
|
||||
Character rogue = new Character("Player_3", rogueProto);
|
||||
var rogue = new Character("Player_3", rogueProto);
|
||||
LOGGER.info(rogue.toString());
|
||||
|
||||
Character rogueDouble = new Character("Player_4", rogue);
|
||||
var rogueDouble = new Character("Player_4", rogue);
|
||||
rogueDouble.set(Stats.ATTACK_POWER, 12);
|
||||
LOGGER.info(rogueDouble.toString());
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class Character implements Prototype {
|
||||
|
||||
@Override
|
||||
public Integer get(Stats stat) {
|
||||
boolean containsValue = properties.containsKey(stat);
|
||||
var containsValue = properties.containsKey(stat);
|
||||
if (containsValue) {
|
||||
return properties.get(stat);
|
||||
} else {
|
||||
@@ -118,7 +118,7 @@ public class Character implements Prototype {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
var builder = new StringBuilder();
|
||||
if (name != null) {
|
||||
builder.append("Player: ").append(name).append('\n');
|
||||
}
|
||||
@@ -128,8 +128,8 @@ public class Character implements Prototype {
|
||||
}
|
||||
|
||||
builder.append("Stats:\n");
|
||||
for (Stats stat : Stats.values()) {
|
||||
Integer value = this.get(stat);
|
||||
for (var stat : Stats.values()) {
|
||||
var value = this.get(stat);
|
||||
if (value == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user