All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pythagoras.i.AbstractDimension Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version
//
// Pythagoras - a collection of geometry classes
// http://github.com/samskivert/pythagoras

package pythagoras.i;

/**
 * Provides most of the implementation of {@link IDimension}, obtaining only width and height from
 * the derived class.
 */
public abstract class AbstractDimension implements IDimension
{
    @Override // from interface IDimension
    public Dimension clone () {
        return new Dimension(this);
    }

    @Override
    public int hashCode () {
        return width() ^ height();
    }

    @Override
    public boolean equals (Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof AbstractDimension) {
            AbstractDimension d = (AbstractDimension)obj;
            return (d.width() == width() && d.height() == height());
        }
        return false;
    }

    @Override
    public String toString () {
        return Dimensions.dimenToString(width(), height());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy