Fills clipped area. Area must be surrounded with
replacement (or clip)
@param clip
@param isInside
@param replacement
540339
public void fill(Rectangle clip, IntBiPredicate isInside, int replacement)
    {
        fill(clip.x, clip.y, clip.x+clip.width, clip.y+clip.height, isInside, (x,y)->replacement);
    }
708237
public void setClipping(double[] min, double[] max) {
    // if only one dimension was given, expand to all dimensions.
    if(min.length == 1 && max.length == 1) {
      if(min[0] >= max[0]) {
        throw new AbortException("Clipping range empty.");
      }
      clipmin = new double[dim];
      clipmax = new double[dim];
      Arrays.fill(clipmin, min[0]);
      Arrays.fill(clipmax, max[0]);
      return;
    }
    if(dim != min.length) {
      throw new AbortException("Clipping double[] dimensionalities do not match: " + dim + " vs. " + min.length);
    }
    if(dim != max.length) {
      throw new AbortException("Clipping double[] dimensionalities do not match: " + dim + " vs. " + max.length);
    }
    for(int i = 0; i < dim; i++) {
      if(min[i] >= max[i]) {
        throw new AbortException("Clipping range empty in dimension " + (i + 1));
      }
    }
    clipmin = min;
    clipmax = max;
  }
371673
@Override
  public void replace(List list, String resourceVersion) {
    lock.writeLock().lock();
    try {
      Set<String> keys = new HashSet<>();
      for (Object obj : list) {
        String key = this.keyOf(obj);
        keys.add(key);
        this.queueActionLocked(DeltaType.Sync, obj);
      }

      if (this.knownObjects == null) {
        for (Map.Entry<String, Deque<MutablePair<DeltaType, Object>>> entry :
            this.items.entrySet()) {
          if (keys.contains(entry.getKey())) {
            continue;
          }

          Object deletedObj = null;
          MutablePair<DeltaType, Object> delta = entry.getValue().peekLast(); // get newest
          if (delta != null) {
            deletedObj = delta.getRight();
          }
          this.queueActionLocked(
              DeltaType.Deleted, new DeletedFinalStateUnknown(entry.getKey(), deletedObj));
        }

        if (!this.populated) {
          this.populated = true;
          this.initialPopulationCount = list.size();
        }
        return;
      }

      // Detect deletions not already in the queue.
      List<String> knownKeys = this.knownObjects.listKeys();
      int queueDeletion = 0;
      for (String knownKey : knownKeys) {
        if (keys.contains(knownKey)) {
          continue;
        }

        Object deletedObj = this.knownObjects.getByKey(knownKey);
        if (deletedObj == null) {
          log.warn(
              "Key {} does not exist in known objects store, placing DeleteFinalStateUnknown marker without object",
              knownKey);
        }
        queueDeletion++;
        this.queueActionLocked(
            DeltaType.Deleted, new DeletedFinalStateUnknown<>(knownKey, deletedObj));
      }

      if (!this.populated) {
        this.populated = true;
        this.initialPopulationCount = list.size() + queueDeletion;
      }
    } finally {
      lock.writeLock().unlock();
    }
  }
330677
public void clip(final long pX0, final long pY0, final long pX1, final long pY1) {
        if (!mPathMode) {
            if (isOnTheSameSideOut(pX0, pY0, pX1, pY1)) {
                return;
            }
        }
        if (isInClipArea(pX0, pY0)) {
            if (isInClipArea(pX1, pY1)) {
                nextVertex(pX0, pY0);
                nextVertex(pX1, pY1);
                return;
            }
            if (intersection(pX0, pY0, pX1, pY1)) {
                nextVertex(pX0, pY0);
                nextVertex(mOptimIntersection.x, mOptimIntersection.y);
                if (mPathMode) {
                    nextVertex(clipX(pX1), clipY(pY1));
                }
                return;
            }
            throw new RuntimeException("Cannot find expected mOptimIntersection for " + new RectL(pX0, pY0, pX1, pY1));
        }
        if (isInClipArea(pX1, pY1)) {
            if (intersection(pX0, pY0, pX1, pY1)) {
                if (mPathMode) {
                    nextVertex(clipX(pX0), clipY(pY0));
                }
                nextVertex(mOptimIntersection.x, mOptimIntersection.y);
                nextVertex(pX1, pY1);
                return;
            }
            throw new RuntimeException("Cannot find expected mOptimIntersection for " + new RectL(pX0, pY0, pX1, pY1));
        }
        // no point is on the screen
        int count = 0;
        if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMin, mXMin, mYMax)) { // x mClipMin segment
            final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
            point.set(mOptimIntersection);
        }
        if (intersection(pX0, pY0, pX1, pY1, mXMax, mYMin, mXMax, mYMax)) { // x mClipMax segment
            final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
            point.set(mOptimIntersection);
        }
        if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMin, mXMax, mYMin)) { // y mClipMin segment
            final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
            point.set(mOptimIntersection);
        }
        if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMax, mXMax, mYMax)) { // y mClipMax segment
            final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
            point.set(mOptimIntersection);
        }
        if (count == 2) {
            final double distance1 = Distance.getSquaredDistanceToPoint(
                    mOptimIntersection1.x, mOptimIntersection1.y, pX0, pY0);
            final double distance2 = Distance.getSquaredDistanceToPoint(
                    mOptimIntersection2.x, mOptimIntersection2.y, pX0, pY0);
            final PointL start = distance1 < distance2 ? mOptimIntersection1 : mOptimIntersection2;
            final PointL end =  distance1 < distance2 ? mOptimIntersection2 : mOptimIntersection1;
            if (mPathMode) {
                nextVertex(clipX(pX0), clipY(pY0));
            }
            nextVertex(start.x, start.y);
            nextVertex(end.x, end.y);
            if (mPathMode) {
                nextVertex(clipX(pX1), clipY(pY1));
            }
            return;
        }
        if (count == 1) {
            if (mPathMode) {
                nextVertex(clipX(pX0), clipY(pY0));
                nextVertex(mOptimIntersection1.x, mOptimIntersection1.y);
                nextVertex(clipX(pX1), clipY(pY1));
            }
            return;
        }
        if (count == 0) {
            if (mPathMode) {
                nextVertex(clipX(pX0), clipY(pY0));
                final int corner = getClosestCorner(pX0, pY0, pX1, pY1);
                nextVertex(cornerX[corner], cornerY[corner]);
                nextVertex(clipX(pX1), clipY(pY1));
            }
            return;
        }
        throw new RuntimeException("Impossible mOptimIntersection count (" + count + ")");
    }
516282
protected void replaceEntry(T oldEntry, T newEntry) {
        T prev = oldEntry.getPrev();
        T next = newEntry.getNext();
        if (prev != null) {
            prev.setNext(newEntry);
        } else {
            head = newEntry;
        }
        if (next != null) {
            next.setPrev(newEntry);
        } else {
            last = newEntry;
        }
    }
28333
function( clip, optionalRoot ) {

		var action = this.existingAction( clip, optionalRoot );

		if ( action !== null ) {

			this._deactivateAction( action );
			this._removeInactiveAction( action );

		}

	}
242623
public void insertBefore(final AbstractInsnNode location,
            final AbstractInsnNode insn) {
        ++size;
        AbstractInsnNode prev = location.prev;
        if (prev == null) {
            first = insn;
        } else {
            prev.next = insn;
        }
        location.prev = insn;
        insn.next = location;
        insn.prev = prev;
        cache = null;
        insn.index = 0; // insn now belongs to an InsnList
    }
593017
@Override
    public ReplaceDeploymentPlanBuilder andReplace(String toReplace) {
        String newContentKey = getAddedContentKey();
        return replace(newContentKey, toReplace);
    }
456003
private void initReplacer(Map<String, String> replacer, String tableName, String fieldName) {

        replacer.clear();
        replacer.put(REPLACEMENT_TABLENAME, tableName);
        replacer.put(REPLACEMENT_FIELD_NAME, fieldName);
    }
191633
private boolean areaAreaPredicates_(int half_edge, int id_a, int id_b) {
		boolean bRelationKnown = true;

		if (m_perform_predicates[MatrixPredicate.InteriorInterior]) {
			interiorAreaInteriorArea_(half_edge, id_a, id_b);
			bRelationKnown &= isPredicateKnown_(
					MatrixPredicate.InteriorInterior);
		}

		if (m_perform_predicates[MatrixPredicate.InteriorBoundary]) {
			interiorAreaBoundaryArea_(half_edge, id_a,
					MatrixPredicate.InteriorBoundary);
			bRelationKnown &= isPredicateKnown_(
					MatrixPredicate.InteriorBoundary);
		}

		if (m_perform_predicates[MatrixPredicate.InteriorExterior]) {
			interiorAreaExteriorArea_(half_edge, id_a, id_b,
					MatrixPredicate.InteriorExterior);
			bRelationKnown &= isPredicateKnown_(
					MatrixPredicate.InteriorExterior);
		}

		if (m_perform_predicates[MatrixPredicate.BoundaryInterior]) {
			interiorAreaBoundaryArea_(half_edge, id_b,
					MatrixPredicate.BoundaryInterior);
			bRelationKnown &= isPredicateKnown_(
					MatrixPredicate.BoundaryInterior);
		}

		if (m_perform_predicates[MatrixPredicate.BoundaryBoundary]) {
			boundaryAreaBoundaryArea_(half_edge, id_a, id_b);
			bRelationKnown &= isPredicateKnown_(
					MatrixPredicate.BoundaryBoundary);
		}

		if (m_perform_predicates[MatrixPredicate.BoundaryExterior]) {
			boundaryAreaExteriorArea_(half_edge, id_a, id_b,
					MatrixPredicate.BoundaryExterior);
			bRelationKnown &= isPredicateKnown_(
					MatrixPredicate.BoundaryExterior);
		}

		if (m_perform_predicates[MatrixPredicate.ExteriorInterior]) {
			interiorAreaExteriorArea_(half_edge, id_b, id_a,
					MatrixPredicate.ExteriorInterior);
			bRelationKnown &= isPredicateKnown_(
					MatrixPredicate.ExteriorInterior);
		}

		if (m_perform_predicates[MatrixPredicate.ExteriorBoundary]) {
			boundaryAreaExteriorArea_(half_edge, id_b, id_a,
					MatrixPredicate.ExteriorBoundary);
			bRelationKnown &= isPredicateKnown_(
					MatrixPredicate.ExteriorBoundary);
		}

		return bRelationKnown;
	}
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);
	}
254900
public static void replaceIsElement(HTMLElement context, String identifier, IsElement newElement) {
        replaceElement(context, identifier, newElement.element());
    }
1253681
public StringGrabber replaceEnclosedIn(String startToken, String endToken, String replacement) {

		StringCropper cropper = getCropper();

		final List<StrPosition> stringEnclosedInWithDetails = cropper.getStringEnclosedInWithDetails(sb.toString(), startToken, endToken);

		final List<Integer> splitList = new ArrayList<Integer>();

		for (StrPosition sp : stringEnclosedInWithDetails) {

			int splitPointFirst = sp.startIndex - 1;
			int splitPointSecond = sp.endIndex;

			splitList.add(splitPointFirst);
			splitList.add(splitPointSecond);
		}

		final Integer[] splitIndexes = splitList.toArray(new Integer[] {});

		List<String> splitStringList = cropper.splitByIndex(sb.toString(), splitIndexes);

		final StringBuilder tempSb = new StringBuilder();

		final int strNum = splitStringList.size();

		boolean nextIsValue = false;

		int countOfReplacement = 0;

		for (int i = 0; i < strNum; i++) {

			String strPart = splitStringList.get(i);

			if (nextIsValue) {
				// position to add into replacement
				tempSb.append(replacement);

				countOfReplacement++;

				if (strPart.startsWith(endToken)) {
					// is string Blank
					tempSb.append(strPart);
				}

			} else {
				tempSb.append(strPart);
			}

			if (strPart.endsWith(startToken)) {
				nextIsValue = true;
			} else {
				nextIsValue = false;
			}

		}

		sb = tempSb;

		return StringGrabber.this;

	}
794967
public MultiChangeBuilder<PS, SEG, S> insert(int position, StyledDocument<PS, SEG, S> document) {
        return replace(position, position, document);
    }
811858
public void setClip(Rectangle2D clip) {
        xMin = clip.getX();
        xMax = xMin + clip.getWidth();
        yMin = clip.getY();
        yMax = yMin + clip.getHeight();
    }
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);
    }
761072
function (clip) {
    var width = this.getUnscaledWidth();
    var height = this.getUnscaledHeight();
    this.draw(clip);
    this.lastClip = clip;
    this.invalid = false;
  }