2 * Meviz - Various tools collection to work with multimedia.
3 * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public License
7 * as published by the Free Software Foundation.
10 package eu.svjatoslav.meviz.htmlindexer.metadata;
12 import java.io.Serializable;
15 * Corresponds to single image dimensions.
18 public class Dimension implements Serializable, Comparable<Dimension> {
20 private static final long serialVersionUID = -1039288266937331829L;
30 public Dimension(final Dimension origial) {
31 width = origial.width;
32 height = origial.height;
35 public Dimension(final int width, final int height) {
41 public int compareTo(final Dimension anotherDimension) {
42 if (width < anotherDimension.width)
44 if (width > anotherDimension.width)
47 if (height < anotherDimension.height)
49 if (height > anotherDimension.height)
55 public boolean equals(final Dimension anotherDimension) {
56 return compareTo(anotherDimension) == 0;
59 public int getArea() {
60 return width * height;
63 public java.awt.Dimension getAwtDimension() {
64 return new java.awt.Dimension(width, height);
67 public Dimension getScaled(final double multiplicationFactor) {
68 final Dimension result = new Dimension();
70 result.width = (int) ((width) * multiplicationFactor);
71 result.height = (int) ((height) * multiplicationFactor);
77 public String toString() {
78 return "Dimension [width=" + width + ", height=" + height + "]";