org.apache.commons.lang3.tuple.Triple.getRight()方法的使用及代码示例

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

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

Triple.getRight介绍

[英]Gets the right element from this triple.
[中]从这个三元组中获取正确的元素。

代码示例

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

/**
 * <p>Returns a suitable hash code.</p>
 *
 * @return the hash code
 */
@Override
public int hashCode() {
  return (getLeft() == null ? 0 : getLeft().hashCode()) ^
    (getMiddle() == null ? 0 : getMiddle().hashCode()) ^
    (getRight() == null ? 0 : getRight().hashCode());
}

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

/**
 * <p>Formats the receiver using the given format.</p>
 *
 * <p>This uses {@link java.util.Formattable} to perform the formatting. Three variables may
 * be used to embed the left and right elements. Use {@code %1$s} for the left
 * element, {@code %2$s} for the middle and {@code %3$s} for the right element.
 * The default format used by {@code toString()} is {@code (%1$s,%2$s,%3$s)}.</p>
 *
 * @param format  the format string, optionally containing {@code %1$s}, {@code %2$s} and {@code %3$s}, not null
 * @return the formatted string, not null
 */
public String toString(final String format) {
  return String.format(format, getLeft(), getMiddle(), getRight());
}

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

/**
 * <p>Returns a String representation of this triple using the format {@code ($left,$middle,$right)}.</p>
 *
 * @return a string describing this object, not null
 */
@Override
public String toString() {
  return "(" + getLeft() + "," + getMiddle() + "," + getRight() + ")";
}

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

/**
 * <p>Compares this triple to another based on the three elements.</p>
 *
 * @param obj  the object to compare to, null returns false
 * @return true if the elements of the triple are equal
 */
@Override
public boolean equals(final Object obj) {
  if (obj == this) {
    return true;
  }
  if (obj instanceof Triple<?, ?, ?>) {
    final Triple<?, ?, ?> other = (Triple<?, ?, ?>) obj;
    return Objects.equals(getLeft(), other.getLeft())
      && Objects.equals(getMiddle(), other.getMiddle())
      && Objects.equals(getRight(), other.getRight());
  }
  return false;
}

代码示例来源:origin: apache/incubator-gobblin

@Override
public int getPagesSize() {
 if (isOperatorEquals()) {
  return 1;
 } else {
  return _jobNode.getRight().getSize();
 }
}

代码示例来源:origin: apache/incubator-gobblin

@Override
public String toString() {
 return String.format(
   "TrieBasedProducerJob{_page='%s', _startDate='%s', _endDate='%s', _operator='%s', _groupSize='%s', _nodeSize='%s'}",
   getPage(), _startDate, _endDate, getOperator(), _groupSize, _jobNode.getRight().getSize());
}

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

/**
 * <p>Compares the triple based on the left element, followed by the middle element,
 * finally the right element.
 * The types must be {@code Comparable}.</p>
 *
 * @param other  the other triple, not null
 * @return negative if this is less, zero if equal, positive if greater
 */
@Override
public int compareTo(final Triple<L, M, R> other) {
 return new CompareToBuilder().append(getLeft(), other.getLeft())
   .append(getMiddle(), other.getMiddle())
   .append(getRight(), other.getRight()).toComparison();
}

代码示例来源:origin: apache/incubator-pinot

public static ServerInstance forHostPort(String name, int port) {
 if (nameToInstanceInfo.containsKey(name)) {
  Triple<String, String, InetAddress> instanceInfo = nameToInstanceInfo.get(name);
  return new ServerInstance(instanceInfo.getLeft(), instanceInfo.getMiddle(), instanceInfo.getRight(), port, 0);
 } else {
  ServerInstance newInstance = new ServerInstance(name, port);
  nameToInstanceInfo.putIfAbsent(name,
    Triple.of(newInstance.getHostname(), newInstance.getShortHostName(), newInstance.getIpAddress()));
  return newInstance;
 }
}

代码示例来源:origin: apache/incubator-gobblin

/**
 * Get the detailed pages under this group
 */
public static ArrayList<String> groupToPages(Triple<String, GoogleWebmasterFilter.FilterOperator, UrlTrieNode> group) {
 ArrayList<String> ret = new ArrayList<>();
 if (group.getMiddle().equals(GoogleWebmasterFilter.FilterOperator.EQUALS)) {
  if (group.getRight().isExist()) {
   ret.add(group.getLeft());
  }
 } else if (group.getMiddle().equals(GoogleWebmasterFilter.FilterOperator.CONTAINS)) {
  UrlTrie trie = new UrlTrie(group.getLeft(), group.getRight());
  Iterator<Pair<String, UrlTrieNode>> iterator = new UrlTriePostOrderIterator(trie, 1);
  while (iterator.hasNext()) {
   Pair<String, UrlTrieNode> next = iterator.next();
   if (next.getRight().isExist()) {
    ret.add(next.getLeft());
   }
  }
 }
 return ret;
}

代码示例来源:origin: apache/incubator-gobblin

@Test
public void testWhenTrieSizeLessThanGroupSize1() {
 List<String> pages = Arrays.asList(_property + "13");
 UrlTrie trie1 = new UrlTrie(_property, pages);
 UrlTriePrefixGrouper grouper = new UrlTriePrefixGrouper(trie1, 1);
 Triple<String, FilterOperator, UrlTrieNode> next = grouper.next();
 Assert.assertEquals(next.getLeft(), _property);
 Assert.assertEquals(next.getMiddle(), FilterOperator.CONTAINS);
 Assert.assertEquals(next.getRight().getValue(), Character.valueOf('/'));
 Assert.assertFalse(next.getRight().isExist());
 Assert.assertFalse(grouper.hasNext());
}

代码示例来源:origin: apache/incubator-gobblin

@Test
public void testWhenTrieSizeLessThanGroupSize2() {
 List<String> pages = Arrays.asList(_property + "13");
 UrlTrie trie1 = new UrlTrie(_property, pages);
 UrlTriePrefixGrouper grouper = new UrlTriePrefixGrouper(trie1, 2);
 Triple<String, FilterOperator, UrlTrieNode> next = grouper.next();
 Assert.assertEquals(next.getLeft(), _property);
 Assert.assertEquals(next.getMiddle(), FilterOperator.CONTAINS);
 Assert.assertEquals(next.getRight().getValue(), Character.valueOf('/'));
 Assert.assertFalse(next.getRight().isExist());
 Assert.assertFalse(grouper.hasNext());
}

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

private HiveTableScan(RelOptCluster cluster, RelTraitSet traitSet, RelOptHiveTable table,
  String alias, String concatQbIDAlias, RelDataType newRowtype, boolean useQBIdInDigest, boolean insideView) {
 super(cluster, TraitsUtil.getDefaultTraitSet(cluster), table);
 assert getConvention() == HiveRelNode.CONVENTION;
 this.tblAlias = alias;
 this.concatQbIDAlias = concatQbIDAlias;
 this.hiveTableScanRowType = newRowtype;
 Triple<ImmutableList<Integer>, ImmutableSet<Integer>, ImmutableSet<Integer>> colIndxPair =
   buildColIndxsFrmReloptHT(table, newRowtype);
 this.neededColIndxsFrmReloptHT = colIndxPair.getLeft();
 this.virtualOrPartColIndxsInTS = colIndxPair.getMiddle();
 this.virtualColIndxsInTS = colIndxPair.getRight();
 this.useQBIdInDigest = useQBIdInDigest;
 this.insideView = insideView;
}

代码示例来源:origin: apache/incubator-gobblin

/**
 * The implementation here will first partition the job by pages, and then by dates.
 * @return
 */
@Override
public List<? extends ProducerJob> partitionJobs() {
 UrlTrieNode root = _jobNode.getRight();
 if (isOperatorEquals() || root.getSize() == 1) {
  //Either at an Equals-Node or a Leaf-Node, both of which actually has actual size 1.
  return super.partitionJobs();
 } else {
  if (_groupSize <= 1) {
   throw new RuntimeException("This is impossible. When group size is 1, the operator must be equals");
  }
  UrlTrie trie = new UrlTrie(getPage(), root);
  int gs = Math.min(root.getSize(), _groupSize);
  UrlTriePrefixGrouper grouper = new UrlTriePrefixGrouper(trie, (int) Math.ceil(gs / 2.0));
  List<TrieBasedProducerJob> jobs = new ArrayList<>();
  while (grouper.hasNext()) {
   jobs.add(new TrieBasedProducerJob(_startDate, _endDate, grouper.next(), grouper.getGroupSize()));
  }
  return jobs;
 }
}

代码示例来源:origin: Alluxio/alluxio

AlluxioURI uri = entry.getLeft();
long blockId = entry.getMiddle();
int numReplicas = entry.getRight();
try {
 switch (mode) {

代码示例来源:origin: Netflix/genie

final States targetState = transition.getRight();
final Events event = transition.getMiddle();
transitionConfigurer

代码示例来源:origin: ethereum/ethereumj

@Test
public void testTrackTx2() throws InterruptedException {
  StandaloneBlockchain bc = new StandaloneBlockchain();
  PendingListener l = new PendingListener();
  bc.addEthereumListener(l);
  Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd = null;
  PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
  ECKey alice = new ECKey();
  ECKey bob = new ECKey();
  bc.sendEther(bob.getAddress(), convert(100, ETHER));
  Block b1 = bc.createBlock();
  Transaction tx1 = bc.createTransaction(bob, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);
  bc.submitTransaction(tx1);
  Block b2 = bc.createBlock();
  Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
  pendingState.trackTransaction(tx1);
  txUpd = l.pollTxUpdate(tx1);
  Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
  Assert.assertArrayEquals(txUpd.getRight().getHash(), b2.getHash());
  Block b2_ = bc.createForkBlock(b1);
  Block b3_ = bc.createForkBlock(b2_);
  Assert.assertEquals(l.pollTxUpdateState(tx1), PENDING);
}

代码示例来源:origin: ethereum/ethereumj

txUpd = l.pollTxUpdate(tx1);
Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
Assert.assertArrayEquals(txUpd.getRight().getHash(), b2_.getHash());
txUpd = l.pollTxUpdate(tx1);
Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
Assert.assertArrayEquals(txUpd.getRight().getHash(), b2.getHash());

代码示例来源:origin: ethereum/ethereumj

@Test
public void testOldBlockIncluded() throws InterruptedException {
  StandaloneBlockchain bc = new StandaloneBlockchain();
  PendingListener l = new PendingListener();
  bc.addEthereumListener(l);
  Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd = null;
  PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
  ECKey alice = new ECKey();
  ECKey bob = new ECKey();
  ECKey charlie = new ECKey();
  bc.sendEther(bob.getAddress(), convert(100, ETHER));
  Block b1 = bc.createBlock();
  for (int i = 0; i < 16; i++) {
    bc.createBlock();
  }
  Transaction tx1 = bc.createTransaction(bob, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);
  pendingState.addPendingTransaction(tx1);
  Assert.assertEquals(l.pollTxUpdateState(tx1), NEW_PENDING);
  bc.submitTransaction(tx1);
  Block b2_ = bc.createForkBlock(b1);
  Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
  bc.submitTransaction(tx1);
  Block b18 = bc.createBlock();
  txUpd = l.pollTxUpdate(tx1);
  Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
  Assert.assertArrayEquals(txUpd.getRight().getHash(), b18.getHash());
}

代码示例来源:origin: ethereum/ethereumj

@Test
public void testTrackTx1() throws InterruptedException {
  StandaloneBlockchain bc = new StandaloneBlockchain();
  PendingListener l = new PendingListener();
  bc.addEthereumListener(l);
  Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd = null;
  PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
  ECKey alice = new ECKey();
  ECKey bob = new ECKey();
  bc.sendEther(bob.getAddress(), convert(100, ETHER));
  Block b1 = bc.createBlock();
  Block b2 = bc.createBlock();
  Block b3 = bc.createBlock();
  Transaction tx1 = bc.createTransaction(bob, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);
  bc.submitTransaction(tx1);
  Block b2_ = bc.createForkBlock(b1);
  Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
  pendingState.trackTransaction(tx1);
  Assert.assertEquals(l.pollTxUpdateState(tx1), NEW_PENDING);
  Block b3_ = bc.createForkBlock(b2_);
  Block b4_ = bc.createForkBlock(b3_);
  txUpd = l.pollTxUpdate(tx1);
  Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
  Assert.assertArrayEquals(txUpd.getRight().getHash(), b2_.getHash());
}

代码示例来源:origin: ethereum/ethereumj

Assert.assertEquals(txUpd.getRight(), b3);
Assert.assertEquals(l.pollTxUpdateState(tx3), PENDING);

相关文章

微信公众号

最新文章

更多