net.gdface.sdk.EyeInfo Maven / Gradle / Ivy
package net.gdface.sdk;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.Serializable;
/**
* 眼睛位置描述对象
* @author guyadong
*
*/
public class EyeInfo implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private int leftx;
private int lefty;
private int rightx;
private int righty;
public EyeInfo() {
this(0,0,0,0);
}
public EyeInfo(int leftx, int lefty, int rightx, int righty) {
this.leftx = leftx;
this.lefty = lefty;
this.rightx = rightx;
this.righty = righty;
}
public int getLeftx() {
return this.leftx;
}
public int getLefty() {
return this.lefty;
}
public int getRightx() {
return this.rightx;
}
public int getRighty() {
return this.righty;
}
public void setLeftAndRight(int leftx, int lefty, int rightx, int righty) {
this.leftx = leftx;
this.lefty = lefty;
this.rightx = rightx;
this.righty = righty;
}
/**
* @param leftx
* 要设置的 leftx
*/
public void setLeftx(int leftx) {
this.leftx = leftx;
}
/**
* @param lefty
* 要设置的 lefty
*/
public void setLefty(int lefty) {
this.lefty = lefty;
}
/**
* @param rightx
* 要设置的 rightx
*/
public void setRightx(int rightx) {
this.rightx = rightx;
}
/**
* @param righty
* 要设置的 righty
*/
public void setRighty(int righty) {
this.righty = righty;
}
@Override
public String toString() {
ByteArrayOutputStream bo = new ByteArrayOutputStream();
toStream(new PrintStream(bo));
return bo.toString();
}
/**
* 以文本形式向{@link PrintStream}输出对象内容
* @param stream
*/
public void toStream(PrintStream stream) {
stream.printf("[lx=%d,ly=%d,rx=%d,ry=%d]",this.leftx,this.lefty,this.rightx,this.righty);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + leftx;
result = prime * result + lefty;
result = prime * result + rightx;
result = prime * result + righty;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof EyeInfo)) {
return false;
}
EyeInfo other = (EyeInfo) obj;
if (leftx != other.leftx) {
return false;
}
if (lefty != other.lefty) {
return false;
}
if (rightx != other.rightx) {
return false;
}
if (righty != other.righty) {
return false;
}
return true;
}
}