org.jxls.common.Size Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jxls-jdk1.6 Show documentation
Show all versions of jxls-jdk1.6 Show documentation
Small library for Excel generation based on XLS templates
The newest version!
package org.jxls.common;
/**
* Date: Mar 13, 2009
*
* @author Leonid Vysochyn
*/
public class Size {
int width;
int height;
public static final Size ZERO_SIZE = new Size(0,0);
public Size() {
}
public Size(int width, int height) {
this.width = width;
this.height = height;
}
public void setWidth(int width) {
this.width = width;
}
public void setHeight(int height) {
this.height = height;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
@Override
public String toString() {
return "(" + width + "," + height + ")";
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Size size = (Size) o;
if (height != size.height) return false;
if (width != size.width) return false;
return true;
}
@Override
public int hashCode() {
int result = width;
result = 31 * result + height;
return result;
}
public Size minus(Size aSize) {
return new Size(width - aSize.getWidth(), height - aSize.getHeight() );
}
public Size add(Size aSize) {
return new Size(width + aSize.getWidth(), height + aSize.getHeight());
}
public Size append(int width, int height){
this.width += width;
this.height += height;
return this;
}
public Size append(Size aSize){
return append(aSize.getWidth(), aSize.getHeight());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy