本文整理汇总了Java中org.apache.commons.lang3.tuple.ImmutablePair.getRight方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutablePair.getRight方法的具体用法?Java ImmutablePair.getRight怎么用?Java ImmutablePair.getRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.tuple.ImmutablePair
的用法示例。
在下文中一共展示了ImmutablePair.getRight方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 "";
}
示例2: getCustomRuleEventSpec
import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
/**
* Resolves event specification "<name> <alias> : <mode>". 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);
}
示例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();
}
示例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();
}
示例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;
}