Changeset 1391 for branches/GNU/src/gcc/libjava/java/awt/Insets.java
- Timestamp:
- Apr 27, 2004, 8:39:34 PM (22 years ago)
- Location:
- branches/GNU/src/gcc
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
libjava/java/awt/Insets.java (modified) (2 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gcc
- Property svn:ignore
-
old new 26 26 configure.vr 27 27 configure.vrs 28 28 29 Makefile 29 dir.info30 30 lost+found 31 31 update.out
-
- Property svn:ignore
-
branches/GNU/src/gcc/libjava/java/awt/Insets.java
-
Property cvs2svn:cvs-rev
changed from
1.1to1.1.1.2
r1390 r1391 1 /* Insets.java -- Information about a container border.1 /* Insets.java -- 2 2 Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. 3 3 … … 39 39 package java.awt; 40 40 41 /** 42 * This class represents the "margin" or space around a container. 43 * 44 * @author Aaron M. Renn ([email protected]) 45 */ 46 public class Insets implements Cloneable, java.io.Serializable 47 { 48 49 /* 50 * Instance Variable 51 */ 41 import java.io.Serializable; 52 42 53 43 /** 54 * @serial The top inset 55 */ 56 public int top; 44 * This class represents the "margin" or space around a container. 45 * 46 * @author Aaron M. Renn <[email protected]> 47 * @author Eric Blake <[email protected]> 48 * @status 49 */ 50 public class Insets implements Cloneable, Serializable 51 { 52 /** 53 * Compatible with JDK 1.0+. 54 */ 55 private static final long serialVersionUID = -2272572637695466749L; 57 56 58 /** 59 * @serial This bottom inset 60 */ 61 public int bottom; 57 /** 58 * The gap from the top. 59 * 60 * @serial the top inset 61 */ 62 public int top; 62 63 63 /** 64 * @serial The left inset 65 */ 66 public int left; 64 /** 65 * The gap from the left. 66 * 67 * @serial the left inset 68 */ 69 public int left; 67 70 68 /** 69 * @serial The right inset 70 */ 71 public int right; 71 /** 72 * The gap from the bottom. 73 * 74 * @serial the bottom inset 75 */ 76 public int bottom; 72 77 73 /*************************************************************************/ 78 /** 79 * The gap from the right. 80 * 81 * @serial the right inset 82 */ 83 public int right; 74 84 75 /** 76 * Initializes a new instance of <code>Inset</code> with the specified 77 * inset values. 78 * 79 * @param top The top inset 80 * @param left The left inset 81 * @param bottom The bottom inset 82 * @param right The right inset 83 */ 84 public 85 Insets(int top, int left, int bottom, int right) 86 { 87 this.top = top; 88 this.left = left; 89 this.bottom = bottom; 90 this.right = right; 91 } 85 /** 86 * Initializes a new instance of <code>Inset</code> with the specified 87 * inset values. 88 * 89 * @param top the top inset 90 * @param left the left inset 91 * @param bottom the bottom inset 92 * @param right the right inset 93 */ 94 public Insets(int top, int left, int bottom, int right) 95 { 96 this.top = top; 97 this.left = left; 98 this.bottom = bottom; 99 this.right = right; 100 } 92 101 93 /*************************************************************************/ 102 /** 103 * Tests whether this object is equal to the specified object. The other 104 * object must be an instance of Insets with identical field values. 105 * 106 * @param obj the object to test against 107 * @return true if the specified object is equal to this one 108 */ 109 public boolean equals(Object obj) 110 { 111 if (! (obj instanceof Insets)) 112 return false; 113 Insets i = (Insets) obj; 114 return top == i.top && bottom == i.bottom 115 && left == i.left && right == i.right; 116 } 94 117 95 /* 96 * Instance Methods 97 */ 118 /** 119 * Returns a hashcode for this instance. The formula is unspecified, but 120 * appears to be <code>XXX what is it? </code>. 121 * 122 * @return the hashcode 123 */ 124 public int hashCode() 125 { 126 // This can't be right... 127 return top + bottom + left + right; 128 } 98 129 99 /** 100 * Tests whether this object is equal to the specified object. This will 101 * be true if and only if the specified object: 102 * <p> 103 * <ul> 104 * <li>Is not <code>null</code>. 105 * <li>Is an instance of <code>Insets</code>. 106 * <li>Has the same top, bottom, left, and right inset values as this object. 107 * </ul> 108 * 109 * @param obj The object to test against. 110 * 111 * @return <code>true</code> if the specified object is equal to this 112 * one, <code>false</code> otherwise. 113 */ 114 public boolean 115 equals(Object obj) 116 { 117 if (!(obj instanceof Insets)) 118 return(false); 130 /** 131 * Returns a string representation of this object, which will be non-null. 132 * The format is unspecified, but appears to be <code>XXX what is it?</code>. 133 * 134 * @return a string representation of this object 135 */ 136 public String toString() 137 { 138 return getClass().getName() + "(top=" + top + ",bottom=" + bottom + 139 ",left=" + left + ",right=" + right + ')'; 140 } 119 141 120 Insets i = (Insets)obj; 121 122 if (i.top != top) 123 return(false); 124 if (i.bottom != bottom) 125 return(false); 126 if (i.left != left) 127 return(false); 128 if (i.right != right) 129 return(false); 130 131 return(true); 132 } 133 134 public int 135 hashCode() 136 { 137 return top + bottom + left + right; 138 } 139 140 /*************************************************************************/ 141 142 /** 143 * Returns a string representation of this object. 144 * 145 * @return A string representation of this object. 146 */ 147 public String 148 toString() 149 { 150 return(getClass().getName() + "(top=" + top + ",bottom=" + bottom + 151 ",left=" + left + ",right=" + right + ")"); 152 } 153 154 /*************************************************************************/ 155 156 /** 157 * Returns a copy of this object. 158 * 159 * @return A copy of this object. 160 */ 161 public Object 162 clone() 163 { 164 try 165 { 166 return(super.clone()); 167 } 168 catch(Exception e) 169 { 170 return(null); 171 } 172 } 173 174 } // class Insets 142 /** 143 * Returns a copy of this object. 144 * 145 * @return a copy of this object 146 */ 147 public Object clone() 148 { 149 try 150 { 151 return super.clone(); 152 } 153 catch (CloneNotSupportedException e) 154 { 155 throw (Error) new InternalError().initCause(e); // Impossible 156 } 157 } 158 } // class Insets -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
