Fills clipped area starting at xx,yy. Area must be surrounded with
replacement (or clip)
@param xx
@param yy
@param clip
@param replacement
325995
public void floodFill(int xx, int yy, Rectangle clip, int replacement)
    {
        floodFill(xx, yy, clip, (c)->c!=replacement, replacement);
    }
980718
public void setShift(double x, double y) {
		xx = 1;
		xy = 0;
		xd = x;
		yx = 0;
		yy = 1;
		yd = y;
	}
729903
public void clip() {
        int x = (int) (projection.canvas.getWidth() * projection.canvas.margin);
        int y = (int) (projection.canvas.getHeight() * projection.canvas.margin);
        int w = (int) (projection.canvas.getWidth() * (1 - 2 * projection.canvas.margin));
        int h = (int) (projection.canvas.getHeight() * (1 - 2 * projection.canvas.margin));
        originalClip = g2d.getClip();
        g2d.clipRect(x, y, w, h);
    }
982302
public void replace(TLVElement childToBeReplaced, TLVElement newChild) {
        for (int i = 0; i < children.size(); i++) {
            if (children.get(i).equals(childToBeReplaced)) {
                children.set(i, newChild);
                return;
            }
        }
    }
1271994
public static void setContnent(String content) {
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        try {
            StringSelection selection = new StringSelection( content );
            clipboard.setContents(selection, selection);
        } catch (Exception ex) {
            //noop
        }
    }
1218366
public synchronized void replace(final BioPAXElement existing, final BioPAXElement replacement) 
	{
		 ModelUtils.replace(this, Collections.singletonMap(existing, replacement));
		 remove(existing);
		 if(replacement != null)
			 add(replacement);
	}
457926
function clippingRectangle($x1, $y1, $width, $height)
    {
        $this->save();
        $this->addContent(sprintf("\n%.3F %.3F %.3F %.3F re W n", $x1, $y1, $width, $height));
    }
761072
function (clip) {
    var width = this.getUnscaledWidth();
    var height = this.getUnscaledHeight();
    this.draw(clip);
    this.lastClip = clip;
    this.invalid = false;
  }
31296
public void replace (String... replace)
    {
        HashSet<String> toAdd = Sets.newHashSet();
        Iterator<String> i = _imports.iterator();
        while (i.hasNext()) {
            String name = i.next();
            for (int j = 0; j < replace.length; j += 2) {
                if (name.equals(replace[j])) {
                    toAdd.add(replace[j + 1]);
                    i.remove();
                    break;
                }
            }
        }
        _imports.addAll(toAdd);
    }
1294610
private static void replaceOrAppend(Element oldElement, Element newElement) {
    assert oldElement != null && newElement != null;

    if (matchesTags(oldElement, appendingTags)) {
      GQuery.$(oldElement).html("").append(newElement);
    } else {
      GQuery.$(oldElement).replaceWith(newElement);

      // copy class
      String c = oldElement.getClassName();
      if (!c.isEmpty()) {
        newElement.addClassName(c);
      }
      // copy id
      newElement.setId(oldElement.getId());
      // ensure no duplicate id
      oldElement.setId("");
    }
  }
796978
public void clipAbsoluteBounds(Rectangle clip)
    {
        Rectangle inter = absbounds.intersection(clip);
        if (inter.width == 0 && inter.height == 0)
            displayed = false;
        else
            absbounds = inter;
    }
811858
public void setClip(Rectangle2D clip) {
        xMin = clip.getX();
        xMax = xMin + clip.getWidth();
        yMin = clip.getY();
        yMax = yMin + clip.getHeight();
    }
928220
public void intersect (Area area) {
        if (area == null) {
            return;
        } else if (isEmpty() || area.isEmpty()) {
            reset();
            return;
        }

        if (isPolygonal() && area.isPolygonal()) {
            intersectPolygon(area);
        } else {
            intersectCurvePolygon(area);
        }

        if (areaBoundsSquare() < GeometryUtil.EPSILON) {
            reset();
        }
    }
1018226
public final void addEdge(double x1, double y1, double x2, double y2) {
		if (y1 == y2)
			return;
			
		int dir = 1;
		if (y1 > y2) {
			double temp;
			temp = x1; x1 = x2; x2 = temp;
			temp = y1; y1 = y2; y2 = temp;
			dir = -1;
		}
		
		if (y2 < 0 || y1 >= height_)
			return;

		if (x1 < 0 && x2 < 0)
		{
			x1 = -1; x2 = -1;
		}
		else if (x1 >= width_ && x2 >= width_)
		{
			x1 = width_; x2 = width_;
		}
		
		//clip to extent
		double dxdy = (x2 - x1) / (y2 - y1);

		if (y2 > height_) {
			y2 = height_;
			x2 = dxdy * (y2 - y1) + x1;
		}
		
		if (y1 < 0) {
			x1 = dxdy * (0 - y1) + x1;
			y1 = 0;
		}

		//do not clip x unless it is too small or too big
		int bigX = Math.max(width_ + 1, 0x7fffff);
		if (x1 < -0x7fffff) {
		    //from earlier logic, x2 >= -1, therefore dxdy is not 0
			y1 = (0 - x1) / dxdy + y1;
			x1 = 0;
		}
		else if (x1 > bigX) {
			//from earlier logic, x2 <= width_, therefore dxdy is not 0
			y1 = (width_ - x1) / dxdy + y1;
			x1 = width_;
		}

		if (x2 < -0x7fffff) {
			//from earlier logic, x1 >= -1, therefore dxdy is not 0
			y2 = (0 - x1) / dxdy + y1;
			x2 = 0;
		}
		else if (x2 > bigX) {
			//from earlier logic, x1 <= width_, therefore dxdy is not 0
			y2 = (width_ - x1) / dxdy + y1;
			x2 = width_;
		}
		
		int ystart = (int)y1;
		int yend = (int)y2;
		if (ystart == yend)
			return;
		
		Edge e = new Edge();
		
		e.x = (long)(x1 * 4294967296.0);
		e.y = ystart;
		e.ymax = yend;
		e.dxdy = (long)(dxdy * 4294967296.0);
		e.dir = dir;
		
		if (ySortedEdges_ == null) {
			ySortedEdges_ = new Edge[height_];
		}

		e.next = ySortedEdges_[e.y];
		ySortedEdges_[e.y] = e;
		
		if (e.y < minY_)
			minY_ = e.y;
		
		if (e.ymax > maxY_)
			maxY_ = e.ymax;
		
		numEdges_++;
	}
1010311
public static void copyToClipboard(String content) {
        if (content == null) {
            return;
        }
        Clipboard cb = null;
        try {
            cb = new Clipboard(Display.getDefault());
            cb.setContents(new String[] { content }, new TextTransfer[] { TextTransfer.getInstance() });
        } finally {
            if (cb != null) {
                cb.dispose();
            }
        }
    }
223126
public static void replace(final StringBuffer sb, final String find, final String replacement) {
		int pos = 0;
		while(pos<sb.length()) {
			pos = sb.indexOf(find, pos);
			if(pos==-1) break;
			sb.replace(pos, pos+find.length(), replacement);
			pos += replacement.length();
		}
	}
807574
private String stringReplace(String text, String target, String replacement) {
		return Pattern.compile(target.toString(), Pattern.LITERAL).matcher(
				text).replaceAll(replacement);
	}