package com.house365.beans.po;

import java.io.Serializable;
import java.util.List;

public class BarComparePo implements Comparable<BarComparePo>, Serializable {

	private static final long serialVersionUID = 1L;

	private String projectName;
	
	private List<Long> data;

	public List<Long> getData() {
		return data;
	}

	public void setData(List<Long> data) {
		this.data = data;
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	private long getSum() {
		long sum = 0;
		for (Long d : data) {
			sum += d;
		}
		return sum;
	}

	@Override
	public int compareTo(BarComparePo o) {
		long result = o.getSum() - this.getSum();
		if (result > 0) {
			return -1;
		} else if (result == 0) {
			return 0;
		} else {
			return 1;
		}
	}
}
