diff options
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/util/Insets.java | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java deleted file mode 100644 index 0d992d7fa..000000000 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved. - * Copyright (c) 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - */ -package javax.media.nativewindow.util; - -/** - * Simple class representing insets. - * - * @author tdv - */ -public class Insets implements Cloneable { - public int top; - public int left; - public int bottom; - public int right; - public int hash; - - /** - * Creates and initializes a new <code>Insets</code> object with the - * specified top, left, bottom, and right insets. - * @param top the inset from the top. - * @param left the inset from the left. - * @param bottom the inset from the bottom. - * @param right the inset from the right. - */ - public Insets(int top, int left, int bottom, int right) { - this.top = top; - this.left = left; - this.bottom = bottom; - this.right = right; - this.hash = computeHashCode(); - } - - /** - * Checks whether two insets objects are equal. Two instances - * of <code>Insets</code> are equal if the four integer values - * of the fields <code>top</code>, <code>left</code>, - * <code>bottom</code>, and <code>right</code> are all equal. - * @return <code>true</code> if the two insets are equal; - * otherwise <code>false</code>. - */ - public boolean equals(Object obj) { - if(this == obj) { return true; } - if (obj instanceof Insets) { - Insets insets = (Insets)obj; - return ((top == insets.top) && (left == insets.left) && - (bottom == insets.bottom) && (right == insets.right)); - } - return false; - } - - /** - * Returns the hash code for this Insets. - * - * @return a hash code for this Insets. - */ - public int hashCode() { - return hash; - } - - public String toString() { - return getClass().getName() + "[top=" + top + ",left=" + left + - ",bottom=" + bottom + ",right=" + right + "]"; - } - - public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - protected int computeHashCode() { - int sum1 = left + bottom; - int sum2 = right + top; - int val1 = sum1 * (sum1 + 1)/2 + left; - int val2 = sum2 * (sum2 + 1)/2 + top; - int sum3 = val1 + val2; - return sum3 * (sum3 + 1)/2 + val2; - } -} |