--- /dev/null 2016-04-05 17:09:41.000000000 +0400 +++ new/src/java.desktop/share/classes/java/awt/image/ResolutionVariantItem.java 2016-04-05 17:09:41.000000000 +0400 @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package java.awt.image; + +/** + * The ResolutionVariantItem class stores the resolution variant value as well + * as scaled factors associated with it. + * + * @since 9 + */ +public class ResolutionVariantItem { + + private final T value; + private final double scaleX; + private final double scaleY; + + /** + * Creates a new instance of ResolutionVariantItem. + * @param value the resolution-variant value + * @param scaleX the scale factor fox x-axis + * @param scaleY the scale factor fox y-axis + * + * @since 9 + */ + public ResolutionVariantItem(T value, double scaleX, double scaleY) { + this.value = value; + this.scaleX = scaleX; + this.scaleY = scaleY; + } + + /** + * Retrieves the value associated with this resolution-variant item. + * + * @return the resolution-variant value + * + * @since 9 + */ + public T getValue() { + return value; + } + + /** + * Retrieves the x-axis scale factor associated with this resolution-variant + * item. + * + * @return the scale factor fox x-axis + * + * @since 9 + */ + public double getScaleX() { + return scaleX; + } + + /** + * Retrieves the y-axis scale factor associated with this resolution-variant + * item. + * + * @return the scale factor fox y-axis + * + * @since 9 + */ + public double getScaleY() { + return scaleY; + } + + @Override + @SuppressWarnings("rawtypes") + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (!(obj instanceof ResolutionVariantItem)) { + return false; + } + + ResolutionVariantItem rvItem = (ResolutionVariantItem) obj; + return scaleX == rvItem.scaleX + && scaleY == rvItem.scaleY + && value.equals(rvItem.value); + } + + @Override + public int hashCode() { + int hash = value.hashCode(); + hash = 31 * hash + Double.hashCode(scaleX); + hash = 31 * hash + Double.hashCode(scaleY); + return hash; + } +} \ No newline at end of file