blob: 794fb2e0c16952b7896f1357fcbfda997bba6ef9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// Base class for default BreakIterators.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.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();
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;
}
|