[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gzz/client/awt/AWTScreen.java gzz/client/aw...
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] gzz gzz/client/awt/AWTScreen.java gzz/client/aw... |
Date: |
Sat, 28 Dec 2002 21:01:42 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Benja Fallenstein <address@hidden> 02/12/28 21:01:41
Modified files:
gzz/client/awt : AWTScreen.java JUpdateManager.java
gzz/view : BoxCellView.java CellHBox.java
LinebrokenCellContentView.java
LollipopCellView.java
gzz/vob/linebreaking: HBox.java HBroken.java HChain.java
gzz/vob/vobs : TextVob.java
lava/gzz/storm : IndexedPool.java Pointer.java
lava/gzz/storm/impl: AbstractPool.java
Log message:
- Scrolling and line cursors for multiline.
You can actually use it now ;-)
- Clipping for Lollipop. Looks horrible,
but less horrible than the overlapping text before.
Need to figure this out better.
- Some dbg statements from Kaffe bug hunt.
May come in handy again.
- More Storm indexing thinking.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/awt/AWTScreen.java.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/awt/JUpdateManager.java.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/BoxCellView.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellHBox.java.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LinebrokenCellContentView.java.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LollipopCellView.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/linebreaking/HBox.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/linebreaking/HBroken.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/linebreaking/HChain.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/vobs/TextVob.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/storm/IndexedPool.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/storm/Pointer.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/storm/impl/AbstractPool.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: gzz/gzz/client/awt/AWTScreen.java
diff -u gzz/gzz/client/awt/AWTScreen.java:1.27
gzz/gzz/client/awt/AWTScreen.java:1.28
--- gzz/gzz/client/awt/AWTScreen.java:1.27 Thu Dec 5 04:29:43 2002
+++ gzz/gzz/client/awt/AWTScreen.java Sat Dec 28 21:01:41 2002
@@ -37,7 +37,7 @@
public abstract class AWTScreen
extends GraphicsAPI.AbstractWindow
implements MouseListener, MouseMotionListener, Obs,
JUpdateManager.EventProcessor {
- public static final String rcsid = "$Id: AWTScreen.java,v 1.27 2002/12/05
09:29:43 tjl Exp $";
+ public static final String rcsid = "$Id: AWTScreen.java,v 1.28 2002/12/29
02:01:41 benja Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.out.println(s); }
@@ -207,6 +207,7 @@
if(e instanceof KeyEvent) {
KeyEvent ke = (KeyEvent)e;
String name = InputEventUtil.getKeyEventName(ke);
+ if(dbg) pa("ZZProcessEvent keyname: "+name);
if(name != null && !name.equals("")) {
binder.keystroke(name);
}
@@ -243,7 +244,11 @@
super();
enableEvents(AWTEvent.KEY_EVENT_MASK);
}
+ private KeyEvent lastEvent;
public void processKeyEvent(KeyEvent e) {
+ if(dbg) pa("AWTScreen received: " + e);
+ if(e == lastEvent) throw new Error("Re-used event object: "+e);
+ lastEvent = e;
JUpdateManager.addEvent(AWTScreen.this, e);
}
public boolean isFocusTraversable() { return true; }
Index: gzz/gzz/client/awt/JUpdateManager.java
diff -u gzz/gzz/client/awt/JUpdateManager.java:1.7
gzz/gzz/client/awt/JUpdateManager.java:1.8
--- gzz/gzz/client/awt/JUpdateManager.java:1.7 Sat Apr 20 14:31:12 2002
+++ gzz/gzz/client/awt/JUpdateManager.java Sat Dec 28 21:01:41 2002
@@ -32,8 +32,8 @@
import java.awt.image.*;
public class JUpdateManager extends AbstractUpdateManager {
-public static final String rcsid = "$Id: JUpdateManager.java,v 1.7 2002/04/20
18:31:12 tjl Exp $";
- private static boolean dbg = true;
+public static final String rcsid = "$Id: JUpdateManager.java,v 1.8 2002/12/29
02:01:41 benja Exp $";
+ private static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
@@ -54,6 +54,7 @@
eventList.add(proc);
eventList.add(e);
eventList.notifyAll();
+ if(dbg) pa("Queue "+e+"; listlen="+eventList.size());
}
}
@@ -92,6 +93,7 @@
evt = (AWTEvent)eventList.get(1);
eventList.remove(1);
eventList.remove(0);
+ if(dbg) pa("Unqueue "+evt+"; listlen="+eventList.size());
}
proc.zzProcessEvent(evt);
// XXX wait...
Index: gzz/gzz/view/BoxCellView.java
diff -u gzz/gzz/view/BoxCellView.java:1.5 gzz/gzz/view/BoxCellView.java:1.6
--- gzz/gzz/view/BoxCellView.java:1.5 Thu Dec 5 20:03:51 2002
+++ gzz/gzz/view/BoxCellView.java Sat Dec 28 21:01:41 2002
@@ -35,9 +35,8 @@
/** A cell view showing a box around a cell.
*/
-
public class BoxCellView extends CellView {
-public static final String rcsid = "$Id: BoxCellView.java,v 1.5 2002/12/06
01:03:51 benja Exp $";
+public static final String rcsid = "$Id: BoxCellView.java,v 1.6 2002/12/29
02:01:41 benja Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
Index: gzz/gzz/view/CellHBox.java
diff -u gzz/gzz/view/CellHBox.java:1.11 gzz/gzz/view/CellHBox.java:1.12
--- gzz/gzz/view/CellHBox.java:1.11 Sat Nov 23 08:44:20 2002
+++ gzz/gzz/view/CellHBox.java Sat Dec 28 21:01:41 2002
@@ -59,6 +59,16 @@
public float getDepth(float scale) {
return 0;
}
+
+ public int getLength() {
+ return 1;
+ }
+
+ public float getX(int i, float scale) {
+ if(i < 0 || i > 1) throw new IndexOutOfBoundsException(""+i);
+ if(i == 0) return 0;
+ else return getWidth(scale);
+ }
public Object getKey() {
return cell;
Index: gzz/gzz/view/LinebrokenCellContentView.java
diff -u gzz/gzz/view/LinebrokenCellContentView.java:1.18
gzz/gzz/view/LinebrokenCellContentView.java:1.19
--- gzz/gzz/view/LinebrokenCellContentView.java:1.18 Sat Dec 7 20:35:05 2002
+++ gzz/gzz/view/LinebrokenCellContentView.java Sat Dec 28 21:01:41 2002
@@ -40,12 +40,14 @@
* Doesn't scroll, currently.
*/
public class LinebrokenCellContentView extends CellView {
-public static final String rcsid = "$Id: LinebrokenCellContentView.java,v 1.18
2002/12/08 01:35:05 benja Exp $";
+public static final String rcsid = "$Id: LinebrokenCellContentView.java,v 1.19
2002/12/29 02:01:41 benja Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
- static Object ARGH_KEY = new Object();
+ static Object CONTENT_KEY = new Object();
+ static Object CURSOR_KEY = new Object();
+ LineVob cursorVob = new LineVob(0, 0, 0, 1, Color.black);
TextStyle style;
SimpleLinebreaker breaker = new SimpleLinebreaker();
@@ -62,7 +64,7 @@
this.widthString = widthString;
}
- /** Get the height necessary to layout *all* text in a cell,
+ /** Get the height necessary to layout a range of text in a cell,
* at a given width and scale.
*/
public float getHeight(Cell c, float forWidth, float scale) {
@@ -91,19 +93,55 @@
}
static Rectangle box = new Rectangle();
- float[] boxwh = new float[2];
+ float[] boxwh = new float[2], xoffsarr = new float[1];
public void place(Cell c, VobScene vs, int box,
ViewContext context) {
float scale = 1; // XXX getFontScale (see PEG vobcoorder_fontscale--tjl)
- HChain ch = getChain(c, scale);
vs.coords.getSqSize(box, boxwh);
if(dbg) pa(""+boxwh[0]);
+
+ int pos = context.getCursorOffset(c);
+ float line_height = style.getHeight(scale);
+ float xoffs = 0, yoffs0 = 0, yoffs1 = 0;
+
+ HChain ch = getChain(c, scale);
HBroken br = breaker.breakLines(ch, boxwh[0], scale);
- br.put(vs, box);
+
+ if(pos >= 0) {
+ int line = br.getLine(pos, xoffsarr);
+ xoffs = xoffsarr[0];
+ yoffs0 = br.getLineOffset(line-1);
+ yoffs1 = br.getLineOffset(line);
+ }
+
+ float h = br.getHeight();
+ float middle = boxwh[1]/2;
+ float yoffs = (yoffs0 + yoffs1) / 2;
+
+ int content;
+ if(h < boxwh[1] || yoffs < middle)
+ content = vs.translateCS(box, CONTENT_KEY, 0, 0);
+ else if(yoffs > h-middle)
+ content = vs.translateCS(box, CONTENT_KEY, 0, -h + boxwh[1]);
+ else
+ content = vs.translateCS(box, CONTENT_KEY, 0, -yoffs + middle);
+
+ br.put(vs, content);
+
+ if(pos >= 0) {
+ int cursor = vs.orthoCS(content, CURSOR_KEY, -1,
+ xoffs, yoffs0,
+ 1, line_height);
+ vs.map.put(cursorVob, cursor);
+ }
}
protected HChain getChain(Cell c, float scale) {
String s = Containment.getContainedText(c);
+ return getChain(s, scale);
+ }
+
+ protected HChain getChain(String s, float scale) {
if (s == null) s = "";
HChain ch = new LinebreakableChain();
@@ -124,6 +162,7 @@
addVobs(s, ch, last, pos, scale);
if(pos == br) {
+ ch.addBox(new HBox.Null(1));
ch.addBreak();
pos++;
}
Index: gzz/gzz/view/LollipopCellView.java
diff -u gzz/gzz/view/LollipopCellView.java:1.8
gzz/gzz/view/LollipopCellView.java:1.9
--- gzz/gzz/view/LollipopCellView.java:1.8 Thu Dec 12 04:42:20 2002
+++ gzz/gzz/view/LollipopCellView.java Sat Dec 28 21:01:41 2002
@@ -33,12 +33,17 @@
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Shape;
import java.util.*;
/** A factory for making ball-and-stick aka lollipop cell vobs. */
public class LollipopCellView extends BoxCellView {
-public static final String rcsid = "$Id: LollipopCellView.java,v 1.8
2002/12/12 09:42:20 humppake Exp $";
+public static final String rcsid = "$Id: LollipopCellView.java,v 1.9
2002/12/29 02:01:41 benja Exp $";
+ public static boolean dbg = false;
+ private static void pa(String s) { System.err.println(s); }
+
float[] boxwh = new float[2];
public LollipopCellView(CellView ccv) {
@@ -94,7 +99,48 @@
*/
final int ballBox = vs.scaleCS(box, "ball", diameter, diameter);
- ccv.place(c, vs, contentBox, context);
+ GraphicsAPI api = GraphicsAPI.getInstance();
+ if(api instanceof gzz.client.awt.AWTAPI) {
+ final Shape[] clipshape = new Shape[1];
+ vs.map.put(new Vob() {
+ public void render(Graphics g, boolean fast,
+ Vob.RenderInfo info1,
+ Vob.RenderInfo info2) {
+ clipshape[0] = g.getClip();
+ info2.getExtRect(rect);
+ if(LollipopCellView.this.dbg)
+ pa("Clip: "+rect+" -- was: "+clipshape[0]);
+ g.clipRect(rect.x, rect.y,
+ rect.width, rect.height);
+ }
+ }, contentBox, box);
+ int unclip_cs = vs.translateCS(contentBox, UNCLIP, 0, 0);
+ ccv.place(c, vs, contentBox, context);
+ vs.map.put(new Vob() {
+ public void render(Graphics g, boolean fast,
+ Vob.RenderInfo info1,
+ Vob.RenderInfo info2) {
+ if(LollipopCellView.this.dbg) pa("Unclip:
"+clipshape[0]);
+ g.setClip(clipshape[0]);
+ }
+ }, unclip_cs);
+ } else if(api instanceof gzz.client.gl.GLAPI) {
+ gzz.gfx.gl.Stencil.drawStenciled(
+ vs,
+ new Runnable() { public void run() {
+ vs.map.put(bg, box);
+ }},
+ null,
+ null,
+ new Runnable() { public void run() {
+ ccv.place(c, vs, contentBox, context);
+ }},
+ false
+ );
+ } else {
+ throw new Error("Unsupported API: "+api);
+ }
+
vs.map.put(bg, ballBox);
}
}
Index: gzz/gzz/vob/linebreaking/HBox.java
diff -u gzz/gzz/vob/linebreaking/HBox.java:1.3
gzz/gzz/vob/linebreaking/HBox.java:1.4
--- gzz/gzz/vob/linebreaking/HBox.java:1.3 Mon Nov 25 06:15:16 2002
+++ gzz/gzz/vob/linebreaking/HBox.java Sat Dec 28 21:01:41 2002
@@ -33,7 +33,7 @@
*/
public interface HBox {
-String rcsid = "$Id: HBox.java,v 1.3 2002/11/25 11:15:16 humppake Exp $";
+String rcsid = "$Id: HBox.java,v 1.4 2002/12/29 02:01:41 benja Exp $";
float getWidth(float scale);
@@ -63,6 +63,17 @@
*/
void place(VobScene vs, int coordsys, float scale);
+ /** Get this box's length in characters or other units.
+ * <code>getX(i)</code> is valid for
+ * <code>i < getLength()</code>.
+ */
+ int getLength();
+
+ /** Get the position after a unit (e.g. character)
+ * inside this HBox.
+ */
+ float getX(int i, float scale) throws IndexOutOfBoundsException;
+
/** The key for this HBox. XXX */
Object getKey();
@@ -73,15 +84,25 @@
void setPrev(HBox b);
class Null implements HBox {
+ protected int length;
+ public Null() { this(0); }
+ public Null(int length) { this.length = length; }
+
public float getWidth(float scale) { return 0; }
public float getHeight(float scale) { return 0; }
public float getDepth(float scale) { return 0; }
public void place(VobScene vs, int coordsys, float scale) {}
+ public int getLength() { return length; }
+ public float getX(int i, float scale) {
+ if(i<0 || i>length) throw new IndexOutOfBoundsException(""+i);
+ return 0;
+ }
public Object getKey() { return null; }
public void setPrev(HBox b) { }
}
public Object WH_KEY = new Object();
+
/** A useful base class for hboxes that are vobs.
* The second coordsys will contain the width and height for this vob.
*/
@@ -101,6 +122,14 @@
int cs_scale = vs.scaleCS(box, "textbox", h, h);
vs.map.put(this, cs_scale);
}
+
+ public int getLength() { return 1; }
+ public float getX(int i, float scale) {
+ if(i < 0 || i > 1) throw new IndexOutOfBoundsException(""+i);
+ if(i == 0) return 0;
+ else return getWidth(scale);
+ }
+
public Object getKey() { return null; /* XXX */ }
public void setPrev(HBox b) { }
Index: gzz/gzz/vob/linebreaking/HBroken.java
diff -u gzz/gzz/vob/linebreaking/HBroken.java:1.2
gzz/gzz/vob/linebreaking/HBroken.java:1.3
--- gzz/gzz/vob/linebreaking/HBroken.java:1.2 Thu Nov 21 22:55:20 2002
+++ gzz/gzz/vob/linebreaking/HBroken.java Sat Dec 28 21:01:41 2002
@@ -92,17 +92,93 @@
}
}
+ /** Get the ith line start/end-- counting
+ * the beginning and end of the chain.
+ */
+ protected int getLineDivision(int i) {
+ if(i == 0)
+ return 0;
+ else if(i <= length)
+ return breaks[i-1];
+ else
+ return chain.length();
+ }
+
public float getHeight() {
+ return getLineOffset(length);
+ }
+
+ /** Get the Y position under a given line.
+ * If line < 0, return 0.
+ */
+ public float getLineOffset(int line) {
+ if(line < 0) return 0;
+
float h = 0;
- if(length > 0) {
- h += chain.getHeight(0, breaks[0], scale);
- for(int i=1; i<length; i++)
- h += chain.getHeight(breaks[i-1], breaks[i], scale);
- h += chain.getHeight(breaks[length-1], chain.length(), scale);
- } else {
- h = chain.getHeight(0, chain.length(), scale);
- }
+ if(line > length) throw new IndexOutOfBoundsException(""+line);
+
+ for(int i=0; i<=line; i++)
+ h += chain.getHeight(getLineDivision(i),
+ getLineDivision(i+1), scale);
return h;
+ }
+
+ /** Get the number of lines.
+ */
+ public int getLineCount() {
+ return length+1;
+ }
+
+ public float getLineWidth(int line) {
+ if(line >= (length+1))
+ throw new IndexOutOfBoundsException(line+"; line count is "+
+ (length+1));
+
+ float result = 0;
+ int start = getLineDivision(line),
+ end = getLineDivision(line+1);
+
+ for(int i=start; i<end; i++)
+ result += chain.getBox(i).getWidth(scale);
+
+ return result;
+ }
+
+ /** Get the line a given character is at.
+ * Additionally, if passed an array
+ * as the second parameter, return
+ * the x offset before the character.
+ * Passing a pos one more than the last
+ * character is valid.
+ */
+ public int getLine(int pos, float[] xoffs) {
+ int i=0, n=0;
+ while(true) {
+ if(i >= chain.length()) {
+ if(xoffs != null) {
+ xoffs[0] = getLineWidth(length);
+ }
+ return length;
+ }
+
+ int l = chain.getBox(i).getLength();
+ if(n+l > pos) break;
+ n += l;
+ i++;
+ }
+
+ int line=0;
+ while(getLineDivision(line+1) <= i) line++;
+
+ if(xoffs != null) {
+ xoffs[0] = 0;
+ for(int j=getLineDivision(line); j<i; j++)
+ xoffs[0] += chain.getBox(j).getWidth(scale);
+
+ xoffs[0] += chain.getBox(i).getX(pos-n, scale);
+ }
+
+ return line;
}
}
Index: gzz/gzz/vob/linebreaking/HChain.java
diff -u gzz/gzz/vob/linebreaking/HChain.java:1.1
gzz/gzz/vob/linebreaking/HChain.java:1.2
--- gzz/gzz/vob/linebreaking/HChain.java:1.1 Fri Nov 1 20:23:46 2002
+++ gzz/gzz/vob/linebreaking/HChain.java Sat Dec 28 21:01:41 2002
@@ -60,6 +60,10 @@
* not one created by the line breaker. Line breakers should use
* <code>HBroken</code> to represent linebroken versions of an
* <code>HChain</code>.
+ * <p>
+ * Breaks don't have a 'length' in characters like
+ * HBoxes do. You may want to use a HBox.Null to represent
+ * the break character.
*/
void addBreak();
Index: gzz/gzz/vob/vobs/TextVob.java
diff -u gzz/gzz/vob/vobs/TextVob.java:1.6 gzz/gzz/vob/vobs/TextVob.java:1.7
--- gzz/gzz/vob/vobs/TextVob.java:1.6 Thu Dec 5 05:57:34 2002
+++ gzz/gzz/vob/vobs/TextVob.java Sat Dec 28 21:01:41 2002
@@ -48,7 +48,7 @@
* XXX Diagram!
*/
public class TextVob extends HBox.VobHBox {
-String rcsid = "$Id: TextVob.java,v 1.6 2002/12/05 10:57:34 tjl Exp $";
+String rcsid = "$Id: TextVob.java,v 1.7 2002/12/29 02:01:41 benja Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
@@ -200,6 +200,10 @@
public float getHeight(float scale) { return style.getAscent(scale); }
public float getDepth(float scale) { return style.getDescent(scale); }
+ public int getLength() { return text.length(); }
+ public float getX(int i, float scale) {
+ return style.getWidth(text.substring(0, i), scale);
+ }
public void setPrev(HBox b) { }
public void setPosition(int depth, int x, int y, int w, int h) { }
Index: gzz/lava/gzz/storm/IndexedPool.java
diff -u gzz/lava/gzz/storm/IndexedPool.java:1.5
gzz/lava/gzz/storm/IndexedPool.java:1.6
--- gzz/lava/gzz/storm/IndexedPool.java:1.5 Sun Dec 22 22:20:58 2002
+++ gzz/lava/gzz/storm/IndexedPool.java Sat Dec 28 21:01:41 2002
@@ -62,15 +62,15 @@
void setDB(DB db);
Index getIndex();
- Class getIndexType();
+ String getIndexTypeURI();
}
/** Get the Index object for a given IndexType.
* Equivalent to <code>(Index)getIndices().get(type)</code>.
*/
- Index getIndex(Class type);
+ Index getIndex(String typeURI);
- /** Return a mapping from <code>IndexType</code>s
+ /** Return a mapping from index type URIs
* to <code>Index</code> objects. This map
* cannot be modified.
*/
@@ -79,7 +79,7 @@
/** A convenience method to get a <code>Pointer</code> instance
* for this pool. This is defined always to return this:
* <pre>
- * ((PointerIndex)getIndex(Pointer.PointerIndex.class)).getPointer(uri)
+ * ((PointerIndex)getIndex(Pointer.pointerIndexURI)).getPointer(uri)
* </pre>
*/
Pointer getPointer(String uri);
Index: gzz/lava/gzz/storm/Pointer.java
diff -u gzz/lava/gzz/storm/Pointer.java:1.2 gzz/lava/gzz/storm/Pointer.java:1.3
--- gzz/lava/gzz/storm/Pointer.java:1.2 Sun Dec 22 22:20:58 2002
+++ gzz/lava/gzz/storm/Pointer.java Sat Dec 28 21:01:41 2002
@@ -66,6 +66,10 @@
throws IOException;
+ /** The URI identifying the pointer application of Storm indexing.
+ */
+ String pointerIndexURI = "urn:urn-5:Y15xnzrC4wWfm-YWnziE8aH3d3pR";
+
/** XXX
* You generally don't want to use this interface, even though you can;
* it is much more convenient to call
<code>IndexedPool.getPointer()</code>.
Index: gzz/lava/gzz/storm/impl/AbstractPool.java
diff -u gzz/lava/gzz/storm/impl/AbstractPool.java:1.4
gzz/lava/gzz/storm/impl/AbstractPool.java:1.5
--- gzz/lava/gzz/storm/impl/AbstractPool.java:1.4 Sun Nov 24 11:02:19 2002
+++ gzz/lava/gzz/storm/impl/AbstractPool.java Sat Dec 28 21:01:41 2002
@@ -26,11 +26,41 @@
import java.io.*;
import java.util.*;
-/** An abstract implementation of StormPool.
- * Currently, this doesn't actually implement any methods itself--
- * however, it contains two non-static inner classes.
+/** An abstract implementation of <code>IndexedPool</code>.
*/
public abstract class AbstractPool implements StormPool {
+
+ /***** IndexedPool stuff
+ protected Set indexers;
+ protected Map indices;
+ protected AsyncMap indexCache;
+ protected Map dbs;
+
+ public AbstractPool(Set indexers, AsyncMap indexCache) {
+ this.indexers = indexers;
+ this.indexCache = indexCache;
+
+ Map indices = new HashMap();
+ this.indices = Collections.unmodifyableMap(indices);
+ this.dbs = new HashSet();
+
+ for(Iterator i=indexers.iterator(); i.hasNext();) {
+ Indexer x = (Indexer)i.next();
+
+ String uri = x.getIndexTypeURI();
+ indices.put(uri, x.getIndex());
+ }
+ }
+
+ public Map getIndices() { return indices; }
+
+ public Index getIndex(String indexTypeURI) {
+ return (Index)getIndices().get(indexTypeURI);
+
+ public Pointer getPointer(String uri) {
+ return
((PointerIndex)getIndex(Pointer.pointerIndexURI)).getPointer(uri);
+ }
+ ************/
/**
* <code>block</code> must be set by <code>close()</code>.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz gzz/client/awt/AWTScreen.java gzz/client/aw...,
Benja Fallenstein <=