java.text

Class ParsePosition


public class ParsePosition
extends Object

This class is used to keep track of the current position during parsing operations.

Constructor Summary

ParsePosition(int index)
This method initializes a new instance of ParsePosition to have the specified initial index value.

Method Summary

boolean
equals(Object obj)
This method tests the specified object for equality with this object.
int
getErrorIndex()
This method returns the error index value.
int
getIndex()
This method returns the current parsing index.
int
hashCode()
Return the hash code for this object.
void
setErrorIndex(int error_index)
This method sets the error index to the specified value.
void
setIndex(int index)
This method sets the current parsing index 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

ParsePosition

public ParsePosition(int index)
This method initializes a new instance of ParsePosition to have the specified initial index value.
Parameters:
index - The initial parsing index.

Method Details

equals

public boolean equals(Object obj)
This method tests the specified object for equality with this object. The two objects will be considered equal if and only if all of the following conditions are met.

  • The specified object is not null.
  • The specified object is an instance of ParsePosition.
  • The specified object has the same index and error index as this object.
Overrides:
equals in interface Object
Parameters:
obj - The Object to test for equality against this object.
Returns:
true if the specified object is equal to this object, false otherwise.

getErrorIndex

public int getErrorIndex()
This method returns the error index value. This value defaults to -1 unless explicitly set to another value.
Returns:
The error index.

getIndex

public int getIndex()
This method returns the current parsing index.
Returns:
The current parsing index

hashCode

public int hashCode()
Return the hash code for this object.
Overrides:
hashCode in interface Object
Returns:
the hash code

setErrorIndex

public void setErrorIndex(int error_index)
This method sets the error index to the specified value.
Parameters:
error_index - The new error index

setIndex

public void setIndex(int index)
This method sets the current parsing index to the specified value.
Parameters:
index - The new parsing index.

toString

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

ParsePosition.java -- Keep track of position while parsing. 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.