package net.northking.cctp.flowable.sm;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(value = "坐标")
public class Coordinate {

    @ApiModelProperty(value = "x坐标")
    private int x;

    @ApiModelProperty(value = "y坐标")
    private int y;

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public String toString() {
        return this.x + "," + this.y;
    }

    public Coordinate fromString(String point) {
        String[] arr = point.split(",");
        return new Coordinate(Integer.parseInt(arr[0]), Integer.parseInt(arr[1]));
    }

    public Coordinate(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public Coordinate() {
    }

    public Coordinate(String point) {
        String[] arr = point.split(",");
        this.x = Integer.parseInt(arr[0]);
        this.y = Integer.parseInt(arr[1]);
    }

}
