package com.xcong.excoin.trade;
|
|
import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity;
|
|
import java.math.BigDecimal;
|
import java.util.ArrayList;
|
import java.util.Iterator;
|
import java.util.List;
|
|
public class MergeOrder {
|
private List<OrderCoinsEntity> orders = new ArrayList<>();
|
|
//最后位置添加一个
|
public void add(OrderCoinsEntity order){
|
orders.add(order);
|
}
|
|
|
public OrderCoinsEntity get(){
|
return orders.get(0);
|
}
|
|
public int size(){
|
return orders.size();
|
}
|
|
public BigDecimal getPrice(){
|
return orders.get(0).getEntrustPrice();
|
}
|
|
public Iterator<OrderCoinsEntity> iterator(){
|
return orders.iterator();
|
}
|
|
public BigDecimal getTotalAmount() {
|
BigDecimal total = new BigDecimal(0);
|
for(OrderCoinsEntity item : orders) {
|
total = total.add(item.getEntrustCnt());
|
}
|
return total;
|
}
|
}
|