created static method buildSymbol
This commit is contained in:
parent
79fc3f303e
commit
c56ed5abcd
@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
package opensesim.world;
|
package opensesim.world;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import opensesim.world.AbstractAsset;
|
import opensesim.world.AbstractAsset;
|
||||||
|
|
||||||
|
|
||||||
@ -37,6 +38,10 @@ public class AssetPair {
|
|||||||
private final AbstractAsset asset;
|
private final AbstractAsset asset;
|
||||||
private final AbstractAsset currency;
|
private final AbstractAsset currency;
|
||||||
|
|
||||||
|
public static String buildSymbol(String currency,String asset){
|
||||||
|
return currency+"/"+asset;
|
||||||
|
}
|
||||||
|
|
||||||
public AbstractAsset getAsset() {
|
public AbstractAsset getAsset() {
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
@ -46,7 +51,7 @@ public class AssetPair {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getSymbol() {
|
public String getSymbol() {
|
||||||
return asset.getSymbol() + "/" + currency.getSymbol();
|
return buildSymbol(asset.getSymbol(),currency.getSymbol());
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetPair(AbstractAsset asset, AbstractAsset currency) {
|
public AssetPair(AbstractAsset asset, AbstractAsset currency) {
|
||||||
@ -64,13 +69,21 @@ public class AssetPair {
|
|||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
|
|
||||||
AssetPair ap = (AssetPair)o;
|
AssetPair ap = (AssetPair)o;
|
||||||
if (ap.asset==asset && ap.currency==currency)
|
if (ap.asset==this.asset && ap.currency==this.currency)
|
||||||
return true;
|
return true;
|
||||||
// if (ap.asset==currency && ap.currency==asset)
|
// if (ap.asset==currency && ap.currency==asset)
|
||||||
// return false;
|
// return false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 5;
|
||||||
|
hash = 97 * hash + Objects.hashCode(this.asset);
|
||||||
|
hash = 97 * hash + Objects.hashCode(this.currency);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user