rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
boolean active = false;
|
boolean insideClip = false; boolean insideShape = false;
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
if (active)
|
if (edge.y1 <= (y + (subY / (double) AA_SAMPLING))) continue; if (insideClip && insideShape)
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false;
|
int left = x0 - (int) minX; int right = x1 - (int) minX + 1; alpha[left]++; alpha[right]--; leftX = Math.min(x0, leftX); rightX = Math.max(x1+2, rightX); emptyScanline = false;
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
{ if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { previous = edge; active = true; } }
|
insideShape = ! insideShape;
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx);
|
if (! emptyScanline) fillScanlineAA(alpha, leftX, (int) y, rightX - leftX, pCtx, (int) minX);
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint);
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
|
return new FontRenderContext(new AffineTransform(), false, false);
|
return new FontRenderContext(transform, false, true);
|
public FontRenderContext getFontRenderContext() { //return new FontRenderContext(transform, false, false); return new FontRenderContext(new AffineTransform(), false, false); }
|
destinationRaster = getDestinationRaster();
|
protected void init() { setPaint(Color.BLACK); setFont(new Font("SansSerif", Font.PLAIN, 12)); isOptimized = true; // FIXME: Should not be necessary. A clip of null should mean // 'clip against device bounds. clip = getDeviceBounds(); destinationRaster = getDestinationRaster(); }
|
|
int dy = y1 - y0; int dx = x1 - x0; int stepx, stepy; if (dy < 0) { dy = -dy; stepy = -1;
|
draw(new Line2D.Float(x0, y0, x1, y1));
|
protected void rawDrawLine(int x0, int y0, int x1, int y1) { // This is an implementation of Bresenham's line drawing algorithm. int dy = y1 - y0; int dx = x1 - x0; int stepx, stepy; if (dy < 0) { dy = -dy; stepy = -1; } else { stepy = 1; } if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; } dy <<= 1; dx <<= 1; drawPixel(x0, y0); if (dx > dy) { int fraction = dy - (dx >> 1); // same as 2*dy - dx while (x0 != x1) { if (fraction >= 0) { y0 += stepy; fraction -= dx; } x0 += stepx; fraction += dy; drawPixel(x0, y0); } } else { int fraction = dx - (dy >> 1); while (y0 != y1) { if (fraction >= 0) { x0 += stepx; fraction -= dy; } y0 += stepy; fraction += dx; drawPixel(x0, y0); } } }
|
else { stepy = 1; } if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; } dy <<= 1; dx <<= 1; drawPixel(x0, y0); if (dx > dy) { int fraction = dy - (dx >> 1); while (x0 != x1) { if (fraction >= 0) { y0 += stepy; fraction -= dx; } x0 += stepx; fraction += dy; drawPixel(x0, y0); } } else { int fraction = dx - (dy >> 1); while (y0 != y1) { if (fraction >= 0) { x0 += stepx; fraction -= dy; } y0 += stepy; fraction += dx; drawPixel(x0, y0); } } }
|
protected void rawDrawLine(int x0, int y0, int x1, int y1) { // This is an implementation of Bresenham's line drawing algorithm. int dy = y1 - y0; int dx = x1 - x0; int stepx, stepy; if (dy < 0) { dy = -dy; stepy = -1; } else { stepy = 1; } if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; } dy <<= 1; dx <<= 1; drawPixel(x0, y0); if (dx > dy) { int fraction = dy - (dx >> 1); // same as 2*dy - dx while (x0 != x1) { if (fraction >= 0) { y0 += stepy; fraction -= dx; } x0 += stepx; fraction += dy; drawPixel(x0, y0); } } else { int fraction = dx - (dy >> 1); while (y0 != y1) { if (fraction >= 0) { x0 += stepx; fraction -= dy; } y0 += stepy; fraction += dx; drawPixel(x0, y0); } } }
|
|
int x2 = x + w; int y2 = y + h; for (int xc = x; xc < x2; xc++) { for (int yc = y; yc < y2; yc++) { drawPixel(xc, yc); } }
|
fill(new Rectangle(x, y, w, h));
|
protected void rawFillRect(int x, int y, int w, int h) { int x2 = x + w; int y2 = y + h; for (int xc = x; xc < x2; xc++) { for (int yc = y; yc < y2; yc++) { drawPixel(xc, yc); } } }
|
clipTransform.scale(-scaleX, -scaleY);
|
clipTransform.scale(1 / scaleX, 1 / scaleY);
|
public void scale(double scaleX, double scaleY) { transform.scale(scaleX, scaleY); if (clip != null) { AffineTransform clipTransform = new AffineTransform(); clipTransform.scale(-scaleX, -scaleY); updateClip(clipTransform); } updateOptimization(); }
|
rawSetForeground((Color) paint);
|
public void setPaint(Paint p) { if (p != null) { paint = p; if (! (paint instanceof Color)) isOptimized = false; else { updateOptimization(); rawSetForeground((Color) paint); } } }
|
|
public Area(Shape s)
|
public Area()
|
public Area(Shape s) { this(); Vector p = makeSegment(s); // empty path if (p == null) return; // delete empty paths for (int i = 0; i < p.size(); i++) if (((Segment) p.elementAt(i)).getSignedArea() == 0.0) p.remove(i--); /* * Resolve self intersecting paths into non-intersecting * solids and holes. * Algorithm is as follows: * 1: Create nodes at all self intersections * 2: Put all segments into a list * 3: Grab a segment, follow it, change direction at each node, * removing segments from the list in the process * 4: Repeat (3) until no segments remain in the list * 5: Remove redundant paths and sort into solids and holes */ Vector paths = new Vector(); Segment v; for (int i = 0; i < p.size(); i++) { Segment path = (Segment) p.elementAt(i); createNodesSelf(path); } if (p.size() > 1) { for (int i = 0; i < p.size() - 1; i++) for (int j = i + 1; j < p.size(); j++) { Segment path1 = (Segment) p.elementAt(i); Segment path2 = (Segment) p.elementAt(j); createNodes(path1, path2); } } // we have intersecting points. Vector segments = new Vector(); for (int i = 0; i < p.size(); i++) { Segment path = v = (Segment) p.elementAt(i); do { segments.add(v); v = v.next; } while (v != path); } paths = weilerAtherton(segments); deleteRedundantPaths(paths); }
|
this(); Vector p = makeSegment(s); if (p == null) return; for (int i = 0; i < p.size(); i++) if (((Segment) p.elementAt(i)).getSignedArea() == 0.0) p.remove(i--); Vector paths = new Vector(); Segment v; for (int i = 0; i < p.size(); i++) { Segment path = (Segment) p.elementAt(i); createNodesSelf(path); } if (p.size() > 1) { for (int i = 0; i < p.size() - 1; i++) for (int j = i + 1; j < p.size(); j++) { Segment path1 = (Segment) p.elementAt(i); Segment path2 = (Segment) p.elementAt(j); createNodes(path1, path2); } } Vector segments = new Vector(); for (int i = 0; i < p.size(); i++) { Segment path = v = (Segment) p.elementAt(i); do { segments.add(v); v = v.next; } while (v != path); } paths = weilerAtherton(segments); deleteRedundantPaths(paths);
|
solids = new Vector(); holes = new Vector();
|
public Area(Shape s) { this(); Vector p = makeSegment(s); // empty path if (p == null) return; // delete empty paths for (int i = 0; i < p.size(); i++) if (((Segment) p.elementAt(i)).getSignedArea() == 0.0) p.remove(i--); /* * Resolve self intersecting paths into non-intersecting * solids and holes. * Algorithm is as follows: * 1: Create nodes at all self intersections * 2: Put all segments into a list * 3: Grab a segment, follow it, change direction at each node, * removing segments from the list in the process * 4: Repeat (3) until no segments remain in the list * 5: Remove redundant paths and sort into solids and holes */ Vector paths = new Vector(); Segment v; for (int i = 0; i < p.size(); i++) { Segment path = (Segment) p.elementAt(i); createNodesSelf(path); } if (p.size() > 1) { for (int i = 0; i < p.size() - 1; i++) for (int j = i + 1; j < p.size(); j++) { Segment path1 = (Segment) p.elementAt(i); Segment path2 = (Segment) p.elementAt(j); createNodes(path1, path2); } } // we have intersecting points. Vector segments = new Vector(); for (int i = 0; i < p.size(); i++) { Segment path = v = (Segment) p.elementAt(i); do { segments.add(v); v = v.next; } while (v != path); } paths = weilerAtherton(segments); deleteRedundantPaths(paths); }
|
public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i)
|
public GlyphVector createGlyphVector (FontRenderContext ctx, String str)
|
public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i){ return peer.createGlyphVector (this, ctx, i);}
|
return peer.createGlyphVector (this, ctx, i);
|
return peer.createGlyphVector (this, ctx, new StringCharacterIterator (str));
|
public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i){ return peer.createGlyphVector (this, ctx, i);}
|
PolyEdge(double x0, double y0, double x1, double y1)
|
PolyEdge(double x0, double y0, double x1, double y1, boolean clip)
|
PolyEdge(double x0, double y0, double x1, double y1) { if (y0 < y1) { this.x0 = x0; this.y0 = y0; this.x1 = x1; this.y1 = y1; } else { this.x0 = x1; this.y0 = y1; this.x1 = x0; this.y1 = y0; } slope = (this.x1 - this.x0) / (this.y1 - this.y0); if (this.y0 == this.y1) // Horizontal edge. xIntersection = Math.min(this.x0, this.x1); else xIntersection = this.x0 + slope * (Math.ceil(this.y0) - this.y0); }
|
isClip = clip;
|
PolyEdge(double x0, double y0, double x1, double y1) { if (y0 < y1) { this.x0 = x0; this.y0 = y0; this.x1 = x1; this.y1 = y1; } else { this.x0 = x1; this.y0 = y1; this.x1 = x0; this.y1 = y0; } slope = (this.x1 - this.x0) / (this.y1 - this.y0); if (this.y0 == this.y1) // Horizontal edge. xIntersection = Math.min(this.x0, this.x1); else xIntersection = this.x0 + slope * (Math.ceil(this.y0) - this.y0); }
|
|
public FontRenderContext (AffineTransform tx, boolean isAntiAliased, boolean usesFractionalMetrics)
|
protected FontRenderContext()
|
public FontRenderContext (AffineTransform tx, boolean isAntiAliased, boolean usesFractionalMetrics) { if (tx != null && !tx.isIdentity ()) { this.affineTransform = new AffineTransform (tx); } this.isAntiAliased = isAntiAliased; this.usesFractionalMetrics = usesFractionalMetrics; }
|
if (tx != null && !tx.isIdentity ()) { this.affineTransform = new AffineTransform (tx); } this.isAntiAliased = isAntiAliased; this.usesFractionalMetrics = usesFractionalMetrics;
|
public FontRenderContext (AffineTransform tx, boolean isAntiAliased, boolean usesFractionalMetrics) { if (tx != null && !tx.isIdentity ()) { this.affineTransform = new AffineTransform (tx); } this.isAntiAliased = isAntiAliased; this.usesFractionalMetrics = usesFractionalMetrics; }
|
|
{
|
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new WhenNode(test.clone(stylesheet)); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
|
|
}
|
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new WhenNode(test.clone(stylesheet)); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
|
|
{
|
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { Object ret = test.evaluate(context, pos, len); boolean success = (ret instanceof Boolean) ? ((Boolean) ret).booleanValue() : Expr._boolean(context, ret); if (success) { if (children != null) { children.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } else { if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } }
|
|
}
|
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { Object ret = test.evaluate(context, pos, len); boolean success = (ret instanceof Boolean) ? ((Boolean) ret).booleanValue() : Expr._boolean(context, ret); if (success) { if (children != null) { children.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } else { if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } }
|
|
{
|
public boolean references(QName var) { if (test != null && test.references(var)) { return true; } return super.references(var); }
|
|
}
|
public boolean references(QName var) { if (test != null && test.references(var)) { return true; } return super.references(var); }
|
|
StringBuffer buf = new StringBuffer(getClass().getName());
|
StringBuffer buf = new StringBuffer("when");
|
public String toString() { StringBuffer buf = new StringBuffer(getClass().getName()); buf.append('['); buf.append("test="); buf.append(test); buf.append(']'); return buf.toString(); }
|
}
|
public void insertUpdate(DocumentEvent event) { int dot = getDot(); setDot(dot + event.getLength()); }
|
|
else if (policy == NEVER_UPDATE) { int docLength = event.getDocument().getLength(); if (getDot() > docLength) setDot(docLength); } }
|
public void removeUpdate(DocumentEvent event) { int dot = getDot(); setDot(dot - event.getLength()); }
|
|
if (!(event.getButton() == MouseEvent.BUTTON1)) return; setDot(textComponent.viewToModel(event.getPoint()));
|
public void mousePressed(MouseEvent event) { // FIXME: Implement this properly. }
|
|
if (textComponent != null) textComponent.repaint();
|
textComponent.repaint(this);
|
protected final void repaint() { // FIXME: Is this good? This possibly causes alot of the component // hierarchy to be repainted on every caret blink. if (textComponent != null) textComponent.repaint(); }
|
}
|
public void setVisible(boolean v) { visible = v; repaint(); }
|
|
public CannotProceedHolder(CannotProceed initialValue)
|
public CannotProceedHolder()
|
public CannotProceedHolder(CannotProceed initialValue) { value = initialValue; }
|
value = initialValue;
|
public CannotProceedHolder(CannotProceed initialValue) { value = initialValue; }
|
|
ShortSeqHolder h = new ShortSeqHolder(); h._read(input); return h.value;
|
short[] value = new short[ input.read_long() ]; input.read_short_array(value, 0, value.length); return value;
|
public static short[] read(InputStream input) { ShortSeqHolder h = new ShortSeqHolder(); h._read(input); return h.value; }
|
ShortSeqHolder h = new ShortSeqHolder(value); h._write(output);
|
output.write_long(value.length); output.write_short_array(value, 0, value.length);
|
public static void write(OutputStream output, short[] value) { ShortSeqHolder h = new ShortSeqHolder(value); h._write(output); }
|
if (y < 0) y = Integer.MAX_VALUE;
|
public Dimension maximumLayoutSize(Container parent) { if (parent != container) throw new AWTError("invalid parent"); Insets insets = parent.getInsets(); int x = insets.left + insets.right; int y = insets.top + insets.bottom; Component[] children = parent.getComponents(); if (isHorizontalIn(parent)) { // sum up preferred widths of components, find maximum of preferred // heights for (int index = 0; index < children.length; index++) { Component comp = children[index]; Dimension sz = comp.getMaximumSize(); x += sz.width; y = Math.max(y, sz.height); } } else { // sum up preferred heights of components, find maximum of // preferred widths for (int index = 0; index < children.length; index++) { Component comp = children[index]; Dimension sz = comp.getMaximumSize(); y += sz.height; x = Math.max(x, sz.width); } } return new Dimension(x, y); }
|
|
arrowIcon.paintIcon(m, g, vr.width - width + defaultTextIconGap, vr.y + 2);
|
int offset = (vr.height - height) / 2; arrowIcon.paintIcon(m, g, vr.width - width, vr.y + offset);
|
protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { JMenuItem m = (JMenuItem) c; Rectangle tr = new Rectangle(); // text rectangle Rectangle ir = new Rectangle(); // icon rectangle Rectangle vr = new Rectangle(); // view rectangle Rectangle br = new Rectangle(); // border rectangle Rectangle ar = new Rectangle(); // accelerator rectangle Rectangle cr = new Rectangle(); // checkIcon rectangle int vertAlign = m.getVerticalAlignment(); int horAlign = m.getHorizontalAlignment(); int vertTextPos = m.getVerticalTextPosition(); int horTextPos = m.getHorizontalTextPosition(); Font f = m.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); SwingUtilities.calculateInnerArea(m, br); SwingUtilities.calculateInsetArea(br, m.getInsets(), vr); paintBackground(g, m, m.getBackground()); /* * MenuItems insets are equal to menuItems margin, space between text and * menuItems border. We need to paint insets region as well. */ Insets insets = m.getInsets(); br.x -= insets.left; br.y -= insets.top; br.width += insets.right + insets.left; br.height += insets.top + insets.bottom; // Menu item is considered to be highlighted when it is selected. // But we don't want to paint the background of JCheckBoxMenuItems if ((m.isSelected() && checkIcon == null) || m.getModel().isArmed() && (m.getParent() instanceof MenuElement)) { if (m.isContentAreaFilled()) { g.setColor(selectionBackground); g.fillRect(br.x, br.y, br.width, br.height); } } else { if (m.isContentAreaFilled()) { g.setColor(m.getBackground()); g.fillRect(br.x, br.y, br.width, br.height); } } // If this menu item is a JCheckBoxMenuItem then paint check icon if (checkIcon != null) { SwingUtilities.layoutCompoundLabel(m, fm, null, checkIcon, vertAlign, horAlign, vertTextPos, horTextPos, vr, cr, tr, defaultTextIconGap); checkIcon.paintIcon(m, g, cr.x, cr.y); // We need to calculate position of the menu text and position of // user menu icon if there exists one relative to the check icon. // So we need to adjust view rectangle s.t. its starting point is at // checkIcon.width + defaultTextIconGap. vr.x = cr.x + cr.width + defaultTextIconGap; } // if this is a submenu, then paint arrow icon to indicate it. if (arrowIcon != null && (c instanceof JMenu)) { if (!((JMenu) c).isTopLevelMenu()) { int width = arrowIcon.getIconWidth(); int height = arrowIcon.getIconHeight(); arrowIcon.paintIcon(m, g, vr.width - width + defaultTextIconGap, vr.y + 2); } } // paint text and user menu icon if it exists Icon i = m.getIcon(); SwingUtilities.layoutCompoundLabel(c, fm, m.getText(), i, vertAlign, horAlign, vertTextPos, horTextPos, vr, ir, tr, defaultTextIconGap); if (i != null) i.paintIcon(c, g, ir.x, ir.y); paintText(g, m, tr, m.getText()); // paint accelerator String acceleratorText = ""; if (m.getAccelerator() != null) { acceleratorText = getAcceleratorText(m.getAccelerator()); fm = g.getFontMetrics(acceleratorFont); ar.width = fm.stringWidth(acceleratorText); ar.x = br.width - ar.width; vr.x = br.width - ar.width - defaultTextIconGap; SwingUtilities.layoutCompoundLabel(m, fm, acceleratorText, null, vertAlign, horAlign, vertTextPos, horTextPos, vr, ir, ar, defaultTextIconGap); paintAccelerator(g, m, ar, acceleratorText); } }
|
public boolean isContentAreaFilled() { return false; }
|
public boolean isContentAreaFilled() { return content_area_filled; }
|
public boolean isContentAreaFilled() { // Checks whether the "content area" of the button should be filled. return false; }
|
} else { frameActions.show(frame.getDesktopPane(), event.getX(), event.getY());
|
} else { Point p = FrameWrapper.this.getLocationOnScreen(); int h = frameActions.getPreferredSize().height; frameActions.show(frame.getDesktopPane(), p.x, p.y - h);
|
public FrameWrapper(JInternalFrame iFrame) { this.frame = iFrame; this.setText(iFrame.getTitle()); this.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { JInternalFrame frame = FrameWrapper.this.frame; frame.setIcon(false); frame.getDesktopPane().setSelectedFrame(frame); } catch (PropertyVetoException ex) { //igonre } } }); this.frame.addInternalFrameListener(new InternalFrameListener() { public void internalFrameActivated(InternalFrameEvent event) { FrameWrapper.this.setBackground(Color.WHITE); } public void internalFrameClosed(InternalFrameEvent event) { remove(FrameWrapper.this); revalidate(); repaint(); } public void internalFrameClosing(InternalFrameEvent event) { remove(FrameWrapper.this); revalidate(); repaint(); } public void internalFrameDeactivated(InternalFrameEvent event) { FrameWrapper.this.setBackground(Color.LIGHT_GRAY); } public void internalFrameDeiconified(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } public void internalFrameIconified(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } public void internalFrameOpened(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } }); final JPopupMenu frameActions = new JPopupMenu(); JMenuItem minimize = new JMenuItem("Minimize"); frameActions.add(minimize); minimize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setIcon(true); }catch(PropertyVetoException e){ //ignore } } }); JMenuItem maximize = new JMenuItem("Maximize"); frameActions.add(maximize); maximize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setMaximum(true); }catch(PropertyVetoException e){ //ignore } } }); JMenuItem close = new JMenuItem("Close"); frameActions.add(close); close.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setClosed(true); }catch(PropertyVetoException e){ //ignore } } }); this.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (frameActions .isShowing()) { frameActions .setVisible(false); } else { frameActions.show(frame.getDesktopPane(), event.getX(), event.getY()); } } } }); }
|
} else { frameActions.show(frame.getDesktopPane(), event.getX(), event.getY());
|
} else { Point p = FrameWrapper.this.getLocationOnScreen(); int h = frameActions.getPreferredSize().height; frameActions.show(frame.getDesktopPane(), p.x, p.y - h);
|
public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (frameActions .isShowing()) { frameActions .setVisible(false); } else { frameActions.show(frame.getDesktopPane(), event.getX(), event.getY()); } } }
|
throws NotImplementedException
|
public BufferCapabilities getBufferCapabilities() { throw new Error("not implemented"); }
|
|
throws NotImplementedException
|
public ImageCapabilities getImageCapabilities() { throw new Error("not implemented"); }
|
|
throw new CertificateException("not implemented");
|
return certFacSpi.engineGenerateCertPath(inStream);
|
public final CertPath generateCertPath(InputStream inStream) throws CertificateException { throw new CertificateException("not implemented"); }
|
if (undo != null) event.addEdit(undo);
|
public void insertString(int offset, String text, AttributeSet attributes) throws BadLocationException { // Just return when no text to insert was given. if (text == null || text.length() == 0) return; DefaultDocumentEvent event = new DefaultDocumentEvent(offset, text.length(), DocumentEvent.EventType.INSERT); writeLock(); UndoableEdit undo = content.insertString(offset, text); insertUpdate(event, attributes); writeUnlock(); fireInsertUpdate(event); if (undo != null) fireUndoableEditUpdate(new UndoableEditEvent(this, undo)); }
|
|
public Icon getPressedIcon() { return pressed_button; }
|
public Icon getPressedIcon() { return pressed_icon; }
|
public Icon getPressedIcon() { return pressed_button; }
|
Icon getRolloverSelectedIcon() { return null; }
|
public Icon getRolloverSelectedIcon() { return rollover_selected_icon; }
|
Icon getRolloverSelectedIcon() { // Returns the rollover selection icon for the button. return null; }
|
public Icon getRolloverIcon() { return null; }
|
public Icon getRolloverIcon() { return rollover_icon; }
|
public Icon getRolloverIcon() { // Returns the rollover icon for the button. return null; }
|
Icon getSelectedIcon() { return selected_button; }
|
public Icon getSelectedIcon() { return selected_icon; }
|
Icon getSelectedIcon() { // Returns the selected icon for the button. return selected_button; }
|
public Icon getDisabledSelectedIcon() { return disabled_selected_button; }
|
public Icon getDisabledSelectedIcon() { return disabled_selected_icon; }
|
public Icon getDisabledSelectedIcon() { //Returns the icon used by the button when it's disabled and selected. return disabled_selected_button; }
|
public Icon getDisabledIcon() { return disabled_button; }
|
public Icon getDisabledIcon() { return disabled_icon; }
|
public Icon getDisabledIcon() { return disabled_button; }
|
public void addChangeListener(ChangeListener l) { getModel().addChangeListener(l); }
|
public void addChangeListener(ChangeListener l) { listenerList.add(ChangeListener.class, l); }
|
public void addChangeListener(ChangeListener l) { getModel().addChangeListener(l); }
|
public void removeChangeListener(ChangeListener l) { getModel().removeChangeListener(l); }
|
public void removeChangeListener(ChangeListener l) { listenerList.remove(ChangeListener.class, l); }
|
public void removeChangeListener(ChangeListener l) { getModel().removeChangeListener(l); }
|
public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb, gnuPOA a_poa
|
public gnuServantObject(String[] a_repository_ids, byte[] an_id, gnuPOA a_poa, ORB_1_4 an_orb
|
public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb, gnuPOA a_poa ) { Id = an_id; setServant(a_servant); poa = a_poa; if (poa != null) { manager = poa.the_POAManager(); } else { manager = null; } repository_ids = null; orb = an_orb; }
|
setServant(a_servant);
|
manager = a_poa.the_POAManager();
|
public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb, gnuPOA a_poa ) { Id = an_id; setServant(a_servant); poa = a_poa; if (poa != null) { manager = poa.the_POAManager(); } else { manager = null; } repository_ids = null; orb = an_orb; }
|
if (poa != null) { manager = poa.the_POAManager(); } else { manager = null; } repository_ids = null;
|
public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb, gnuPOA a_poa ) { Id = an_id; setServant(a_servant); poa = a_poa; if (poa != null) { manager = poa.the_POAManager(); } else { manager = null; } repository_ids = null; orb = an_orb; }
|
|
noRetain = poa.applies(ServantRetentionPolicyValue.NON_RETAIN);
|
public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb, gnuPOA a_poa ) { Id = an_id; setServant(a_servant); poa = a_poa; if (poa != null) { manager = poa.the_POAManager(); } else { manager = null; } repository_ids = null; orb = an_orb; }
|
|
this.lo = (insens = ins) ? Character.toLowerCase(lo) : lo; this.hi = ins ? Character.toLowerCase(hi) : hi;
|
insens = ins; this.lo = lo; this.hi = hi;
|
RETokenRange(int subIndex, char lo, char hi, boolean ins) { super(subIndex); this.lo = (insens = ins) ? Character.toLowerCase(lo) : lo; this.hi = ins ? Character.toLowerCase(hi) : hi; }
|
if (insens) c = Character.toLowerCase(c); if ((c >= lo) && (c <= hi)) {
|
boolean matches = (c >= lo) && (c <= hi); if (! matches && insens) { char c1 = Character.toLowerCase(c); matches = (c1 >= lo) && (c1 <= hi); if (!matches) { c1 = Character.toUpperCase(c); matches = (c1 >= lo) && (c1 <= hi); } } if (matches) {
|
boolean match(CharIndexed input, REMatch mymatch) { char c = input.charAt(mymatch.index); if (c == CharIndexed.OUT_OF_BOUNDS) return false; if (insens) c = Character.toLowerCase(c); if ((c >= lo) && (c <= hi)) { ++mymatch.index; return next(input, mymatch); } return false; }
|
public void characters (char buf [], int offset, int len)
|
public void characters(char[] buf, int offset, int len)
|
public void characters (char buf [], int offset, int len) throws SAXException { docHandler.characters (buf, offset, len); }
|
public void ignorableWhitespace (char buf [], int offset, int len)
|
public void ignorableWhitespace(char[] buf, int offset, int len)
|
public void ignorableWhitespace (char buf [], int offset, int len) throws SAXException { docHandler.ignorableWhitespace (buf, offset, len); }
|
try { if (baseURI == null) {
|
try { if (baseURI == null && XmlParser.uriWarnings) {
|
String absolutize (String baseURI, String systemId, boolean nice) throws MalformedURLException, SAXException { // FIXME normalize system IDs -- when? // - Convert to UTF-8 // - Map reserved and non-ASCII characters to %HH try { if (baseURI == null) { warn ("No base URI; hope this SYSTEM id is absolute: " + systemId); return new URL (systemId).toString (); } else return new URL (new URL (baseURI), systemId).toString (); } catch (MalformedURLException e) { // Let unknown URI schemes pass through unless we need // the JVM to map them to i/o streams for us... if (!nice) throw e; // sometimes sysids for notations or unparsed entities // aren't really URIs... warn ("Can't absolutize SYSTEM id: " + e.getMessage ()); return systemId; } }
|
return new URL (systemId).toString (); } else return new URL (new URL (baseURI), systemId).toString (); } catch (MalformedURLException e) {
|
return new URL(systemId).toString(); } else { return new URL(new URL(baseURI), systemId).toString(); } } catch (MalformedURLException e) {
|
String absolutize (String baseURI, String systemId, boolean nice) throws MalformedURLException, SAXException { // FIXME normalize system IDs -- when? // - Convert to UTF-8 // - Map reserved and non-ASCII characters to %HH try { if (baseURI == null) { warn ("No base URI; hope this SYSTEM id is absolute: " + systemId); return new URL (systemId).toString (); } else return new URL (new URL (baseURI), systemId).toString (); } catch (MalformedURLException e) { // Let unknown URI schemes pass through unless we need // the JVM to map them to i/o streams for us... if (!nice) throw e; // sometimes sysids for notations or unparsed entities // aren't really URIs... warn ("Can't absolutize SYSTEM id: " + e.getMessage ()); return systemId; } }
|
prefixStack.pushContext ();
|
{ prefixStack.pushContext(); }
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
|
if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value);
|
if (stringInterning) { if ("xmlns" == qname) { declarePrefix("", value);
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
|
fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: "
|
{ fatal("missing prefix " + "in namespace declaration attribute"); } if (value.length() == 0) { verror("missing URI in namespace declaration attribute: "
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
|
} else declarePrefix (prefix, value);
|
} else { declarePrefix(prefix, value); }
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
|
} else { if ("xmlns".equals(qname)) { declarePrefix ("", value);
|
} } else { if ("xmlns".equals(qname)) { declarePrefix("", value);
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
|
void charData (char ch[], int start, int length)
|
void charData(char[] ch, int start, int length)
|
void charData (char ch[], int start, int length) throws SAXException { contentHandler.characters (ch, start, length); }
|
void comment (char ch[], int start, int length)
|
void comment(char[] ch, int start, int length)
|
void comment (char ch[], int start, int length) throws SAXException { if (lexicalHandler != base) lexicalHandler.comment (ch, start, length); }
|
lexicalHandler.comment (ch, start, length);
|
{ lexicalHandler.comment(ch, start, length); }
|
void comment (char ch[], int start, int length) throws SAXException { if (lexicalHandler != base) lexicalHandler.comment (ch, start, length); }
|
if (index < 1 && uri.length () != 0) warn ("relative URI for namespace: " + uri);
|
if (index < 1 && uri.length() != 0) { warn("relative URI for namespace: " + uri); }
|
private void declarePrefix (String prefix, String uri) throws SAXException { int index = uri.indexOf (':'); // many versions of nwalsh docbook stylesheets // have bogus URLs; so this can't be an error... if (index < 1 && uri.length () != 0) warn ("relative URI for namespace: " + uri); // FIXME: char [0] must be ascii alpha; chars [1..index] // must be ascii alphanumeric or in "+-." [RFC 2396] //Namespace Constraints //name for xml prefix must be http://www.w3.org/XML/1998/namespace boolean prefixEquality = prefix.equals("xml"); boolean uriEquality = uri.equals("http://www.w3.org/XML/1998/namespace"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) fatal ("xml is by definition bound to the namespace name " + "http://www.w3.org/XML/1998/namespace"); //xmlns prefix declaration is illegal but xml prefix declaration is llegal... if (prefixEquality && uriEquality) return; //name for xmlns prefix must be http://www.w3.org/2000/xmlns/ prefixEquality = prefix.equals("xmlns"); uriEquality = uri.equals("http://www.w3.org/2000/xmlns/"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) fatal("http://www.w3.org/2000/xmlns/ is by definition bound" + " to prefix xmlns"); //even if the uri is http://www.w3.org/2000/xmlns/ it is illegal to declare it if (prefixEquality && uriEquality) fatal ("declaring the xmlns prefix is illegal"); uri = uri.intern (); prefixStack.declarePrefix (prefix, uri); contentHandler.startPrefixMapping (prefix, uri); }
|
fatal ("xml is by definition bound to the namespace name " +
|
{ fatal("xml is by definition bound to the namespace name " +
|
private void declarePrefix (String prefix, String uri) throws SAXException { int index = uri.indexOf (':'); // many versions of nwalsh docbook stylesheets // have bogus URLs; so this can't be an error... if (index < 1 && uri.length () != 0) warn ("relative URI for namespace: " + uri); // FIXME: char [0] must be ascii alpha; chars [1..index] // must be ascii alphanumeric or in "+-." [RFC 2396] //Namespace Constraints //name for xml prefix must be http://www.w3.org/XML/1998/namespace boolean prefixEquality = prefix.equals("xml"); boolean uriEquality = uri.equals("http://www.w3.org/XML/1998/namespace"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) fatal ("xml is by definition bound to the namespace name " + "http://www.w3.org/XML/1998/namespace"); //xmlns prefix declaration is illegal but xml prefix declaration is llegal... if (prefixEquality && uriEquality) return; //name for xmlns prefix must be http://www.w3.org/2000/xmlns/ prefixEquality = prefix.equals("xmlns"); uriEquality = uri.equals("http://www.w3.org/2000/xmlns/"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) fatal("http://www.w3.org/2000/xmlns/ is by definition bound" + " to prefix xmlns"); //even if the uri is http://www.w3.org/2000/xmlns/ it is illegal to declare it if (prefixEquality && uriEquality) fatal ("declaring the xmlns prefix is illegal"); uri = uri.intern (); prefixStack.declarePrefix (prefix, uri); contentHandler.startPrefixMapping (prefix, uri); }
|
while (prefixes.hasMoreElements ()) handler.endPrefixMapping ((String) prefixes.nextElement ()); prefixStack.popContext ();
|
while (prefixes.hasMoreElements()) { handler.endPrefixMapping((String) prefixes.nextElement()); } prefixStack.popContext();
|
void endElement (String elname) throws SAXException { ContentHandler handler = contentHandler; if (!namespaces) { handler.endElement ("", "", elname); return; } prefixStack.processName (elname, nsTemp, false); handler.endElement (nsTemp [0], nsTemp [1], elname); Enumeration prefixes = prefixStack.getDeclaredPrefixes (); while (prefixes.hasMoreElements ()) handler.endPrefixMapping ((String) prefixes.nextElement ()); prefixStack.popContext (); }
|
if (!"[document]".equals (name)) lexicalHandler.endEntity (name); entityStack.pop ();
|
if (!"[document]".equals(name)) { lexicalHandler.endEntity(name); } entityStack.pop();
|
void endExternalEntity (String name) throws SAXException { if (!"[document]".equals (name)) lexicalHandler.endEntity (name); entityStack.pop (); }
|
return contentHandler == base ? null : contentHandler;
|
return (contentHandler == base) ? null : contentHandler;
|
public ContentHandler getContentHandler () { return contentHandler == base ? null : contentHandler; }
|
public ErrorHandler getErrorHandler () { return errorHandler == base ? null : errorHandler; }
|
public ErrorHandler getErrorHandler() { return (errorHandler == base) ? null : errorHandler; }
|
public ErrorHandler getErrorHandler () { return errorHandler == base ? null : errorHandler; }
|
return resolver2.getExternalSubset (name, baseURI);
|
} return resolver2.getExternalSubset(name, baseURI);
|
InputSource getExternalSubset (String name, String baseURI) throws SAXException, IOException { if (resolver2 == null || !useResolver2 || !extPE) return null; return resolver2.getExternalSubset (name, baseURI); }
|
if ((FEATURE + "validation").equals (featureId))
|
if ((FEATURE + "validation").equals(featureId)) {
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
if ((FEATURE + "external-general-entities").equals (featureId))
|
if ((FEATURE + "external-general-entities").equals(featureId)) {
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
if ((FEATURE + "external-parameter-entities") .equals (featureId))
|
} if ((FEATURE + "external-parameter-entities").equals(featureId)) {
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
if ((FEATURE + "namespace-prefixes").equals (featureId))
|
if ((FEATURE + "namespace-prefixes").equals(featureId)) {
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
if ((FEATURE + "namespaces").equals (featureId))
|
if ((FEATURE + "namespaces").equals(featureId)) {
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId))
|
if ((FEATURE + "lexical-handler/parameter-entities").equals(featureId)) {
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
if ((FEATURE + "string-interning").equals (featureId))
|
if ((FEATURE + "string-interning").equals(featureId)) {
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
if ((FEATURE + "use-attributes2").equals (featureId))
|
if ((FEATURE + "use-attributes2").equals(featureId)) {
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
throw new SAXNotSupportedException (featureId); return parser.isStandalone ();
|
{ throw new SAXNotSupportedException(featureId); } return parser.isStandalone();
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
if ((FEATURE + "resolve-dtd-uris").equals (featureId))
|
if ((FEATURE + "resolve-dtd-uris").equals(featureId)) {
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
if ((FEATURE + "use-entity-resolver2").equals (featureId))
|
if ((FEATURE + "use-entity-resolver2").equals(featureId)) {
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
for (int i = 0; i < length; i++) { if (!getURI (i).equals (uri))
|
for (int i = 0; i < length; i++) { if (!getURI(i).equals(uri)) {
|
public int getIndex (String uri, String local) { int length = getLength (); for (int i = 0; i < length; i++) { if (!getURI (i).equals (uri)) continue; if (getLocalName (i).equals (local)) return i; } return -1; }
|
if (getLocalName (i).equals (local))
|
} if (getLocalName(i).equals(local)) {
|
public int getIndex (String uri, String local) { int length = getLength (); for (int i = 0; i < length; i++) { if (!getURI (i).equals (uri)) continue; if (getLocalName (i).equals (local)) return i; } return -1; }
|
}
|
public int getIndex (String uri, String local) { int length = getLength (); for (int i = 0; i < length; i++) { if (!getURI (i).equals (uri)) continue; if (getLocalName (i).equals (local)) return i; } return -1; }
|
|
public String getLocalName (int index)
|
public String getLocalName(int index) { if (index < 0 || index >= attributesList.size())
|
public String getLocalName (int index) { Attribute attr = (Attribute) attributesList.get (index); // FIXME attr.localName is sometimes null, why? if (namespaces && attr.localName == null) { // XXX fix this here for now int ci = attr.name.indexOf(':'); attr.localName = (ci == -1) ? attr.name : attr.name.substring(ci + 1); } return attr.localName; }
|
Attribute attr = (Attribute) attributesList.get (index);
|
return null; } Attribute attr = (Attribute) attributesList.get(index);
|
public String getLocalName (int index) { Attribute attr = (Attribute) attributesList.get (index); // FIXME attr.localName is sometimes null, why? if (namespaces && attr.localName == null) { // XXX fix this here for now int ci = attr.name.indexOf(':'); attr.localName = (ci == -1) ? attr.name : attr.name.substring(ci + 1); } return attr.localName; }
|
return attr.localName;
|
return (attr.localName == null) ? "" : attr.localName;
|
public String getLocalName (int index) { Attribute attr = (Attribute) attributesList.get (index); // FIXME attr.localName is sometimes null, why? if (namespaces && attr.localName == null) { // XXX fix this here for now int ci = attr.name.indexOf(':'); attr.localName = (ci == -1) ? attr.name : attr.name.substring(ci + 1); } return attr.localName; }
|
public String getName (int i)
|
public String getName(int index)
|
public String getName (int i) { return ((Attribute) attributesList.get (i)).name; }
|
return ((Attribute) attributesList.get (i)).name;
|
return getQName(index);
|
public String getName (int i) { return ((Attribute) attributesList.get (i)).name; }
|
if ((PROPERTY + "declaration-handler").equals (propertyId)) return declHandler == base ? null : declHandler;
|
if ((PROPERTY + "declaration-handler").equals(propertyId)) { return (declHandler == base) ? null : declHandler; }
|
public Object getProperty (String propertyId) throws SAXNotRecognizedException { if ((PROPERTY + "declaration-handler").equals (propertyId)) return declHandler == base ? null : declHandler; if ((PROPERTY + "lexical-handler").equals (propertyId)) return lexicalHandler == base ? null : lexicalHandler; // unknown properties throw new SAXNotRecognizedException (propertyId); }
|
if ((PROPERTY + "lexical-handler").equals (propertyId)) return lexicalHandler == base ? null : lexicalHandler;
|
if ((PROPERTY + "lexical-handler").equals(propertyId)) { return (lexicalHandler == base) ? null : lexicalHandler; }
|
public Object getProperty (String propertyId) throws SAXNotRecognizedException { if ((PROPERTY + "declaration-handler").equals (propertyId)) return declHandler == base ? null : declHandler; if ((PROPERTY + "lexical-handler").equals (propertyId)) return lexicalHandler == base ? null : lexicalHandler; // unknown properties throw new SAXNotRecognizedException (propertyId); }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.