package com.desfate.chart.data;


import com.desfate.chart.entity.OHLCEntity;
import com.desfate.chart.entity.StickEntity;

import java.util.ArrayList;
import java.util.List;

public class ChartDataContainer {

    public List<OHLCEntity> mOHLCList;
    //public SortedMap<Date, OHLCEntity> sortedMap;

    public List<StickEntity> mStickList;

    public int mSize = 0;// !< @brief
    // mSize是收到的图表json数据的实际大小，而mOhlc的size有时会比mSize大，有时会小

    public ChartDataContainer() {
        mOHLCList = new ArrayList<OHLCEntity>();
        mStickList = new ArrayList<StickEntity>();
//		sortedMap = new TreeMap<Date, OHLCEntity>(new Comparator<Date>() {
//			@Override
//			public int compare(Date arg0, Date arg1) {
//				return arg0.compareTo(arg1);
//			}
//		});
    }

    public int getTrustNum() {
        int a = 0;
        for (int i = mOHLCList.size() - 1; i > 0; i--) {
            if (mOHLCList.get(i) instanceof ChartData) {
                if (((ChartData) mOHLCList.get(i)).getDataType() != 2) {
                    return i;
                }
            } else {
                return mSize;
            }
        }
        return a;
    }
}
