当前位置: 首页>>代码示例>>Java>>正文


Java ImmutablePair.getLeft方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.tuple.ImmutablePair.getLeft方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutablePair.getLeft方法的具体用法?Java ImmutablePair.getLeft怎么用?Java ImmutablePair.getLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.tuple.ImmutablePair的用法示例。


在下文中一共展示了ImmutablePair.getLeft方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findNodeByPodIP

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
String findNodeByPodIP(String podIP) {
  for (ImmutablePair<Netmask, ImmutableMap<NetworkAddress, String>> entry : podSubnetToNode) {
    Netmask netmask = entry.getLeft();
    ImmutableMap<NetworkAddress, String> networkToNode = entry.getRight();
    // Computes the subnet that results from the netmask applied to the pod IP.
    SubnetInfo podSubnetToCheck;
    try {
      podSubnetToCheck = new SubnetUtils(podIP, netmask.getValue()).getInfo();
    } catch (IllegalArgumentException e) {
      log.warn(e);
      continue;
    }
    String networkAddress = podSubnetToCheck.getNetworkAddress();
    String nodeName = networkToNode.get(new NetworkAddress(networkAddress));
    if (nodeName != null) {  // The cluster node is in charge of this pod IP subnet.
      return nodeName;
    }
  }
  return "";
}
 
开发者ID:apache-spark-on-k8s,项目名称:kubernetes-HDFS,代码行数:21,代码来源:PodCIDRToNodeMapping.java

示例2: getCustomRuleEventSpec

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
/**
 * Resolves event specification "&lt;name&gt; &lt;alias&gt; : &lt;mode&gt;". Uses default value when one not provided.
 *
 * @param eventSpecString event specification.
 * @return rule event specification, i.e. a triple of (name, alias, mode).
 */
protected RuleEventSpec getCustomRuleEventSpec(String eventSpecString) {
    if (eventSpecString == null) {
        throw new SpongeException("Event specification is null");
    }

    List<String> mainList =
            Arrays.stream(eventSpecString.split(":")).map(s -> s.trim()).filter(s -> !s.isEmpty()).collect(Collectors.toList());
    if (mainList.isEmpty()) {
        throw new SpongeException("Event specification is empty");
    } else if (mainList.size() > 2) {
        throw new SpongeException("Event specification has too many elements separated by ':'");
    }

    ImmutablePair<String, String> nameAlias = resolveEventNameAndAlias(mainList.get(0));
    EventMode eventMode = RuleAdapter.DEFAULT_MODE;
    if (mainList.size() == 2) {
        try {
            eventMode = EventMode.valueOf(mainList.get(1).toUpperCase());
        } catch (Exception e) {
            throw new SpongeException("Event mode is incorrect: " + mainList.get(1));
        }
    }

    return new GenericRuleEventSpec(nameAlias.getLeft(), nameAlias.getRight(), eventMode);
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:32,代码来源:BaseKnowledgeBaseInterpreter.java

示例3: getContent

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
public String getContent() {
  TableBuilder builder = new TableBuilder(OPERATOR_COLUMNS);

  for (ImmutablePair<OperatorProfile, Integer> ip : ops) {
    int minor = ip.getRight();
    OperatorProfile op = ip.getLeft();

    String path = new OperatorPathBuilder().setMajor(major).setMinor(minor).setOperator(op).build();
    builder.appendCell(path, null);
    builder.appendNanos(op.getSetupNanos(), null);
    builder.appendNanos(op.getProcessNanos(), null);
    builder.appendNanos(op.getWaitNanos(), null);

    long maxBatches = Long.MIN_VALUE;
    long maxRecords = Long.MIN_VALUE;
    for (StreamProfile sp : op.getInputProfileList()) {
      maxBatches = Math.max(sp.getBatches(), maxBatches);
      maxRecords = Math.max(sp.getRecords(), maxRecords);
    }

    builder.appendFormattedInteger(maxBatches, null);
    builder.appendFormattedInteger(maxRecords, null);
    builder.appendBytes(op.getPeakLocalMemoryAllocated(), null);
  }
  return builder.build();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:27,代码来源:OperatorWrapper.java

示例4: getContent

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
public String getContent() {
  TableBuilder builder = new TableBuilder(OPERATOR_COLUMNS);

  for (ImmutablePair<OperatorProfile, Integer> ip : ops) {
    int minor = ip.getRight();
    OperatorProfile op = ip.getLeft();

    String path = new OperatorPathBuilder().setMajor(major).setMinor(minor).setOperator(op).build();
    builder.appendCell(path, null);
    builder.appendNanos(op.getSetupNanos());
    builder.appendNanos(op.getProcessNanos());
    builder.appendNanos(op.getWaitNanos());

    long maxBatches = Long.MIN_VALUE;
    long maxRecords = Long.MIN_VALUE;
    for (StreamProfile sp : op.getInputProfileList()) {
      maxBatches = Math.max(sp.getBatches(), maxBatches);
      maxRecords = Math.max(sp.getRecords(), maxRecords);
    }

    builder.appendFormattedInteger(maxBatches, null);
    builder.appendFormattedInteger(maxRecords, null);
    builder.appendBytes(op.getPeakLocalMemoryAllocated(), null);
  }
  return builder.build();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:27,代码来源:OperatorWrapper.java

示例5: withinRange

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
private boolean withinRange(final String name) {
  final int queryNumber = session.getQueryCount();
  final ImmutablePair<Integer, Integer> pair = shortLivedOptions.get(name);
  final int start = pair.getLeft();
  final int end = pair.getRight();
  return start <= queryNumber && queryNumber < end;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:8,代码来源:SessionOptionManager.java

示例6: addSummary

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
public void addSummary(TableBuilder tb) {

    String path = new OperatorPathBuilder().setMajor(major).setOperator(firstProfile).build();
    tb.appendCell(path, null);
    tb.appendCell(operatorType == null ? "UNKNOWN_OPERATOR" : operatorType.toString(), null);

    double setupSum = 0.0;
    double processSum = 0.0;
    double waitSum = 0.0;
    double memSum = 0.0;
    for (ImmutablePair<OperatorProfile, Integer> ip : ops) {
      OperatorProfile profile = ip.getLeft();
      setupSum += profile.getSetupNanos();
      processSum += profile.getProcessNanos();
      waitSum += profile.getWaitNanos();
      memSum += profile.getPeakLocalMemoryAllocated();
    }

    final ImmutablePair<OperatorProfile, Integer> shortSetup = Collections.min(ops, Comparators.setupTime);
    final ImmutablePair<OperatorProfile, Integer> longSetup = Collections.max(ops, Comparators.setupTime);
    tb.appendNanos(shortSetup.getLeft().getSetupNanos(), String.format(format, shortSetup.getRight()));
    tb.appendNanos(Math.round(setupSum / size), null);
    tb.appendNanos(longSetup.getLeft().getSetupNanos(), String.format(format, longSetup.getRight()));

    final ImmutablePair<OperatorProfile, Integer> shortProcess = Collections.min(ops, Comparators.processTime);
    final ImmutablePair<OperatorProfile, Integer> longProcess = Collections.max(ops, Comparators.processTime);
    tb.appendNanos(shortProcess.getLeft().getProcessNanos(), String.format(format, shortProcess.getRight()));
    tb.appendNanos(Math.round(processSum / size), null);
    tb.appendNanos(longProcess.getLeft().getProcessNanos(), String.format(format, longProcess.getRight()));

    final ImmutablePair<OperatorProfile, Integer> shortWait = Collections.min(ops, Comparators.waitTime);
    final ImmutablePair<OperatorProfile, Integer> longWait = Collections.max(ops, Comparators.waitTime);
    tb.appendNanos(shortWait.getLeft().getWaitNanos(), String.format(format, shortWait.getRight()));
    tb.appendNanos(Math.round(waitSum / size), null);
    tb.appendNanos(longWait.getLeft().getWaitNanos(), String.format(format, longWait.getRight()));

    final ImmutablePair<OperatorProfile, Integer> peakMem = Collections.max(ops, Comparators.operatorPeakMemory);
    tb.appendBytes(Math.round(memSum / size), null);
    tb.appendBytes(peakMem.getLeft().getPeakLocalMemoryAllocated(), null);
  }
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:41,代码来源:OperatorWrapper.java

示例7: addSummary

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
public void addSummary(TableBuilder tb) {

    String path = new OperatorPathBuilder().setMajor(major).setOperator(firstProfile).build();
    tb.appendCell(path, null);
    tb.appendCell(operatorName, null);

    double setupSum = 0.0;
    double processSum = 0.0;
    double waitSum = 0.0;
    double memSum = 0.0;
    for (ImmutablePair<OperatorProfile, Integer> ip : ops) {
      OperatorProfile profile = ip.getLeft();
      setupSum += profile.getSetupNanos();
      processSum += profile.getProcessNanos();
      waitSum += profile.getWaitNanos();
      memSum += profile.getPeakLocalMemoryAllocated();
    }

    final ImmutablePair<OperatorProfile, Integer> shortSetup = Collections.min(ops, Comparators.setupTime);
    final ImmutablePair<OperatorProfile, Integer> longSetup = Collections.max(ops, Comparators.setupTime);
    tb.appendNanos(shortSetup.getLeft().getSetupNanos());
    tb.appendNanos(Math.round(setupSum / size));
    tb.appendNanos(longSetup.getLeft().getSetupNanos());

    final ImmutablePair<OperatorProfile, Integer> shortProcess = Collections.min(ops, Comparators.processTime);
    final ImmutablePair<OperatorProfile, Integer> longProcess = Collections.max(ops, Comparators.processTime);
    tb.appendNanos(shortProcess.getLeft().getProcessNanos());
    tb.appendNanos(Math.round(processSum / size));
    tb.appendNanos(longProcess.getLeft().getProcessNanos());

    final ImmutablePair<OperatorProfile, Integer> shortWait = Collections.min(ops, Comparators.waitTime);
    final ImmutablePair<OperatorProfile, Integer> longWait = Collections.max(ops, Comparators.waitTime);
    tb.appendNanos(shortWait.getLeft().getWaitNanos());
    tb.appendNanos(Math.round(waitSum / size));
    tb.appendNanos(longWait.getLeft().getWaitNanos());

    final ImmutablePair<OperatorProfile, Integer> peakMem = Collections.max(ops, Comparators.operatorPeakMemory);
    tb.appendBytes(Math.round(memSum / size), null);
    tb.appendBytes(peakMem.getLeft().getPeakLocalMemoryAllocated(), null);
  }
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:41,代码来源:OperatorWrapper.java

示例8: getMetricsTable

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
public String getMetricsTable() {
  if (operatorType == null) {
    return "";
  }
  final String[] metricNames = OperatorMetricRegistry.getMetricNames(operatorType.getNumber());
  if (metricNames == null) {
    return "";
  }

  final String[] metricsTableColumnNames = new String[metricNames.length + 1];
  metricsTableColumnNames[0] = "Thread";
  int i = 1;
  for (final String metricName : metricNames) {
    metricsTableColumnNames[i++] = metricName;
  }
  final TableBuilder builder = new TableBuilder(metricsTableColumnNames);
  for (final ImmutablePair<OperatorProfile, Integer> ip : ops) {
    final OperatorProfile op = ip.getLeft();

    builder.appendCell(
        new OperatorPathBuilder()
            .setMajor(major)
            .setMinor(ip.getRight())
            .setOperator(op)
            .build(),
        null);

    final Number[] values = new Number[metricNames.length];
    for (final MetricValue metric : op.getMetricList()) {
      if (metric.hasLongValue()) {
        values[metric.getMetricId()] = metric.getLongValue();
      } else if (metric.hasDoubleValue()) {
        values[metric.getMetricId()] = metric.getDoubleValue();
      }
    }
    for (final Number value : values) {
      if (value != null) {
        builder.appendFormattedNumber(value, null);
      } else {
        builder.appendCell("", null);
      }
    }
  }
  return builder.build();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:46,代码来源:OperatorWrapper.java


注:本文中的org.apache.commons.lang3.tuple.ImmutablePair.getLeft方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。