001package arez.dom; 002 003import java.util.Objects; 004 005/** 006 * A class containing width and height dimensions. 007 */ 008public final class Dimension 009{ 010 private final int _width; 011 private final int _height; 012 013 /** 014 * Create the dimension object. 015 * 016 * @param width the width. 017 * @param height the height. 018 */ 019 public Dimension( final int width, final int height ) 020 { 021 _width = width; 022 _height = height; 023 } 024 025 /** 026 * Return the width. 027 * 028 * @return the width. 029 */ 030 public int getWidth() 031 { 032 return _width; 033 } 034 035 /** 036 * Return the height. 037 * 038 * @return the height. 039 */ 040 public int getHeight() 041 { 042 return _height; 043 } 044 045 @Override 046 public boolean equals( final Object o ) 047 { 048 if ( o instanceof Dimension ) 049 { 050 final Dimension other = (Dimension) o; 051 return other._width == _width && other._height == _height; 052 } 053 else 054 { 055 return false; 056 } 057 } 058 059 @Override 060 public int hashCode() 061 { 062 return Objects.hash( _width, _height ); 063 } 064}