安卓自定义控件之坐标存储类

原创 2015年11月20日 21:00:50

存储所有坐标所在坐标类(包括坐标文字,但不包括柱状图以及饼状图):


import java.io.Serializable;
import java.util.Comparator;

/**
 * Created by wangliang on 2016/7/29.
 */
public class Coordinate implements Serializable , Comparator<Coordinate> {
    private Float xCoordinate;
    private Float yCoordinate;
    private String coordinatename;

    public Coordinate(Float xCoordinate, Float yCoordinate, String coordinatename) {
        this.xCoordinate = xCoordinate;
        this.yCoordinate = yCoordinate;
        this.coordinatename = coordinatename;
    }

    public Coordinate() {
    }

    public Float getxCoordinate() {
        return xCoordinate;
    }

    public Coordinate setxCoordinate(Float xCoordinate) {
        this.xCoordinate = xCoordinate;
        return this;
    }

    public Float getyCoordinate() {
        return yCoordinate;
    }

    public Coordinate setyCoordinate(Float yCoordinate) {
        this.yCoordinate = yCoordinate;
        return this;
    }

    public String getCoordinatename() {
        return coordinatename;
    }

    public Coordinate setCoordinatename(String coordinatename) {
        this.coordinatename = coordinatename;
        return this;
    }

    @Override
    public String toString() {
        return "Coordinate{" +
                "xCoordinate=" + xCoordinate +
                ", yCoordinate=" + yCoordinate +
                ", coordinatename='" + coordinatename + '\'' +
                '}';
    }


    @Override
    public int compare(Coordinate o1, Coordinate o2) {
        return o1.xCoordinate.compareTo(o2.xCoordinate);
    }
}

存储柱状图坐标类:


import java.io.Serializable;

/**
 * Created by wangliang on 2016/7/29.
 */
public class LineCoordinate implements Serializable{
    private Float xStartCoordinate;
    private Float yStartCoordinate;
    private Float xStopCoordinate;
    private Float yStopCoordinate;
    private int color;
    private String coordinatename;

    public LineCoordinate(Float xStartCoordinate, Float yStartCoordinate, Float xStopCoordinate, Float yStopCoordinate) {
        this.xStartCoordinate = xStartCoordinate;
        this.yStartCoordinate = yStartCoordinate;
        this.xStopCoordinate = xStopCoordinate;
        this.yStopCoordinate = yStopCoordinate;
    }

    public LineCoordinate(Float xStartCoordinate, Float yStartCoordinate, Float xStopCoordinate, Float yStopCoordinate, String coordinatename) {
        this.xStartCoordinate = xStartCoordinate;
        this.yStartCoordinate = yStartCoordinate;
        this.xStopCoordinate = xStopCoordinate;
        this.yStopCoordinate = yStopCoordinate;
        this.coordinatename = coordinatename;
    }

    public LineCoordinate(Float xStartCoordinate, Float yStartCoordinate, Float xStopCoordinate, Float yStopCoordinate, int color, String coordinatename) {
        this.xStartCoordinate = xStartCoordinate;
        this.yStartCoordinate = yStartCoordinate;
        this.xStopCoordinate = xStopCoordinate;
        this.yStopCoordinate = yStopCoordinate;
        this.color = color;
        this.coordinatename = coordinatename;
    }

    public LineCoordinate() {

    }

    public int getColor() {
        return color;
    }

    public LineCoordinate setColor(int color) {
        this.color = color;
        return this;
    }

    public Float getxStartCoordinate() {
        return xStartCoordinate;
    }

    public LineCoordinate setxStartCoordinate(Float xStartCoordinate) {
        this.xStartCoordinate = xStartCoordinate;
        return this;
    }

    public Float getyStartCoordinate() {
        return yStartCoordinate;
    }

    public LineCoordinate setyStartCoordinate(Float yStartCoordinate) {
        this.yStartCoordinate = yStartCoordinate;
        return this;
    }

    public Float getxStopCoordinate() {
        return xStopCoordinate;
    }

    public LineCoordinate setxStopCoordinate(Float xStopCoordinate) {
        this.xStopCoordinate = xStopCoordinate;
        return this;
    }

    public Float getyStopCoordinate() {
        return yStopCoordinate;
    }

    public LineCoordinate setyStopCoordinate(Float yStopCoordinate) {
        this.yStopCoordinate = yStopCoordinate;
        return this;
    }

    public String getCoordinatename() {
        return coordinatename;
    }

    public LineCoordinate setCoordinatename(String coordinatename) {
        this.coordinatename = coordinatename;
        return this;
    }

    @Override
    public String toString() {
        return "LineCoordinate{" +
                "xStartCoordinate=" + xStartCoordinate +
                ", yStartCoordinate=" + yStartCoordinate +
                ", xStopCoordinate=" + xStopCoordinate +
                ", yStopCoordinate=" + yStopCoordinate +
                ", coordinatename=" + coordinatename +
                '}';
    }
}
版权声明:本文为博主原创文章,未经博主允许不得转载。 举报

相关文章推荐

返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)