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


Java CompareOp.LESS属性代码示例

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


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

示例1: fromFilter

public static Range[] fromFilter(SingleColumnValueFilter filter) {
  if (!(filter.getComparator() instanceof BinaryComparator)) {
    return new Range[0];
  }

  byte[] column = KeyValue.makeColumn(filter.getFamily(), filter.getQualifier());
  CompareOp compareOp = filter.getOperator();
  byte[] value = filter.getComparator().getValue();

  if (compareOp == CompareOp.NOT_EQUAL) {
    return new Range[] { new Range(column, null, CompareOp.NO_OP, value, CompareOp.LESS),
        new Range(column, value, CompareOp.GREATER, null, CompareOp.NO_OP) };
  } else {
    switch (compareOp) {
    case EQUAL:
    case GREATER_OR_EQUAL:
    case GREATER:
      return new Range[] { new Range(column, value, compareOp, null, CompareOp.NO_OP) };
    case LESS:
    case LESS_OR_EQUAL:
      return new Range[] { new Range(column, null, CompareOp.NO_OP, value, compareOp) };
    default:
      return new Range[0];
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:Range.java

示例2: createCompareOp

/**
* Takes a compareOperator symbol as a byte array and returns the corresponding CompareOperator
* <p>
* @param compareOpAsByteArray the comparatorOperator symbol as a byte array
* @return the Compare Operator
*/
 public static CompareFilter.CompareOp createCompareOp (byte [] compareOpAsByteArray) {
   ByteBuffer compareOp = ByteBuffer.wrap(compareOpAsByteArray);
   if (compareOp.equals(ParseConstants.LESS_THAN_BUFFER))
     return CompareOp.LESS;
   else if (compareOp.equals(ParseConstants.LESS_THAN_OR_EQUAL_TO_BUFFER))
     return CompareOp.LESS_OR_EQUAL;
   else if (compareOp.equals(ParseConstants.GREATER_THAN_BUFFER))
     return CompareOp.GREATER;
   else if (compareOp.equals(ParseConstants.GREATER_THAN_OR_EQUAL_TO_BUFFER))
     return CompareOp.GREATER_OR_EQUAL;
   else if (compareOp.equals(ParseConstants.NOT_EQUAL_TO_BUFFER))
     return CompareOp.NOT_EQUAL;
   else if (compareOp.equals(ParseConstants.EQUAL_TO_BUFFER))
     return CompareOp.EQUAL;
   else
     throw new IllegalArgumentException("Invalid compare operator");
 }
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:ParseFilter.java

示例3: setStartType

/**
 * Set start type for start value.
 * @param startType - can only be EQUAL, GREATER, GREATER_OR_EQUAL or NO_OP
 */
public void setStartType(CompareOp startType) {
  if (startType == CompareOp.LESS || startType == CompareOp.LESS_OR_EQUAL
      || startType == CompareOp.NOT_EQUAL) {
    throw new IllegalArgumentException("Illegal start type: " + startType.toString());
  }
  this.startType = startType;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:Range.java

示例4: setEndType

/**
 * Set end type for end value.
 *
 * @param endType - can only be LESS or LESS_OR_EQUAL
 */
public void setEndType(CompareOp endType) {
  if (endType == CompareOp.LESS || endType == CompareOp.LESS_OR_EQUAL) {
    this.endType = endType;
  } else {
    this.endType = endType;
    //			throw new IllegalArgumentException("Illegal end type: "
    //					+ endType.toString());
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:Range.java

示例5: getOpsite

public Range getOpsite() {
  Range ran = new Range();
  ran.column = this.column;
  ran.valueType = this.valueType;
  ran.startValue = this.endValue;
  ran.endValue = this.startValue;
  ran.setStartTs(startTs);
  ran.setEndTs(endTs);
  ran.setLatestVersionOnly(latestVersionOnly);
  ran.setFilterIfMissing(filterIfMissing);

  if (ran.valueType == DataType.BOOLEAN) {
    if (Bytes.toString(this.startValue).equals("true")) {
      ran.startValue = Bytes.toBytes("false");
    } else if (Bytes.toString(this.startValue).equals("false")) {
      ran.startValue = Bytes.toBytes("true");
    }
    ran.startType = CompareOp.EQUAL;
    return ran;
  }
  if (this.startValue != null && this.startValue.length != 0) {
    switch (this.startType) {
    case EQUAL:
      ran.startType = CompareOp.GREATER;
      ran.startValue = this.startValue;
      ran.endValue = this.startValue;
      ran.endType = CompareOp.LESS;
      break;
    case GREATER_OR_EQUAL:
      ran.endType = CompareOp.LESS;
      break;
    case GREATER:
      ran.endType = CompareOp.LESS_OR_EQUAL;
      break;
    default:
      break;
    }
  }
  if (this.endValue != null && this.endValue.length != 0) {
    switch (this.endType) {
    case LESS:
      ran.startType = CompareOp.GREATER_OR_EQUAL;
      break;
    case LESS_OR_EQUAL:
      ran.startType = CompareOp.GREATER;
      break;
    default:
      break;
    }
  }

  return ran;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:53,代码来源:Range.java


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