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


Java Order.ASCENDING属性代码示例

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


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

示例1: testReadWriteNonSkippable

@Test
public void testReadWriteNonSkippable() {
  PositionedByteRange buff = new SimplePositionedMutableByteRange(12);
  for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
    for (byte[] term : TERMINATORS) {
      for (byte[] val : VALUES_BYTES) {
        buff.setPosition(0);
        DataType<byte[]> type = new TerminatedWrapper<byte[]>(new RawBytes(ord), term);
        assertEquals(val.length + term.length, type.encode(buff, val));
        buff.setPosition(0);
        assertArrayEquals(val, type.decode(buff));
        assertEquals(val.length + term.length, buff.getPosition());
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:TestTerminatedWrapper.java

示例2: testSkipNonSkippable

@Test
public void testSkipNonSkippable() {
  PositionedByteRange buff = new SimplePositionedMutableByteRange(12);
  for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
    for (byte[] term : TERMINATORS) {
      for (byte[] val : VALUES_BYTES) {
        buff.setPosition(0);
        DataType<byte[]> type = new TerminatedWrapper<byte[]>(new RawBytes(ord), term);
        int expected = type.encode(buff, val);
        buff.setPosition(0);
        assertEquals(expected, type.skip(buff));
        assertEquals(expected, buff.getPosition());
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:TestTerminatedWrapper.java

示例3: testReadWrite

@Test
public void testReadWrite() {
  for (int limit : limits) {
    PositionedByteRange buff = new SimplePositionedMutableByteRange(limit);
    for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
      for (byte[] val : VALUES) {
        buff.setPosition(0);
        DataType<byte[]> type = new FixedLengthWrapper<byte[]>(new RawBytes(ord), limit);
        assertEquals(limit, type.encode(buff, val));
        buff.setPosition(0);
        byte[] actual = type.decode(buff);
        assertTrue("Decoding output differs from expected", 
          Bytes.equals(val, 0, val.length, actual, 0, val.length));
        buff.setPosition(0);
        assertEquals(limit, type.skip(buff));
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:TestFixedLengthWrapper.java

示例4: testReadWrite

@Test
public void testReadWrite() {
  for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
    RawString type =
        Order.ASCENDING == ord ? RawString.ASCENDING : RawString.DESCENDING;
    for (String val : VALUES) {
      PositionedByteRange buff = new SimplePositionedMutableByteRange(Bytes.toBytes(val).length);
      assertEquals(buff.getLength(), type.encode(buff, val));
      byte[] expected = Bytes.toBytes(val);
      ord.apply(expected);
      assertArrayEquals(expected, buff.getBytes());
      buff.setPosition(0);
      assertEquals(val, type.decode(buff));
      buff.setPosition(0);
      assertEquals(buff.getLength(), type.skip(buff));
      assertEquals(buff.getLength(), buff.getPosition());
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:TestRawString.java

示例5: testReadWriteNonSkippable

@Test
public void testReadWriteNonSkippable() {
  PositionedByteRange buff = new SimplePositionedByteRange(12);
  for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
    for (byte[] term : TERMINATORS) {
      for (byte[] val : VALUES_BYTES) {
        buff.setPosition(0);
        DataType<byte[]> type = new TerminatedWrapper<byte[]>(new RawBytes(ord), term);
        assertEquals(val.length + term.length, type.encode(buff, val));
        buff.setPosition(0);
        assertArrayEquals(val, type.decode(buff));
        assertEquals(val.length + term.length, buff.getPosition());
      }
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:16,代码来源:TestTerminatedWrapper.java

示例6: testSkipNonSkippable

@Test
public void testSkipNonSkippable() {
  PositionedByteRange buff = new SimplePositionedByteRange(12);
  for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
    for (byte[] term : TERMINATORS) {
      for (byte[] val : VALUES_BYTES) {
        buff.setPosition(0);
        DataType<byte[]> type = new TerminatedWrapper<byte[]>(new RawBytes(ord), term);
        int expected = type.encode(buff, val);
        buff.setPosition(0);
        assertEquals(expected, type.skip(buff));
        assertEquals(expected, buff.getPosition());
      }
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:16,代码来源:TestTerminatedWrapper.java

示例7: testReadWrite

@Test
public void testReadWrite() {
  for (int limit : limits) {
    PositionedByteRange buff = new SimplePositionedByteRange(limit);
    for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
      for (byte[] val : VALUES) {
        buff.setPosition(0);
        DataType<byte[]> type = new FixedLengthWrapper<byte[]>(new RawBytes(ord), limit);
        assertEquals(limit, type.encode(buff, val));
        buff.setPosition(0);
        byte[] actual = type.decode(buff);
        assertTrue("Decoding output differs from expected", 
          Bytes.equals(val, 0, val.length, actual, 0, val.length));
        buff.setPosition(0);
        assertEquals(limit, type.skip(buff));
      }
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:19,代码来源:TestFixedLengthWrapper.java

示例8: testReadWrite

@Test
public void testReadWrite() {
  for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
    RawString type =
        Order.ASCENDING == ord ? RawString.ASCENDING : RawString.DESCENDING;
    for (String val : VALUES) {
      PositionedByteRange buff = new SimplePositionedByteRange(Bytes.toBytes(val).length);
      assertEquals(buff.getLength(), type.encode(buff, val));
      byte[] expected = Bytes.toBytes(val);
      ord.apply(expected);
      assertArrayEquals(expected, buff.getBytes());
      buff.setPosition(0);
      assertEquals(val, type.decode(buff));
      buff.setPosition(0);
      assertEquals(buff.getLength(), type.skip(buff));
      assertEquals(buff.getLength(), buff.getPosition());
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:19,代码来源:TestRawString.java

示例9: testSkipNonSkippable

@Test
public void testSkipNonSkippable() {
  PositionedByteRange buff = new SimplePositionedMutableByteRange(12);
  for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
    for (byte[] term : TERMINATORS) {
      for (byte[] val : VALUES_BYTES) {
        buff.setPosition(0);
        DataType<byte[]> type = new TerminatedWrapper<>(new RawBytes(ord), term);
        int expected = type.encode(buff, val);
        buff.setPosition(0);
        assertEquals(expected, type.skip(buff));
        assertEquals(expected, buff.getPosition());
      }
    }
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:16,代码来源:TestTerminatedWrapper.java

示例10: testReadWrite

@Test
public void testReadWrite() {
  for (int limit : limits) {
    PositionedByteRange buff = new SimplePositionedByteRange(limit);
    for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
      for (byte[] val : VALUES) {
        buff.setPosition(0);
        DataType<byte[]> type = new FixedLengthWrapper<byte[]>(new RawBytes(ord), limit);
        assertEquals(limit, type.encode(buff, val));
        byte[] expected = Arrays.copyOf(val, limit);
        buff.setPosition(0);
        byte[] actual = type.decode(buff);
        assertArrayEquals(expected, actual);
        buff.setPosition(0);
        assertEquals(limit, type.skip(buff));
      }
    }
  }
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:19,代码来源:TestFixedLengthWrapper.java

示例11: decode

@Override
public String decode(PositionedByteRange src) {
  if (Order.ASCENDING == this.order) {
    // avoid unnecessary array copy for ASC case.
    String val =
        Bytes.toString(src.getBytes(), src.getOffset() + src.getPosition(), src.getRemaining());
    src.setPosition(src.getLength());
    return val;
  } else {
    byte[] b = new byte[src.getRemaining()];
    src.get(b);
    order.apply(b, 0, b.length);
    return Bytes.toString(b);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:15,代码来源:RawString.java

示例12: encodedLength

@Override
public int encodedLength(byte[] val) {
  return null == val ?
    (Order.ASCENDING == order ? 1 : 2) :
    (Order.ASCENDING == order ? val.length + 1 : val.length + 2);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:6,代码来源:OrderedBlob.java

示例13: RawString

protected RawString() {
  this.order = Order.ASCENDING;
}
 
开发者ID:apache,项目名称:hbase,代码行数:3,代码来源:RawString.java

示例14: RawBytes

protected RawBytes() {
  this.order = Order.ASCENDING;
}
 
开发者ID:apache,项目名称:hbase,代码行数:3,代码来源:RawBytes.java

示例15: RawString

protected RawString() { this.order = Order.ASCENDING; } 
开发者ID:fengchen8086,项目名称:ditb,代码行数:1,代码来源:RawString.java


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