2362N/A * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * (C) Copyright Taligent, Inc. 1996 - All Rights Reserved 0N/A * (C) Copyright IBM Corp. 1996 - All Rights Reserved 0N/A * The original version of this source code and documentation is copyrighted 0N/A * and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These 0N/A * materials are provided under terms of a License Agreement between Taligent 0N/A * and Sun. This technology is protected by multiple US and International 0N/A * patents. This notice and attribution to Taligent may not be removed. 0N/A * Taligent is a registered trademark of Taligent, Inc. 0N/A * <code>FieldPosition</code> is a simple class used by <code>Format</code> 0N/A * and its subclasses to identify fields in formatted output. Fields can 0N/A * be identified in two ways: 0N/A * <li>By an integer constant, whose names typically end with 0N/A * <code>_FIELD</code>. The constants are defined in the various 0N/A * subclasses of <code>Format</code>. 0N/A * <li>By a <code>Format.Field</code> constant, see <code>ERA_FIELD</code> 0N/A * and its friends in <code>DateFormat</code> for an example. 0N/A * <code>FieldPosition</code> keeps track of the position of the 0N/A * field within the formatted output with two indices: the index 0N/A * of the first character of the field and the index of the last 0N/A * character of the field. 0N/A * One version of the <code>format</code> method in the various 0N/A * <code>Format</code> classes requires a <code>FieldPosition</code> 0N/A * object as an argument. You use this <code>format</code> method 0N/A * to perform partial formatting or to get information about the 0N/A * formatted output (such as the position of a field). 0N/A * If you are interested in the positions of all attributes in the 0N/A * formatted string use the <code>Format</code> method 0N/A * <code>formatToCharacterIterator</code>. 0N/A * @author Mark Davis 0N/A * @see java.text.Format 0N/A * Input: Desired field to determine start and end offsets for. 0N/A * The meaning depends on the subclass of Format. 0N/A * Output: End offset of field in text. 0N/A * If the field does not occur in the text, 0 is returned. 0N/A * Output: Start offset of field in text. 0N/A * If the field does not occur in the text, 0 is returned. 0N/A * Desired field this FieldPosition is for. 0N/A * Creates a FieldPosition object for the given field. Fields are 0N/A * identified by constants, whose names typically end with _FIELD, 0N/A * in the various subclasses of Format. 0N/A * @see java.text.NumberFormat#INTEGER_FIELD 0N/A * @see java.text.NumberFormat#FRACTION_FIELD 0N/A * @see java.text.DateFormat#YEAR_FIELD 0N/A * @see java.text.DateFormat#MONTH_FIELD 0N/A * Creates a FieldPosition object for the given field constant. Fields are 0N/A * identified by constants defined in the various <code>Format</code> 0N/A * subclasses. This is equivalent to calling 0N/A * <code>new FieldPosition(attribute, -1)</code>. 0N/A * @param attribute Format.Field constant identifying a field 0N/A * Creates a <code>FieldPosition</code> object for the given field. 0N/A * The field is identified by an attribute constant from one of the 0N/A * <code>Field</code> subclasses as well as an integer field ID 0N/A * defined by the <code>Format</code> subclasses. <code>Format</code> 0N/A * subclasses that are aware of <code>Field</code> should give precedence 0N/A * to <code>attribute</code> and ignore <code>fieldID</code> if 0N/A * <code>attribute</code> is not null. However, older <code>Format</code> 0N/A * subclasses may not be aware of <code>Field</code> and rely on 0N/A * <code>fieldID</code>. If the field has no corresponding integer 0N/A * constant, <code>fieldID</code> should be -1. 0N/A * @param attribute Format.Field constant identifying a field 0N/A * @param fieldID integer constantce identifying a field 0N/A * Returns the field identifier as an attribute constant 0N/A * from one of the <code>Field</code> subclasses. May return null if 0N/A * the field is specified only by an integer field ID. 0N/A * @return Identifier for the field 0N/A * Retrieves the field identifier. 0N/A * Retrieves the index of the first character in the requested field. 0N/A * Retrieves the index of the character following the last character in the 0N/A * Sets the begin index. For use by subclasses of Format. 0N/A * Sets the end index. For use by subclasses of Format. 0N/A * Returns a <code>Format.FieldDelegate</code> instance that is associated 0N/A * with the FieldPosition. When the delegate is notified of the same 0N/A * field the FieldPosition is associated with, the begin/end will be 0N/A * Returns a hash code for this FieldPosition. 0N/A * @return a hash code value for this object 0N/A * Return a string representation of this FieldPosition. 0N/A * @return a string representation of this object 0N/A * Return true if the receiver wants a <code>Format.Field</code> value and 0N/A * <code>attribute</code> is equal to it. 0N/A * Return true if the receiver wants a <code>Format.Field</code> value and 0N/A * <code>attribute</code> is equal to it, or true if the receiver 0N/A * represents an inteter constant and <code>field</code> equals it. 0N/A * An implementation of FieldDelegate that will adjust the begin/end 0N/A * of the FieldPosition if the arguments match the field of 0N/A * the FieldPosition. 0N/A * Indicates whether the field has been encountered before. If this 0N/A * is true, and <code>formatted</code> is invoked, the begin/end