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


Java Pair.setSecond方法代码示例

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


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

示例1: FuzzyRowFilter

import org.apache.hadoop.hbase.util.Pair; //导入方法依赖的package包/类
public FuzzyRowFilter(List<Pair<byte[], byte[]>> fuzzyKeysData) {
  Pair<byte[], byte[]> p;
  for (int i = 0; i < fuzzyKeysData.size(); i++) {
    p = fuzzyKeysData.get(i);
    if (p.getFirst().length != p.getSecond().length) {
      Pair<String, String> readable =
          new Pair<String, String>(Bytes.toStringBinary(p.getFirst()), Bytes.toStringBinary(p
              .getSecond()));
      throw new IllegalArgumentException("Fuzzy pair lengths do not match: " + readable);
    }
    // update mask ( 0 -> -1 (0xff), 1 -> 0)
    p.setSecond(preprocessMask(p.getSecond()));
    preprocessSearchKey(p);
  }
  this.fuzzyKeysData = fuzzyKeysData;
  this.tracker = new RowTracker();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:FuzzyRowFilter.java

示例2: checkForReservedVisibilityTagPresence

import org.apache.hadoop.hbase.util.Pair; //导入方法依赖的package包/类
/**
 * Checks whether cell contains any tag with type as VISIBILITY_TAG_TYPE. This
 * tag type is reserved and should not be explicitly set by user.
 *
 * @param cell
 *          - the cell under consideration
 * @param pair - an optional pair of type <Boolean, Tag> which would be reused
 *               if already set and new one will be created if null is passed
 * @return a pair<Boolean, Tag> - if the boolean is false then it indicates
 *         that the cell has a RESERVERD_VIS_TAG and with boolean as true, not
 *         null tag indicates that a string modified tag was found.
 */
private Pair<Boolean, Tag> checkForReservedVisibilityTagPresence(Cell cell,
    Pair<Boolean, Tag> pair) throws IOException {
  if (pair == null) {
    pair = new Pair<Boolean, Tag>(false, null);
  } else {
    pair.setFirst(false);
    pair.setSecond(null);
  }
  // Bypass this check when the operation is done by a system/super user.
  // This is done because, while Replication, the Cells coming to the peer cluster with reserved
  // typed tags and this is fine and should get added to the peer cluster table
  if (isSystemOrSuperUser()) {
    // Does the cell contain special tag which indicates that the replicated
    // cell visiblilty tags
    // have been modified
    Tag modifiedTag = null;
    if (cell.getTagsLength() > 0) {
      Iterator<Tag> tagsIterator = CellUtil.tagsIterator(cell.getTagsArray(),
          cell.getTagsOffset(), cell.getTagsLength());
      while (tagsIterator.hasNext()) {
        Tag tag = tagsIterator.next();
        if (tag.getType() == TagType.STRING_VIS_TAG_TYPE) {
          modifiedTag = tag;
          break;
        }
      }
    }
    pair.setFirst(true);
    pair.setSecond(modifiedTag);
    return pair;
  }
  if (cell.getTagsLength() > 0) {
    Iterator<Tag> tagsItr = CellUtil.tagsIterator(cell.getTagsArray(), cell.getTagsOffset(),
        cell.getTagsLength());
    while (tagsItr.hasNext()) {
      if (RESERVED_VIS_TAG_TYPES.contains(tagsItr.next().getType())) {
        return pair;
      }
    }
  }
  pair.setFirst(true);
  return pair;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:56,代码来源:VisibilityController.java


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