mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-26 05:09:04 +08:00
a1f4e5ed0a
* java/text/SimpleDateFormat.java: Re-merged with Classpath. * gnu/gcj/text/LocaleData.java, gnu/gcj/text/LocaleData_en.java, gnu/gcj/text/LocaleData_en_US.java: Removed. * java/text/DateFormatSymbols.java (clone): Use Classpath implementation. (equals): Simplified. (DateFormatSymbols): Look in gnu.java.locale for information. (DateFormatSymbols(DateFormatSymbols)): Removed. (safeGetResource): Removed. (DateFormatSymbols): Throws MissingResourceException. (ampmsDefault, erasDefault, localPatternCharsDefault, monthsDefault, shortMonthsDefault, shortWeekdaysDefault, weekdaysDefault, zoneStringsDefault): Removed. * java/text/Collator.java (getAvailableLocales): Use modified Classpath implementation. (getInstance): Look in gnu.java.locale for information. (clone): Rewrote. * java/text/MessageFormat.java: Reindented. (clone): Rewrote. * java/text/FieldPosition.java: Merged with Classpath. * java/text/ParsePosition.java: Merged with Classpath. * java/text/Format.java: Merged with Classpath. * java/text/StringCharacterIterator.java (StringCharacterIterator(StringCharacterIterator,int,int)): New constructor from Classpath. * java/text/Annotation.java, java/text/AttributedCharacterIterator.java, java/text/AttributedString.java, java/text/AttributedStringIterator.java: New from Classpath. * java/text/CharacterIterator.java: Copied from Classpath. * java/text/ChoiceFormat.java: Reindented. (clone): Removed. * gnu/java/text/BaseBreakIterator.java, gnu/java/text/CharacterBreakIterator.java, gnu/java/text/LineBreakIterator.java, gnu/java/text/LocaleData_en.java, gnu/java/text/LocaleData_en_US.java, gnu/java/text/SentenceBreakIterator.java, gnu/java/text/WordBreakIterator.java: Renamed from gnu/gcj/text/*. * gnu/gcj/text/BaseBreakIterator.java (last): Advance past final character. * java/text/BreakIterator.java (getAvailableLocales): Use Classpath implementation. (getInstance): Look in gnu.java.locale for information. (getCharacterInstance, getLineInstance, getSentenceInstance, getWordInstance): Look in gnu.java.text for implementations. * java/text/DecimalFormatSymbols.java: Reindented (clone): Use Classpath implementation. (DecimalFormatSymbols(DecimalFormatSymbols)): Removed. (DecimalFormatSymbols(Locale)): Look in gnu.java.locale for information. * java/text/DateFormat.java: Merged with Classpath. (getAvailableLocales): Use Classpath implementation. (format(Object,StringBuffer,FieldPosition)): Minor cleanup. (computeInstance): Look in gnu.java.locale for information. * java/text/NumberFormat.java: Reindented. (computeInstance): Look in gnu.java.locale for information. (getAvailableLocales): Use implementation from Classpath. (setMaximumIntegerDigits): Likewise. (setMinimumIntegerDigits): Likewise. (setMaximumFractionDigits): Likewise. (clone): Removed. * java/text/DecimalFormat.java: Reindented. * gnu/java/locale/LocaleInformation_en.java: Copied from Classpath. * gnu/java/locale/LocaleInformation_en_US.java: Copied from Classpath. * Makefile.in: Rebuilt. * Makefile.am (ordinary_java_source_files): Added all new files. (ordinary_java_source_files): Renamed or removed gnu/gcj/text/*. * java/security/spec/AlgorithmParameterSpec.java, java/security/spec/KeySpec.java: Re-merged with Classpath. From-SVN: r45390
102 lines
2.3 KiB
Java
102 lines
2.3 KiB
Java
/* BaseBreakIterator.java -- Base class for default BreakIterators
|
|
Copyright (C) 1999, 2001 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., 59 Temple Place, Suite 330, Boston, MA
|
|
02111-1307 USA.
|
|
|
|
As a special exception, if you link this library with other files to
|
|
produce an executable, this library does not by itself cause the
|
|
resulting executable to be covered by the GNU General Public License.
|
|
This exception does not however invalidate any other reasons why the
|
|
executable file might be covered by the GNU General Public License. */
|
|
|
|
|
|
package gnu.java.text;
|
|
|
|
import java.text.BreakIterator;
|
|
import java.text.CharacterIterator;
|
|
|
|
/**
|
|
* @author Tom Tromey <tromey@cygnus.com>
|
|
* @date March 22, 1999
|
|
*/
|
|
|
|
public abstract class BaseBreakIterator extends BreakIterator
|
|
{
|
|
public int current ()
|
|
{
|
|
return iter.getIndex();
|
|
}
|
|
|
|
public int first ()
|
|
{
|
|
iter.first();
|
|
return iter.getBeginIndex();
|
|
}
|
|
|
|
public int following (int pos)
|
|
{
|
|
int save = iter.getIndex();
|
|
iter.setIndex(pos);
|
|
int r = next ();
|
|
iter.setIndex(save);
|
|
return r;
|
|
}
|
|
|
|
public CharacterIterator getText ()
|
|
{
|
|
return iter;
|
|
}
|
|
|
|
public int last ()
|
|
{
|
|
iter.last();
|
|
// Go past the last character.
|
|
iter.next();
|
|
return iter.getEndIndex();
|
|
}
|
|
|
|
public int next (int n)
|
|
{
|
|
int r = iter.getIndex ();
|
|
if (n > 0)
|
|
{
|
|
while (n > 0 && r != DONE)
|
|
{
|
|
r = next ();
|
|
--n;
|
|
}
|
|
}
|
|
else if (n < 0)
|
|
{
|
|
while (n < 0 && r != DONE)
|
|
{
|
|
r = previous ();
|
|
++n;
|
|
}
|
|
}
|
|
return r;
|
|
}
|
|
|
|
public void setText (CharacterIterator newText)
|
|
{
|
|
iter = newText;
|
|
}
|
|
|
|
protected CharacterIterator iter;
|
|
}
|