com.google.common.primitives.UnsignedBytes#lexicographicalComparator ( )源码实例Demo

下面列出了com.google.common.primitives.UnsignedBytes#lexicographicalComparator ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: geowave   文件: ByteLexicoderTest.java
public ByteLexicoderTest() {
  super(
      Lexicoders.BYTE,
      Byte.MIN_VALUE,
      Byte.MAX_VALUE,
      new Byte[] {
          (byte) -10,
          Byte.MIN_VALUE,
          (byte) 11,
          (byte) -122,
          (byte) 122,
          (byte) -100,
          (byte) 100,
          Byte.MAX_VALUE,
          (byte) 0},
      UnsignedBytes.lexicographicalComparator());
}
 
源代码2 项目: geowave   文件: DoubleLexicoderTest.java
public DoubleLexicoderTest() {
  super(
      Lexicoders.DOUBLE,
      -Double.MAX_VALUE,
      Double.MAX_VALUE,
      new Double[] {
          -10d,
          -Double.MAX_VALUE,
          11d,
          -14.2,
          14.2,
          -100.002,
          100.002,
          -11d,
          Double.MAX_VALUE,
          0d},
      UnsignedBytes.lexicographicalComparator());
}
 
源代码3 项目: geowave   文件: FloatLexicoderTest.java
public FloatLexicoderTest() {
  super(
      Lexicoders.FLOAT,
      -Float.MAX_VALUE,
      Float.MAX_VALUE,
      new Float[] {
          -10f,
          -Float.MAX_VALUE,
          11f,
          -14.2f,
          14.2f,
          -100.002f,
          100.002f,
          -11f,
          Float.MAX_VALUE,
          0f},
      UnsignedBytes.lexicographicalComparator());
}
 
源代码4 项目: Qora   文件: TransactionMap.java
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void createIndexes(DB database)
{
	//TIMESTAMP INDEX
	Tuple2Comparator<Long, byte[]> comparator = new Fun.Tuple2Comparator<Long, byte[]>(Fun.COMPARATOR, UnsignedBytes.lexicographicalComparator());
	NavigableSet<Tuple2<Integer, byte[]>> heightIndex = database.createTreeSet("transactions_index_timestamp")
			.comparator(comparator)
			.makeOrGet();
			
	NavigableSet<Tuple2<Integer, byte[]>> descendingHeightIndex = database.createTreeSet("transactions_index_timestamp_descending")
			.comparator(new ReverseComparator(comparator))
			.makeOrGet();
			
	createIndex(TIMESTAMP_INDEX, heightIndex, descendingHeightIndex, new Fun.Function2<Long, byte[], Transaction>() {
	   	@Override
	    public Long run(byte[] key, Transaction value) {
	   		return value.getTimestamp();
	    }
	});
}
 
源代码5 项目: phoenix-tephra   文件: WriteFence.java
@Override
public void startTx(Transaction tx) {
  this.tx = tx;
  if (inProgressChanges == null) {
    inProgressChanges = new TreeSet<>(UnsignedBytes.lexicographicalComparator());
    for (long inProgressTx : tx.getInProgress()) {
      inProgressChanges.add(Bytes.concat(fenceId, Longs.toByteArray(inProgressTx)));
    }
  }
}
 
源代码6 项目: geowave   文件: ShortLexicoderTest.java
public ShortLexicoderTest() {
  super(
      Lexicoders.SHORT,
      Short.MIN_VALUE,
      Short.MAX_VALUE,
      new Short[] {(short) -10, Short.MIN_VALUE, (short) 2678, Short.MAX_VALUE, (short) 0},
      UnsignedBytes.lexicographicalComparator());
}
 
源代码7 项目: ethereumj   文件: ByteArrayWrapperTest.java
@Test
public void testEqualsPerformance() {
	boolean testEnabled = false;
	
	if(testEnabled) {
		final int ITERATIONS = 10000000;
		long start1 = System.currentTimeMillis();
		for (int i = 0; i < ITERATIONS; i++) {
			Comparator<byte[]> comparator = UnsignedBytes
					.lexicographicalComparator();

			comparator.compare(wrapper1.getData(),
					wrapper2.getData());
		}
		System.out.println(System.currentTimeMillis() - start1 + "ms");
		
		long start2 = System.currentTimeMillis();
		for (int i = 0; i < ITERATIONS; i++) {
			Arrays.equals(wrapper1.getData(), wrapper2.getData());
		}
		System.out.println(System.currentTimeMillis() - start2 + "ms");
		
		long start3 = System.currentTimeMillis();
		for (int i = 0; i < ITERATIONS; i++) {
			FastByteComparisons.compareTo(wrapper1.getData(), 0, wrapper1.getData().length, wrapper2.getData(), 0, wrapper1.getData().length);
		}
		System.out.println(System.currentTimeMillis() - start3 + "ms");
	}
}
 
源代码8 项目: Qora   文件: TransactionDatabase.java
public TransactionDatabase(TransactionDatabase parent)
{
	this.parent = parent;
    
    //OPEN MAP
    this.transactionMap = new TreeMap<byte[], byte[]>(UnsignedBytes.lexicographicalComparator());
}
 
源代码9 项目: geowave   文件: LongLexicoderTest.java
public LongLexicoderTest() {
  super(
      Lexicoders.LONG,
      Long.MIN_VALUE,
      Long.MAX_VALUE,
      new Long[] {-10l, Long.MIN_VALUE, 2678l, Long.MAX_VALUE, 0l},
      UnsignedBytes.lexicographicalComparator());
}
 
源代码10 项目: bitherj   文件: ScriptBuilder.java
/**
 * Creates redeem script with given public keys and threshold. Given public keys will be placed in
 * redeem script in the lexicographical sorting order.
 */
public static Script createRedeemScript(int threshold, List<byte[]> pubkeys) {
    pubkeys = new ArrayList<byte[]>(pubkeys);
    final Comparator comparator = UnsignedBytes.lexicographicalComparator();
    Collections.sort(pubkeys, new Comparator<byte[]>() {
        @Override
        public int compare(byte[] k1, byte[] k2) {
            return comparator.compare(k1, k2);
        }
    });

    return ScriptBuilder.createMultiSigOutputScript(threshold, pubkeys);
}
 
源代码11 项目: Qora   文件: IssueAssetMap.java
@Override
protected Map<byte[], Long> getMemoryMap() 
{
	return new TreeMap<byte[], Long>(UnsignedBytes.lexicographicalComparator());
}
 
源代码12 项目: dhcp4j   文件: Subnet.java
public boolean rangeContains(@Nonnull byte[] address) {
    Comparator<byte[]> comparator = UnsignedBytes.lexicographicalComparator();
    return (comparator.compare(address, getRangeStart().getAddress()) >= 0)
            && (comparator.compare(address, getRangeEnd().getAddress()) <= 0);
}
 
源代码13 项目: Qora   文件: ChildMap.java
@Override
protected Map<byte[], byte[]> getMemoryMap() 
{
	return new TreeMap<byte[], byte[]>(UnsignedBytes.lexicographicalComparator());
}
 
源代码14 项目: Qora   文件: BlockMap.java
@Override
protected Map<byte[], Block> getMemoryMap() 
{
	return new TreeMap<byte[], Block>(UnsignedBytes.lexicographicalComparator());
}
 
源代码15 项目: Qora   文件: TransactionParentMap.java
@Override
protected Map<byte[], byte[]> getMemoryMap() 
{
	return new TreeMap<byte[], byte[]>(UnsignedBytes.lexicographicalComparator());
}
 
源代码16 项目: Qora   文件: VoteOnPollMap.java
@Override
protected Map<byte[], Integer> getMemoryMap() 
{
	return new TreeMap<byte[], Integer>(UnsignedBytes.lexicographicalComparator());
}
 
源代码17 项目: Qora   文件: PeerMap.java
@Override
protected Map<byte[], byte[]> getMemoryMap() 
{
	return new TreeMap<byte[], byte[]>(UnsignedBytes.lexicographicalComparator());
}
 
源代码18 项目: dhcp4j   文件: Subnet.java
public boolean rangeContains(@Nonnull byte[] address) {
    Comparator<byte[]> comparator = UnsignedBytes.lexicographicalComparator();
    return (comparator.compare(address, getRangeStart().getAddress()) >= 0)
            && (comparator.compare(address, getRangeEnd().getAddress()) <= 0);
}
 
源代码19 项目: Qora   文件: UpdateNameMap.java
@Override
protected Map<byte[], Name> getMemoryMap() 
{
	return new TreeMap<byte[], Name>(UnsignedBytes.lexicographicalComparator());
}
 
源代码20 项目: Qora   文件: TransactionMap.java
@Override
protected Map<byte[], Transaction> getMemoryMap() 
{
	return new TreeMap<byte[], Transaction>(UnsignedBytes.lexicographicalComparator());
}