This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gui] AbstractDocument.Content implementation
- From: Per Bothner <per at bothner dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Fri, 13 Feb 2004 11:02:23 -0800
- Subject: [gui] AbstractDocument.Content implementation
When someone gets around to implement the GapBuffer class
in javax.swing.text you might use my CharBuffer class,
which I used in JEmacs.
You probably want to rename soem of the classes, but
it does support the needed functionality (except undo).
It uses int "cookies" to implement positions, so higher-level
code can use these ints to implement Element without having
to allocate huge numbers of Position objects. A Position is
just a simple class that has an int position cookie and
points to a CharBuffer. The int cookies are not offsets;
they're indexes into an indirection table that is automatically
adjusted when characters are inserted or removed.
http://www.gnu.org/software/kawa/api/gnu/lists/CharBuffer.html
http://www.gnu.org/software/kawa/api/gnu/lists/StableVector.html
--
--Per Bothner
per@bothner.com http://per.bothner.com/