java.text

Class FieldPosition


public class FieldPosition
extends Object

This class is used by the java.text formatting classes to track field positions. A field position is defined by an identifier value and begin and end index positions. The formatting classes in java.text typically define constant values for the field identifiers.

Constructor Summary

FieldPosition(int field_id)
This method initializes a new instance of FieldPosition to have the specified field id.
FieldPosition(Format.Field field)
This method initializes a new instance of FieldPosition to have the specified field attribute.
FieldPosition(Format.Field field, int field_id)
This method initializes a new instance of FieldPosition to have the specified field attribute.

Method Summary

boolean
equals(Object obj)
This method tests this object for equality against the specified object.
int
getBeginIndex()
This method returns the beginning index for this field.
int
getEndIndex()
This method returns the ending index for the field.
int
getField()
This method returns the field identifier value for this object.
Format.Field
getFieldAttribute()
int
hashCode()
This method returns a hash value for this object
void
setBeginIndex(int begin)
This method sets the beginning index of this field to the specified value.
void
setEndIndex(int end)
This method sets the ending index of this field to the specified value.
String
toString()
This method returns a String representation of this object.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

FieldPosition

public FieldPosition(int field_id)
This method initializes a new instance of FieldPosition to have the specified field id.
Parameters:
field_id - The field identifier value.

FieldPosition

public FieldPosition(Format.Field field)
This method initializes a new instance of FieldPosition to have the specified field attribute. The attribute will be used as an id. It is formally equivalent to calling FieldPosition(field, -1).
Parameters:
field - The field format attribute.

FieldPosition

public FieldPosition(Format.Field field,
                     int field_id)
This method initializes a new instance of FieldPosition to have the specified field attribute. The attribute will be used as an id is non null. The integer field id is only used if the Format.Field attribute is not used by the formatter.
Parameters:
field - The field format attribute.
field_id - The field identifier value.

Method Details

equals

public boolean equals(Object obj)
This method tests this object for equality against the specified object. The objects will be considered equal if and only if:

  • The specified object is not null.
  • The specified object has the same class as this object.
  • The specified object has the same field identifier, field attribute and beginning and ending index as this object.
Overrides:
equals in interface Object
Parameters:
obj - The object to test for equality to this object.
Returns:
true if the specified object is equal to this object, false otherwise.

getBeginIndex

public int getBeginIndex()
This method returns the beginning index for this field.
Returns:
The beginning index.

getEndIndex

public int getEndIndex()
This method returns the ending index for the field.
Returns:
The ending index.

getField

public int getField()
This method returns the field identifier value for this object.
Returns:
The field identifier.

getFieldAttribute

public Format.Field getFieldAttribute()

hashCode

public int hashCode()
This method returns a hash value for this object
Overrides:
hashCode in interface Object
Returns:
A hash value for this object.

setBeginIndex

public void setBeginIndex(int begin)
This method sets the beginning index of this field to the specified value.
Parameters:
begin - The new beginning index.

setEndIndex

public void setEndIndex(int end)
This method sets the ending index of this field to the specified value.
Parameters:
end - The new ending index.

toString

public String toString()
This method returns a String representation of this object.
Overrides:
toString in interface Object
Returns:
A String representation of this object.

FieldPosition.java -- Keeps track of field positions while formatting Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath 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 for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.