EDCE checker fixes
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package ru.trader.edce;
|
||||
|
||||
import ru.trader.edce.entities.Commodity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -112,8 +114,12 @@ public class Converter {
|
||||
|
||||
}
|
||||
|
||||
public static String getItemId(long edId){
|
||||
return ITEM_ID.get(edId);
|
||||
public static String getItemId(Commodity commodity){
|
||||
String id = ITEM_ID.get(commodity.getId());
|
||||
if (id == null){
|
||||
id = commodity.getName().toLowerCase().replace(" ","_");
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public static String getGroupId(String edName){
|
||||
|
||||
@@ -115,7 +115,7 @@ public class EDSession {
|
||||
}
|
||||
|
||||
public void readProfile(Consumer<String> contentConsumer){
|
||||
LOG.info("Submit profile request to {}", COMPANION_DOMAIN);
|
||||
LOG.debug("Submit profile request to {}", COMPANION_DOMAIN);
|
||||
HttpUriRequest submitRequest = RequestBuilder.get(PROFILE_URL).build();
|
||||
EDResponseHandler handler = new EDResponseHandler(content -> {
|
||||
if (lastStatus != ED_SESSION_STATUS.OK){
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.trader.edce.entities;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Cargo {
|
||||
private int capacity;
|
||||
private int qty;
|
||||
@@ -19,4 +21,18 @@ public class Cargo {
|
||||
public void setQty(int qty) {
|
||||
this.qty = qty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Cargo cargo = (Cargo) o;
|
||||
return Objects.equals(capacity, cargo.capacity) &&
|
||||
Objects.equals(qty, cargo.qty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(capacity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.trader.edce.entities;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Commander {
|
||||
private String name;
|
||||
private long credits;
|
||||
@@ -29,4 +31,18 @@ public class Commander {
|
||||
this.docked = docked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Commander commander = (Commander) o;
|
||||
return Objects.equals(credits, commander.credits) &&
|
||||
Objects.equals(docked, commander.docked) &&
|
||||
Objects.equals(name, commander.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(credits, docked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ru.trader.edce.entities;
|
||||
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Commodity {
|
||||
private long id;
|
||||
private String name;
|
||||
@@ -83,4 +85,30 @@ public class Commodity {
|
||||
public void setCategoryname(String categoryname) {
|
||||
this.categoryname = categoryname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Commodity commodity = (Commodity) o;
|
||||
return Objects.equals(id, commodity.id) &&
|
||||
Objects.equals(buyPrice, commodity.buyPrice) &&
|
||||
Objects.equals(sellPrice, commodity.sellPrice) &&
|
||||
Objects.equals(stock, commodity.stock) &&
|
||||
Objects.equals(demand, commodity.demand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Commodity{" +
|
||||
"id:" + id +
|
||||
", name:'" + name + '\'' +
|
||||
", group:'" + categoryname + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.trader.edce.entities;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class EDPacket {
|
||||
private Commander commander;
|
||||
private System lastSystem;
|
||||
@@ -37,4 +39,20 @@ public class EDPacket {
|
||||
public void setShip(Ship ship) {
|
||||
this.ship = ship;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
EDPacket edPacket = (EDPacket) o;
|
||||
return Objects.equals(commander, edPacket.commander) &&
|
||||
Objects.equals(lastSystem, edPacket.lastSystem) &&
|
||||
Objects.equals(lastStarport, edPacket.lastStarport) &&
|
||||
Objects.equals(ship, edPacket.ship);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(commander, lastSystem, lastStarport, ship);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.trader.edce.entities;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Fuel {
|
||||
private double capacity;
|
||||
private double lvl;
|
||||
@@ -19,4 +21,18 @@ public class Fuel {
|
||||
public void setLvl(double lvl) {
|
||||
this.lvl = lvl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Fuel fuel = (Fuel) o;
|
||||
return Objects.equals(capacity, fuel.capacity) &&
|
||||
Objects.equals(lvl, fuel.lvl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(capacity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.trader.edce.entities;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Module {
|
||||
private long id;
|
||||
private String category;
|
||||
@@ -37,4 +39,18 @@ public class Module {
|
||||
public void setCost(long cost) {
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Module module = (Module) o;
|
||||
return Objects.equals(id, module.id) &&
|
||||
Objects.equals(cost, module.cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Ship {
|
||||
private String name;
|
||||
@@ -70,4 +71,19 @@ public class Ship {
|
||||
return fsd != null ? fsd.getModule() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Ship ship = (Ship) o;
|
||||
return Objects.equals(name, ship.name) &&
|
||||
Objects.equals(fuel, ship.fuel) &&
|
||||
Objects.equals(cargo, ship.cargo) &&
|
||||
Objects.equals(modules, ship.modules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.trader.edce.entities;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Slot {
|
||||
private Module module;
|
||||
|
||||
@@ -10,4 +12,17 @@ public class Slot {
|
||||
public void setModule(Module module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Slot slot = (Slot) o;
|
||||
return Objects.equals(module, slot.module);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(module);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package ru.trader.edce.entities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class Starport {
|
||||
private long id;
|
||||
@@ -51,4 +48,18 @@ public class Starport {
|
||||
public void setModules(Map<String, Module> modules) {
|
||||
this.modules = modules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Starport starport = (Starport) o;
|
||||
return Objects.equals(id, starport.id) &&
|
||||
Objects.equals(commodities, starport.commodities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.trader.edce.entities;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class System {
|
||||
private long id;
|
||||
private String name;
|
||||
@@ -28,4 +30,17 @@ public class System {
|
||||
public void setFaction(String faction) {
|
||||
this.faction = faction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
System system = (System) o;
|
||||
return Objects.equals(id, system.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user