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

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

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

Range.getMaximum介绍

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

代码示例

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

@Test
public void testGetMaximum() {
  assertEquals(20, (int) intRange.getMaximum());
  assertEquals(20L, (long) longRange.getMaximum());
  assertEquals(20f, floatRange.getMaximum(), 0.00001f);
  assertEquals(20d, doubleRange.getMaximum(), 0.00001d);
}

代码示例来源:origin: apache/metron

private boolean containsInclusive(Range<Long> interval, long ts) {
 return interval.contains(ts) || interval.getMaximum() == ts;
}

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

public int getEnd() {
  return offsetRange.getMaximum();
}

代码示例来源: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

public void setBegin(int begin) {
  Integer end = offsetRange != null ? offsetRange.getMaximum() : begin;
  if (end < begin)
    end = begin;
  offsetRange = Range.between(begin, end);
}

代码示例来源: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

/**
 * 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: 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: offbynull/portmapper

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()));
this.networkBus = networkBus;

代码示例来源: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: pietermartin/sqlg

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

代码示例来源: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: 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;
    }
  }
}

相关文章