程序员的量化交易之路(31)--cointrader之Balance现金(18)
2015-06-09 16:07
399 查看
转载须注明出处:http://blog.csdn.net/minimicall?viewmode=contents,htt://cloudtrade.top
Balance:现金。
代码:
package org.cryptocoinpartners.schema;
/**
* A Balance represents an amount of money in a given asset.
*现金代表了一个账号内的钱
*
*/
public final class Balance {
private final Asset asset;//Asset是任何可交易的有价值的东西,记得吗
private final String description;
private final Amount amount;//数量
/**
* Constructor
*
* @param asset The underlying asset
* @param amount The amount
*/
public Balance(Asset asset, Amount amount) {
this.asset = asset;
this.amount = amount;
this.description = "";
}
/**
* Additional constructor with optional description
*
* @param description Optional description to distinguish same asset Balances
*/
public Balance(Asset asset, Amount amount, String description) {
this.asset = asset;
this.amount = amount;
this.description = description;
}
public Asset getAsset() {
return asset;
}
public Amount getAmount() {
return amount;
}
public String getDescription() {
return description;
}
@Override
public String toString() {
return "Balance [asset=" + asset + ", amount=" + amount + ", description=" + description + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((amount == null) ? 0 : amount.hashCode());
result = prime * result + ((asset == null) ? 0 : asset.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Balance other = (Balance) obj;
if (amount == null) {
if (other.amount != null) {
return false;
}
} else if (!amount.equals(other.amount)) {
return false;
}
if (asset == null) {
if (other.asset != null) {
return false;
}
} else if (!asset.equals(other.asset)) {
return false;
}
if (description == null) {
if (other.description != null) {
return false;
}
} else if (!description.equals(other.description)) {
return false;
}
return true;
}
}
Balance:现金。
代码:
package org.cryptocoinpartners.schema;
/**
* A Balance represents an amount of money in a given asset.
*现金代表了一个账号内的钱
*
*/
public final class Balance {
private final Asset asset;//Asset是任何可交易的有价值的东西,记得吗
private final String description;
private final Amount amount;//数量
/**
* Constructor
*
* @param asset The underlying asset
* @param amount The amount
*/
public Balance(Asset asset, Amount amount) {
this.asset = asset;
this.amount = amount;
this.description = "";
}
/**
* Additional constructor with optional description
*
* @param description Optional description to distinguish same asset Balances
*/
public Balance(Asset asset, Amount amount, String description) {
this.asset = asset;
this.amount = amount;
this.description = description;
}
public Asset getAsset() {
return asset;
}
public Amount getAmount() {
return amount;
}
public String getDescription() {
return description;
}
@Override
public String toString() {
return "Balance [asset=" + asset + ", amount=" + amount + ", description=" + description + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((amount == null) ? 0 : amount.hashCode());
result = prime * result + ((asset == null) ? 0 : asset.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Balance other = (Balance) obj;
if (amount == null) {
if (other.amount != null) {
return false;
}
} else if (!amount.equals(other.amount)) {
return false;
}
if (asset == null) {
if (other.asset != null) {
return false;
}
} else if (!asset.equals(other.asset)) {
return false;
}
if (description == null) {
if (other.description != null) {
return false;
}
} else if (!description.equals(other.description)) {
return false;
}
return true;
}
}
相关文章推荐
- 负载均衡及会话保存(Ofbiz框架)
- haproxy负载均衡保持客户端和服务器Session亲缘性的三种方式:
- load balance (nat)
- haproxy配置
- Balanced Binary Tree
- AVL树的简单写法
- 程序员的量化交易之路(1)----规划开篇
- 程序员的量化交易之路(2)----Esper文档学习之技术概览(1)
- 程序员的量化交易之路(3)--Esper事件Event(2)
- 程序员的量化交易之路(4)--Esper之事件(3)
- 程序员的量化交易之路(6)-Esper之处理模型(5)
- 程序员的量化交易之路(7)--金融概念Positon
- 程序员的量化交易之路(8)---金融概念Listing&delisting
- 程序员的量化交易之路(9)--金融系统概念basis
- 程序员的量化交易之路(10)--金融概念Stop-limit Order
- 程序员的量化交易之路(11)--命令参数解析库JCommonder学习
- 程序员的量化交易之路(13)--Cointrader类图(1)
- 程序员的量化交易之路(14)--Cointrader数据表(2)
- cheap new balance outlet online
- white new balance 998 shoes