/[classpath]/classpath/java/text/FieldPosition.java
ViewVC logotype

Diff of /classpath/java/text/FieldPosition.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by mark, Tue Jan 22 22:27:01 2002 UTC revision 1.6 by tromey, Wed Nov 19 17:41:21 2003 UTC
# Line 65  public class FieldPosition Line 65  public class FieldPosition
65    private int end;    private int end;
66    
67    /**    /**
68       * This is the field attribute value.
69       */
70      private Format.Field field_attribute;
71    
72      /**
73       * This method initializes a new instance of <code>FieldPosition</code>
74       * to have the specified field attribute. The attribute will be used as
75       * an id.
76       *
77       * @param field The field format attribute.
78       */
79      public FieldPosition (Format.Field field)
80      {
81        this.field_attribute = field;
82      }
83    
84      /**
85       * This method initializes a new instance of <code>FieldPosition</code>
86       * to have the specified field attribute. The attribute will be used as
87       * an id is non null. The integer field id is only used if the Format.Field
88       * attribute is not used by the formatter.
89       *
90       * @param field The field format attribute.
91       * @param field_id The field identifier value.
92       */
93      public FieldPosition (Format.Field field, int field_id)
94      {
95        this.field_attribute = field;
96        this.field_id = field_id;
97      }
98    
99      /**
100     * This method initializes a new instance of <code>FieldPosition</code> to     * This method initializes a new instance of <code>FieldPosition</code> to
101     * have the specified field id.     * have the specified field id.
102     *     *
# Line 85  public class FieldPosition Line 117  public class FieldPosition
117      return field_id;      return field_id;
118    }    }
119    
120      public Format.Field getFieldAttribute ()
121      {
122        return field_attribute;
123      }
124    
125    /**    /**
126     * This method returns the beginning index for this field.     * This method returns the beginning index for this field.
127     *     *
# Line 132  public class FieldPosition Line 169  public class FieldPosition
169     * <ul>     * <ul>
170     * <li>The specified object is not <code>null</code>.     * <li>The specified object is not <code>null</code>.
171     * <li>The specified object is an instance of <code>FieldPosition</code>.     * <li>The specified object is an instance of <code>FieldPosition</code>.
172     * <li>The specified object has the same field identifier and beginning     * <li>The specified object has the same field identifier, field attribute
173     * and ending index as this object.     * and beginning and ending index as this object.
174     * </ul>     * </ul>
175     *     *
176     * @param obj The object to test for equality to this object.     * @param obj The object to test for equality to this object.
# Line 143  public class FieldPosition Line 180  public class FieldPosition
180     */     */
181    public boolean equals (Object obj)    public boolean equals (Object obj)
182    {    {
183      if (! (obj instanceof FieldPosition))      if (this == obj)
184          return true;
185    
186        if (obj == null || obj.getClass() != this.getClass())
187        return false;        return false;
188    
189      FieldPosition fp = (FieldPosition) obj;      FieldPosition fp = (FieldPosition) obj;
190      return (field_id == fp.field_id      return (field_id == fp.field_id
191                && (field_attribute == fp.field_attribute
192                    || (field_attribute != null
193                        && field_attribute.equals(fp.field_attribute)))
194              && begin == fp.begin              && begin == fp.begin
195              && end == fp.end);              && end == fp.end);
196    }    }
197    
198    
199      /**
200       * This method returns a hash value for this object
201       *
202       * @return A hash value for this object.
203       */
204      public int hashCode ()
205      {
206        int hash = 5;
207    
208        hash = 31 * hash + field_id;
209        hash = 31 * hash + begin;
210        hash = 31 * hash + end;
211        hash = 31 * hash +
212          (null == field_attribute ? 0 : field_attribute.hashCode());
213    
214        return hash;
215      }
216    
217    /**    /**
218     * This method returns a <code>String</code> representation of this     * This method returns a <code>String</code> representation of this
219     * object.     * object.
# Line 160  public class FieldPosition Line 222  public class FieldPosition
222     */     */
223    public String toString ()    public String toString ()
224    {    {
225      return (getClass ().getName () + "[field=" + getField () + ",beginIndex="      return (getClass ().getName ()
226              + getBeginIndex () + ",endIndex=" + getEndIndex () + "]");              + "[field=" + getField ()
227                + ",attribute=" + getFieldAttribute ()
228                + ",beginIndex=" + getBeginIndex ()
229                + ",endIndex=" + getEndIndex ()
230                + "]");
231    }    }
232  }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26