Calculate the boundary of the bucket that countain the given token given the token interval.
@return The token of the bucket boundary.
169916
private static int containingBucket(int token, long interval)
    {
        return (int) ((((long) token - Integer.MIN_VALUE) / interval) * interval + Integer.MIN_VALUE);
    }
129726
public static function tokenHasMultipleBoundaryCharactersTogether($token, &$tokens, $i, &$originalTokens)
    {
        return $token[Tokenizer::TOKEN_TYPE] === Tokenizer::TOKEN_TYPE_BOUNDARY
        && self::tokenPreviousCharacterIsBoundary($tokens, $i)
        && self::tokenPreviousCharacterIsWhiteSpace($token, $originalTokens);
    }
356140
public static double calculateBoundedness(double D, int N, double timelag, double confRadius){
		double r = confRadius;
		double cov_area = a(N)*D*timelag;
		double res = cov_area/(4*r*r);
		return res;
	}
741529
public function getBoundary()
    {
        if (!isset($this->boundary)) {
            $this->boundary = '_=_swift_'.time().'_'.bin2hex(random_bytes(16)).'_=_';
        }

        return $this->boundary;
    }
251474
def _check_boundaries(self, fragment):
        
        if not isinstance(fragment, SyncMapFragment):
            raise TypeError(u"fragment is not an instance of SyncMapFragment")
        interval = fragment.interval
        if not isinstance(interval, TimeInterval):
            raise TypeError(u"interval is not an instance of TimeInterval")
        if (self.begin is not None) and (interval.begin < self.begin):
            raise ValueError(u"interval.begin is before self.begin")
        if (self.end is not None) and (interval.end > self.end):
            raise ValueError(u"interval.end is after self.end")
194805
@Override
  protected Long lastForComputingSegment(Long value, Long boundary)
      throws IOException {
    if (segmentRegistration.equals(SEGMENT_SORT_ASC)
        || segmentRegistration.equals(SEGMENT_BOUNDARY_ASC)) {
      return Math.max(value, boundary);
    } else if (segmentRegistration.equals(SEGMENT_SORT_DESC)
        || segmentRegistration.equals(SEGMENT_BOUNDARY_DESC)) {
      return Math.min(value, boundary);
    } else {
      throw new IOException(
          "can't compute last for segmentRegistration " + segmentRegistration);
    }
  }
1275225
public function getBoundary()
    {
        if (null === $this->boundary) {
            $this->boundary = uniqid('', true);
        }

        return $this->boundary;
    }
222183
private static TokenRange tokenRange(Token token) {
        JavaToken javaToken = token.javaToken;
        return new TokenRange(javaToken, javaToken);
    }
829720
public static Node getEnclosingType(Node n, final Token type) {
    return getEnclosingNode(
        n,
        new Predicate<Node>() {
          @Override
          public boolean apply(Node n) {
            return n.getToken() == type;
          }
        });
  }
1159615
static String mimeBoundary() {
        final StringBuilder mime = StringUtil.borrowBuilder();
        final Random rand = new Random();
        for (int i = 0; i < boundaryLength; i++) {
            mime.append(mimeBoundaryChars[rand.nextInt(mimeBoundaryChars.length)]);
        }
        return StringUtil.releaseBuilder(mime);
    }
36476
private Rectangle2D getBoundsHintHorizontal() {

    if (!chart.getStyler().isLegendVisible()) {
      return new Rectangle2D
          .Double(); // Constructs a new Rectangle2D, initialized to location (0, 0) and size (0,
      // 0).
    }

    // determine legend text content max height
    double legendTextContentMaxHeight = 0;

    // determine total legend content width
    double legendContentWidth = 0;

    Map<String, S> map = chart.getSeriesMap();
    for (S series : map.values()) {

      if (!series.isShowInLegend()) {
        continue;
      }
      if (!series.isEnabled()) {
        continue;
      }

      Map<String, Rectangle2D> seriesTextBounds = getSeriesTextBounds(series);

      double legendEntryHeight = 0; // could be multi-line
      double legendEntryMaxWidth = 0; // could be multi-line
      for (Map.Entry<String, Rectangle2D> entry : seriesTextBounds.entrySet()) {
        legendEntryHeight += entry.getValue().getHeight() + MULTI_LINE_SPACE;
        legendEntryMaxWidth = Math.max(legendEntryMaxWidth, entry.getValue().getWidth());
      }

      legendEntryHeight -= MULTI_LINE_SPACE; // subtract away the bottom MULTI_LINE_SPACE
      legendTextContentMaxHeight =
          Math.max(legendEntryHeight, getSeriesLegendRenderGraphicHeight(series));

      legendContentWidth += legendEntryMaxWidth + chart.getStyler().getLegendPadding();

      if (series.getLegendRenderType() == LegendRenderType.Line) {
        legendContentWidth =
            chart.getStyler().getLegendSeriesLineLength()
                + chart.getStyler().getLegendPadding()
                + legendContentWidth;
      } else {
        legendContentWidth = BOX_SIZE + chart.getStyler().getLegendPadding() + legendContentWidth;
      }
    }

    // Legend Box
    double width = legendContentWidth + chart.getStyler().getLegendPadding();
    double height = legendTextContentMaxHeight + chart.getStyler().getLegendPadding() * 2;

    return new Rectangle2D.Double(0, 0, width, height); // 0 indicates not sure yet.
  }
519749
public String getToken(){
		if(this.tokenPosition>0){
			String[] ar = StringUtils.split(this.line, null, this.tokenPosition+1);
			if(ar!=null && ar.length>(this.tokenPosition-1)){
				return StringUtils.trim(ar[this.tokenPosition-1]);
			}
		}
		return null;
	}
494689
@Override
    public String nextToken() {
        if (!tokens.isEmpty() && position.get() < tokens.size())
            return tokens.get(position.getAndIncrement());

        return nextTokenFromStream();
    }
816690
public Rectangle2D getBoundingBox() {
		Dimension glyphDimension = getMetrics().getGlyphDimension(getNotationContext());
		if (isStemUp()) {
			return new Rectangle2D.Double(
				(int)(getBase().getX()),
                stemYEnd,
				getWidth(),
				getStemBeginPosition().getY()-stemYEnd+glyphDimension.getHeight()/2);
		}
		else {
			return new Rectangle2D.Double(
				(int)(getBase().getX()),
				getStemBeginPosition().getY()-glyphDimension.getHeight()/2,
				getWidth(),
				stemYEnd-getStemBeginPosition().getY()+1+glyphDimension.getHeight()/2);
		}
	}
860492
protected int countToken(String token, String target) {
        int tokenIndex = 0;
        int count = 0;
        while (tokenIndex != -1) {
            tokenIndex = target.indexOf(token, tokenIndex);
            if (tokenIndex > -1) {
                tokenIndex++;
                count++;
            }
        }
        return count;
    }
663762
public final Interval bucket(DateTime t)
  {
    DateTime start = bucketStart(t);
    return new Interval(start, increment(start));
  }
939398
public I collapse() {

        if (this.start.isInfinite()) {
            throw new IllegalStateException(
                "An interval with infinite past cannot be collapsed.");
        }

        T t = this.getClosedFiniteStart();
        Boundary<T> s = Boundary.ofClosed(t);
        Boundary<T> e = Boundary.ofOpen(t);
        return this.getFactory().between(s, e);

    }