org.apache.commons.lang3.Range.getMinimum()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.apache.commons.lang3.Range.getMinimum方法的一些代码示例,展示了Range.getMinimum的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.getMinimum方法的具体详情如下:
包路径:org.apache.commons.lang3.Range
类名称:Range
方法名:getMinimum

Range.getMinimum介绍

[英]Gets the minimum value in this range.
[中]获取此范围内的最小值。

代码示例

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testGetMinimum() {
  assertEquals(10, (int) intRange.getMinimum());
  assertEquals(10L, (long) longRange.getMinimum());
  assertEquals(10f, floatRange.getMinimum(), 0.00001f);
  assertEquals(10d, doubleRange.getMinimum(), 0.00001d);
}

代码示例来源:origin: de.julielab/julielab-entity-evaluator

public int getBegin() {
  return offsetRange.getMinimum();
}

代码示例来源:origin: org.umlg/sqlg-core

/**
 * range condition
 *
 * @param r range
 * @return
 */
default String getRangeClause(Range<Long> r) {
  return "LIMIT " + (r.getMaximum() - r.getMinimum()) + " OFFSET " + r.getMinimum();
}

代码示例来源:origin: pietermartin/sqlg

/**
 * range condition
 *
 * @param r range
 * @return
 */
default String getRangeClause(Range<Long> r) {
  return "LIMIT " + (r.getMaximum() - r.getMinimum()) + " OFFSET " + r.getMinimum();
}

代码示例来源:origin: org.umlg/sqlg-mssqlserver-dialect

@Override
public String getRangeClause(Range<Long> r) {
  return "OFFSET " + r.getMinimum() + " ROWS FETCH NEXT " + (r.getMaximum() - r.getMinimum()) + " ROWS ONLY";
}

代码示例来源:origin: offbynull/portmapper

private IdentifiedService(Range<Long> leaseDurationRange, Range<Long> externalPortRange) {
  Validate.notNull(leaseDurationRange);
  Validate.notNull(externalPortRange);
  Validate.isTrue(leaseDurationRange.getMinimum() >= 0L);
  Validate.isTrue(leaseDurationRange.getMaximum() <= 0xFFFFFFFFL);
  Validate.isTrue(externalPortRange.getMinimum() >= 0L);
  Validate.isTrue(externalPortRange.getMaximum() <= 0xFFFFL);
  this.leaseDurationRange = leaseDurationRange;
  this.externalPortRange = externalPortRange;
}

代码示例来源:origin: de.julielab/julielab-entity-evaluator

public String toShortString() {
  String entityId = StringUtils.isBlank(this.entityId) ? "0" : this.entityId;
  String ret = docId + " " + entityId + " " + entityString + " " + offsetRange.getMinimum() + "-"
      + offsetRange.getMaximum();
  if (null != confidence)
    ret += "\t(" + confidence + ")";
  if (null != recognitionSystem)
    ret += "\t(" + recognitionSystem + ")";
  return ret;
}

代码示例来源:origin: net.jangaroo/jangaroo-maven-plugin

private List<Integer> shufflePortRange(Range<Integer> portRange) {
 List<Integer> shuffledPorts = new ArrayList<>();
 for (int i = portRange.getMinimum(); i <= portRange.getMaximum(); i++) {
  shuffledPorts.add(i);
 }
 Collections.shuffle(shuffledPorts);
 return shuffledPorts;
}

代码示例来源:origin: de.julielab/julielab-entity-evaluator

@Override
public String toString() {
  return "EvaluationDataEntry [docId=" + docId + ", entityId=" + entityId + ", begin=" + offsetRange.getMinimum()
      + ", end=" + offsetRange.getMaximum() + ", entityString=" + entityString + ", recognitionSystem="
      + recognitionSystem + "]";
}

代码示例来源:origin: de.julielab/julielab-entity-evaluator

@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + offsetRange.getMinimum();
  result = prime * result + ((docId == null) ? 0 : docId.hashCode());
  result = prime * result + offsetRange.getMaximum();
  result = prime * result + ((entityId == null) ? 0 : entityId.hashCode());
  return result;
}

代码示例来源:origin: de.julielab/julielab-entity-evaluator

public void setEnd(int end) {
  Integer begin = offsetRange != null ? offsetRange.getMinimum() : end;
  if (begin > end)
    begin = end;
  offsetRange = Range.between(begin, end);
}

代码示例来源:origin: de.julielab/julielab-entity-evaluator

/**
 * Tests, whether this entry describes a specific entity mention in text. If
 * <tt>false</tt>, that means that this entry is document-wide index term
 * with no - or unknown - location within the document.
 * 
 * @return <tt>true</tt>, iff <tt>begin</tt> and <tt>end</tt> are greater or
 *         equal to zero and this offset describes a non-empty span, i.e.
 *         <tt>begin</tt> &lt; <tt>end</tt>.
 */
public boolean isMention() {
  return offsetRange.getMinimum() >= 0 && offsetRange.getMaximum() >= 0
      && offsetRange.getMinimum() <= offsetRange.getMaximum();
}

代码示例来源:origin: com.opencsv/opencsv

/**
 * If there are ranges in the list of ranges encompassed by this mapping
 * that stretch beyond the maximum index given, they are shortened to be
 * no longer than the maximum index.
 * Ranges that lie completely beyond the maximum index are shortened to a
 * one-element range consisting of the range's lower boundary. No ranges are
 * under any circumstances removed, as this might compromise checks for
 * required fields.
 * 
 * @param maxIndex The new maximum for ranges
 */
public void attenuateRanges(int maxIndex) {
  ListIterator<Range<Integer>> rangeIterator = ranges.listIterator();
  while(rangeIterator.hasNext()) {
    Range<Integer> r = rangeIterator.next();
    if(r.getMaximum() > maxIndex) {
      if(r.getMinimum() > maxIndex) {
        rangeIterator.set(Range.is(r.getMinimum()));
      }
      else {
        rangeIterator.set(Range.between(r.getMinimum(), maxIndex));
      }
    }
  }
}

代码示例来源:origin: offbynull/portmapper

Validate.notNull(externalPortRange);
Validate.notNull(leaseDurationRange);
Validate.isTrue(leaseDurationRange.getMinimum() >= 0L);
Validate.isTrue(leaseDurationRange.getMaximum() <= 0xFFFFFFFFL);
Validate.isTrue(externalPortRange.getMinimum() >= 0L);
Validate.isTrue(externalPortRange.getMaximum() <= 0xFFFFL);
Validate.isTrue("http".equalsIgnoreCase(controlUrl.getProtocol()));

代码示例来源:origin: de.julielab/julielab-entity-evaluator

int intersectionLength = intersection.getMaximum() - intersection.getMinimum();
if (overlapType == OverlapType.CHARS && intersectionLength < overlapSize)
  return false;
if (overlapType == OverlapType.PERCENT) {
  int thisMentionLength = offsetRange.getMaximum() - offsetRange.getMinimum();
  int otherMentionLength = other.offsetRange.getMaximum() - other.offsetRange.getMinimum();
  int thisOverlapPercent = (int) Math.ceil((double) intersectionLength / thisMentionLength * 100d);
  int otherOverlapPercent = (int) Math.ceil((double) intersectionLength / otherMentionLength * 100d);

代码示例来源:origin: Wikia/selenium-tests

public void verifyNumberOfTop1kWikisInRange(Range expectedRange) {
 wait.forElementVisible(headerWhereIsMyExtensionPage);
 Log.log("verifyNumberOfTop1kWikisInRange", "Verification of top 1k wikis", true, driver);
 Pattern p = Pattern.compile("\\d+");
 Matcher m = p.matcher(headerWhereIsMyExtensionPage.getText());
 m.find();
 Assertion.assertTrue(
     expectedRange.contains(Integer.parseInt(m.group())),
     String.format("Number of Top 1k Wikis between %s and %s", expectedRange.getMinimum(), expectedRange.getMaximum())
 );
}

代码示例来源:origin: org.nuiton.topia/topia-persistence

public <T extends Comparable<T>> void addIn(String property, org.apache.commons.lang3.Range<T> range, boolean in) {
  T minimum = range.getMinimum();
  T maximum = range.getMaximum();
  if (in) {
    doAddGreaterOrEquals(property, minimum);
    doAddLowerOrEquals(property, maximum);
  } else {
    doAddLowerThan(property, minimum);
    doAddGreaterThan(property, maximum);
  }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-applicationhistoryservice

@Override
public GetApplicationsResponse
  getApplications(GetApplicationsRequest request) throws YarnException,
    IOException {
 long startedBegin =
   request.getStartRange() == null ? 0L : request.getStartRange()
    .getMinimum();
 long startedEnd =
   request.getStartRange() == null ? Long.MAX_VALUE : request
    .getStartRange().getMaximum();
 GetApplicationsResponse response =
   GetApplicationsResponse.newInstance(new ArrayList<ApplicationReport>(
    history.getApplications(request.getLimit(), startedBegin, startedEnd)
     .values()));
 return response;
}

代码示例来源:origin: Silentine/GrimoireOfGaia

@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
  super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected);
  if (!(entityIn instanceof EntityPlayer))
    return;
  EntityPlayer player = (EntityPlayer) entityIn;
  Range<Integer> range = getActiveSlotRange();
  for (int i = range.getMinimum(); i <= range.getMaximum(); ++i) {
    if (player.inventory.getStackInSlot(i) == stack) {
      doEffect(player, stack);
      break;
    }
  }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

builder.setStartBegin(start.getMinimum());
builder.setStartEnd(start.getMaximum());
builder.setFinishBegin(finish.getMinimum());
builder.setFinishEnd(finish.getMaximum());

相关文章