Checks if this segment would be a smooth segment following the previous
558430
def is_smooth_from(self, previous):
        """"""
        if isinstance(previous, QuadraticBezier):
            return (self.start == previous.end and
                    (self.control - self.start) == (previous.end - previous.control))
        else:
            return self.control == self.start
642985
def run_friedman_smooth(x, y, span):
    """"""
    N = len(x)
    weight = numpy.ones(N)
    results = numpy.zeros(N)
    residuals = numpy.zeros(N)
    mace.smooth(x, y, weight, span, 1, 1e-7, results, residuals)
    return results, residuals
1220615
def _removeSegment(self, segment, preserveCurve, **kwargs):
        
        segment = self.segments[segment]
        for point in segment.points:
            self.removePoint(point, preserveCurve)
1105687
function isBackwards(sel) {
	sel = sel || getSelection();
	if (isCollapsed(sel)) { return; }

	// Detect if selection is backwards
	var range = doc.createRange();
	range.setStart(sel.anchorNode, sel.anchorOffset);
	range.setEnd(sel.focusNode, sel.focusOffset);
	range.detach();

	// if `collapsed` then it's backwards
	return range.collapsed;
}
1166489
public synchronized Segment nextSegment() {
    assertOpen();
    Segment lastSegment = lastSegment();
    SegmentDescriptor descriptor = SegmentDescriptor.builder()
      .withId(lastSegment != null ? lastSegment.descriptor().id() + 1 : 1)
      .withVersion(1)
      .withIndex(currentSegment.lastIndex() + 1)
      .withMaxSegmentSize(storage.maxSegmentSize())
      .withMaxEntries(storage.maxEntriesPerSegment())
      .build();
    descriptor.lock();

    currentSegment = createSegment(descriptor);

    segments.put(descriptor.index(), currentSegment);
    return currentSegment;
  }
472512
private boolean previousSegment() {
        assert(state == State.ITER_CHECK_BWD);
        // The input text [(iter index)..limit[ passes the FCD check.
        pos = iter.getIndex();
        // Collect the characters being checked, in case they need to be normalized.
        if(s == null) {
            s = new StringBuilder();
        } else {
            s.setLength(0);
        }
        int nextCC = 0;
        for(;;) {
            // Fetch the previous character and its fcd16 value.
            int c = iter.previousCodePoint();
            if(c < 0) { break; }
            int fcd16 = nfcImpl.getFCD16(c);
            int trailCC = fcd16 & 0xff;
            if(trailCC == 0 && s.length() != 0) {
                // FCD boundary after this character.
                iter.nextCodePoint();
                break;
            }
            s.appendCodePoint(c);
            if(trailCC != 0 && ((nextCC != 0 && trailCC > nextCC) ||
                                CollationFCD.isFCD16OfTibetanCompositeVowel(fcd16))) {
                // Fails FCD check. Find the previous FCD boundary and normalize.
                while(fcd16 > 0xff) {
                    c = iter.previousCodePoint();
                    if(c < 0) { break; }
                    fcd16 = nfcImpl.getFCD16(c);
                    if(fcd16 == 0) {
                        iter.nextCodePoint();
                        break;
                    }
                    s.appendCodePoint(c);
                }
                s.reverse();
                normalize(s);
                limit = pos;
                start = pos - s.length();
                state = State.IN_NORM_ITER_AT_START;
                pos = normalized.length();
                return true;
            }
            nextCC = fcd16 >> 8;
            if(nextCC == 0) {
                // FCD boundary before the following character.
                break;
            }
        }
        start = pos - s.length();
        assert(pos != start);
        iter.moveIndex(s.length());
        state = State.ITER_IN_FCD_SEGMENT;
        return true;
    }
1315194
boolean lookForwardLineFeedAndEof() {
		int forwardBak = forward;
		int forwardRowBak = forwardRow;
		for (char c=peek(); true; c=next()) {
			if (CharTable.isBlank(c)) {
				continue ;
			}
			if (c == '\n' || c == EOF) {
				return true;
			}
			forward = forwardBak;
			forwardRow = forwardRowBak;
			return false;
		}
	}
1274805
private static boolean polylineWithinEnvelope_(Polyline polyline_a,
			Envelope envelope_b, double tolerance,
			ProgressTracker progress_tracker) {
		Envelope2D env_a = new Envelope2D(), env_b = new Envelope2D();
		polyline_a.queryEnvelope2D(env_a);
		envelope_b.queryEnvelope2D(env_b);

		if (!envelopeInfContainsEnvelope_(env_b, env_a, tolerance))
			return false;

		if (env_b.getHeight() <= tolerance && env_b.getWidth() <= tolerance)
			return false;

		if (env_b.getHeight() <= tolerance || env_b.getWidth() <= tolerance)
			return envelopeInfContainsEnvelope_(env_b, env_a, tolerance);

		SegmentIterator seg_iter_a = polyline_a.querySegmentIterator();
		Envelope2D env_b_deflated = new Envelope2D();
		env_b_deflated.setCoords(env_b);
		env_b_deflated.inflate(-tolerance, -tolerance);

		boolean b_interior = false;
		Envelope2D env_segment_a = new Envelope2D();
		Envelope2D env_inter = new Envelope2D();

		while (seg_iter_a.nextPath()) {
			while (seg_iter_a.hasNextSegment()) {
				Segment segment_a = seg_iter_a.nextSegment();
				segment_a.queryEnvelope2D(env_segment_a);

				if (env_b_deflated.containsExclusive(env_segment_a)) {
					b_interior = true;
					continue;
				}

				env_inter.setCoords(env_b_deflated);
				env_inter.intersect(env_segment_a);

				if (!env_inter.isEmpty()
						&& (env_inter.getHeight() > tolerance || env_inter
								.getWidth() > tolerance))
					b_interior = true;
			}
		}

		return b_interior;
	}
597456
def should_stop_here(self, frame):
        
        # TODO: Optimization => defines a set of modules / names where _tracer
        # is never registered. This will replace skip
        #if self.skip and self.is_skipped_module(frame.f_globals.get('__name__')):
        #    return False

        # step into
        if self.frame_calling and self.frame_calling==frame.f_back:
            return True
        # step over
        if frame==self.frame_stop:  # frame cannot be null
            return True
        # step out
        if frame==self.frame_return:  # frame cannot be null
            return True
        # suspend
        if self.frame_suspend:
            return True

        return False
408108
@SuppressWarnings("unchecked")
    private Segment<K,V> ensureSegment(int k) {
        final Segment<K,V>[] ss = this.segments;
        long u = (k << SSHIFT) + SBASE; // raw offset
        Segment<K,V> seg;
        if ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u)) == null) {
            Segment<K,V> proto = ss[0]; // use segment 0 as prototype
            int cap = proto.table.length;
            float lf = proto.loadFactor;
            int threshold = (int)(cap * lf);
            HashEntry<K,V>[] tab = new HashEntry[cap];
            if ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u))
                == null) { // recheck
                Segment<K,V> s = new Segment<K,V>(lf, threshold, tab);
                while ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u))
                       == null) {
                    if (UNSAFE.compareAndSwapObject(ss, u, null, seg = s)) {
                      break;
                    }
                }
            }
        }
        return seg;
    }
23497
def _smooth(aprob, bprob, Ndiff):
    
    gamma, epsilon = _smoothing_parameters(aprob, bprob, Ndiff)

    # Remove zeros.
    in_a = [i for i,v in enumerate(aprob) if abs(v) > 0.0]
    aprob = list([list(aprob)[i] for i in in_a])
    bprob = list([list(bprob)[i]*gamma for i in in_a])

    # Replace zero values with epsilon.
    bprob = list(map(lambda v: v if v != 0. else epsilon, bprob))

    return aprob, bprob
235618
def setStartSegment(self, segment):
        
        segments = self.segments
        if not isinstance(segment, int):
            segmentIndex = segments.index(segment)
        else:
            segmentIndex = segment
        if len(self.segments) < 2:
            return
        if segmentIndex == 0:
            return
        if segmentIndex >= len(segments):
            raise ValueError(("The contour does not contain a segment "
                              "at index %d" % segmentIndex))
        self._setStartSegment(segmentIndex)
1187787
def _prep_smooth(t, y, dy, span, t_out, span_out, period):
    """"""

    # If period is provided, sort by phases. Otherwise sort by t
    if period:
        t = t % period
        if t_out is not None:
            t_out = t_out % period

    t, y, dy = validate_inputs(t, y, dy, sort_by=t)

    if span_out is not None:
        if t_out is None:
            raise ValueError("Must specify t_out when span_out is given")
        if span is not None:
            raise ValueError("Must specify only one of span, span_out")
        span, t_out = np.broadcast_arrays(span_out, t_out)
        indices = np.searchsorted(t, t_out)
    elif span is None:
        raise ValueError("Must specify either span_out or span")
    else:
        indices = None

    return t, y, dy, span, t_out, span_out, indices
921881
function isSlotSegCollision(seg1, seg2) {
	return seg1.end > seg2.start && seg1.start < seg2.end;
}
625995
boolean smoothSlideTo(float slideOffset, int velocity) {
        if (!isSlidingEnabled()) {
            // Nothing to do.
            return false;
        }

        int panelTop = computePanelTopPosition(slideOffset);
        if (mDragHelper.smoothSlideViewTo(mSlideableView, mSlideableView.getLeft(), panelTop)) {
            setAllChildrenVisible();
            ViewCompat.postInvalidateOnAnimation(this);
            return true;
        }
        return false;
    }
1374468
def _insertSegment(self, index=None, type=None, points=None,
                       smooth=False, **kwargs):
        
        onCurve = points[-1]
        offCurve = points[:-1]
        segments = self.segments
        ptCount = sum([len(segments[s].points) for s in range(index)]) + 1
        self.insertPoint(ptCount, onCurve, type=type, smooth=smooth)
        for offCurvePoint in reversed(offCurve):
            self.insertPoint(ptCount, offCurvePoint, type="offcurve")
138088
function (p, p1, maxIndex, minIndex) {
		var points = this._originalPoints,
			p2, p3;

		minIndex = minIndex || 0;

		// Check all previous line segments (beside the immediately previous) for intersections
		for (var j = maxIndex; j > minIndex; j--) {
			p2 = points[j - 1];
			p3 = points[j];

			if (L.LineUtil.segmentsIntersect(p, p1, p2, p3)) {
				return true;
			}
		}

		return false;
	}