Skip to content
Snippets Groups Projects
Commit 75c96674 authored by Peter Alexander's avatar Peter Alexander
Browse files

Removing file added in error

parent cd0644e5
No related branches found
No related tags found
No related merge requests found
package ac.ed.lurg.country;
import ac.ed.lurg.ModelConfig;
public class GlobalPrice {
double exportPrice;
double importAmount;
double exportAmount;
public GlobalPrice(double exportPrice, double importAmount, double exportAmount) {
this.exportPrice = exportPrice;
this.importAmount = importAmount;
this.exportAmount = exportAmount;
}
public static GlobalPrice createInitial(double exportPrice) {
return new GlobalPrice(exportPrice, Double.NaN, Double.NaN);
}
public double getExportPrice() {
return exportPrice;
}
public double getCountryImportPrice(double countryTradeBarrier) {
double importPrice = exportPrice * (1.0 + countryTradeBarrier*ModelConfig.TRADE_BARRIER_ADJ) / (1.0 - ModelConfig.TRANSPORT_LOSSES);
return importPrice;
}
public double getImportAmount() {
return importAmount;
}
public double getExportAmount() {
return exportAmount;
}
public GlobalPrice createWithUpdatedMarketPrices(double imports, double exports, boolean adjustPrice) {
if (imports > 0 || exports > 0) {
double ratio;
if (imports > exports)
ratio = (imports-exports)/imports;
else
ratio = (imports-exports)/exports;
double adjustment = adjustPrice ? Math.exp(ratio * ModelConfig.MARKET_LAMBA) : 1.0;
return new GlobalPrice(exportPrice * adjustment, imports, exports);
}
else {
return this;
}
}
@Override
public String toString() {
return String.format("export=%.3f", exportPrice);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment