2 * Meviz - Various tools collection to work with multimedia. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
7 package eu.svjatoslav.meviz.htmlindexer.metadata;
9 import java.io.Serializable;
12 * Corresponds to single image dimensions.
15 public class Dimension implements Serializable, Comparable<Dimension> {
17 private static final long serialVersionUID = -1039288266937331829L;
27 public Dimension(final Dimension origial) {
28 width = origial.width;
29 height = origial.height;
32 public Dimension(final int width, final int height) {
38 public int compareTo(final Dimension anotherDimension) {
39 if (width < anotherDimension.width)
41 if (width > anotherDimension.width)
44 if (height < anotherDimension.height)
46 if (height > anotherDimension.height)
52 public boolean equals(final Dimension anotherDimension) {
53 return compareTo(anotherDimension) == 0;
56 public int getArea() {
57 return width * height;
60 public java.awt.Dimension getAwtDimension() {
61 return new java.awt.Dimension(width, height);
64 public Dimension getScaled(final double multiplicationFactor) {
65 final Dimension result = new Dimension();
67 result.width = (int) ((width) * multiplicationFactor);
68 result.height = (int) ((height) * multiplicationFactor);
74 public String toString() {
75 return "Dimension [width=" + width + ", height=" + height + "]";