Refactored out duplicate resource type.

This commit is contained in:
2024-03-14 14:47:20 -04:00
parent b6eb587a82
commit 4646d03bdd
10 changed files with 96 additions and 157 deletions
+5 -4
View File
@@ -9,6 +9,7 @@
package engine.objects;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.Enum.TransactionType;
import org.joda.time.DateTime;
@@ -22,7 +23,7 @@ public class Transaction implements Comparable<Transaction> {
private final int warehouseUUID;
private final int targetUUID;
private final Resource resource;
private final Enum.ResourceType resource;
private final DateTime date;
private final int amount;
private final TransactionType transactionType;
@@ -34,7 +35,7 @@ public class Transaction implements Comparable<Transaction> {
this.targetUUID = rs.getInt("targetUID");
this.targetType = GameObjectType.valueOf(rs.getString("targetType"));
this.transactionType = TransactionType.valueOf(rs.getString("type").toUpperCase());
this.resource = Resource.valueOf(rs.getString("resource").toUpperCase());
this.resource = Enum.ResourceType.valueOf(rs.getString("resource").toUpperCase());
this.amount = rs.getInt("amount");
Date sqlDateTime = rs.getTimestamp("date");
@@ -47,7 +48,7 @@ public class Transaction implements Comparable<Transaction> {
}
public Transaction(int warehouseUUID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount,
public Transaction(int warehouseUUID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Enum.ResourceType resource, int amount,
DateTime date) {
this.warehouseUUID = warehouseUUID;
this.targetUUID = targetUUID;
@@ -69,7 +70,7 @@ public class Transaction implements Comparable<Transaction> {
}
public Resource getResource() {
public Enum.ResourceType getResource() {
return resource;
}