package com.example.client;

import android.R.integer;

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

public class DrawData { 
    // 曲线图的最大值（最大点数）
    public static final int FIGURE_LENGTH = 200;
    
    //////////////////////////////// 清除生理指标 ///////////////////////////////
    public static void clearIndexs()
    {
        listXV = new ArrayList<Float>();
        listQZ = new ArrayList<Float>();
        listHRV = new ArrayList<Float>();
    }
  
    //////////////////////////////// 绘制生理指标 ///////////////////////////////
    private static List<Float> listXV = new ArrayList<Float>();
    public static List<Float> drawXV()
    {   
        float data = (float)(RelaxData.getInstance().getXV());
        if (data != 0)
        {
            listXV.add( data * 2.125f );
        }
        
        if (listXV.size() == FIGURE_LENGTH)
        {
            listXV.clear();
        }
        
        return listXV;
    }
    
    
    private static List<Float> listHRV = new ArrayList<Float>();
    public static List<Float> drawHRV()
    {   
        float data = (float)(RelaxData.getInstance().getHRV());
        // 情指不为0时才绘制
        if (data != 0 && RelaxData.getInstance().getQZ() != 0)
        {
            listHRV.add( data * 2.125f );
        }
        
        if (listHRV.size() == FIGURE_LENGTH)
        {
            listHRV.clear();
        }
        
        return listHRV;
    }
    
    
    private static List<Float> listQZ = new ArrayList<Float>();
    public static List<Float> drawQZ()
    {   
        float data = (float)(RelaxData.getInstance().getQZ());
        if (data != 0)
        {
            listQZ.add( data * 2.125f );
        }
        
        if (listQZ.size() == FIGURE_LENGTH)
        {
            listQZ.clear();
        }
        
        return listQZ;
    }
}

