Java Code Examples for java.util.UUID.getMostSignificantBits()

The following are Jave code examples for showing how to use getMostSignificantBits() of the java.util.UUID class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: live_master   File: UUIDConverter.java   View Source Code Vote up 6 votes
public static byte[] convert(UUID uuid) {

        long msb = uuid.getMostSignificantBits();
        long lsb = uuid.getLeastSignificantBits();
        byte[] buffer = new byte[16];

        for (int i = 0; i < 8; i++) {
            buffer[i] = (byte) (msb >>> 8 * (7 - i));
        }
        for (int i = 8; i < 16; i++) {
            buffer[i] = (byte) (lsb >>> 8 * (7 - i));
        }

        return buffer;

    }
 
Example 2
Project: monarch   File: VersionedStatsLRURegionEntryHeapUUIDKey.java   View Source Code Vote up 5 votes
public VersionedStatsLRURegionEntryHeapUUIDKey(RegionEntryContext context, UUID key,
    Object value) {
  super(context, value);
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
  this.keyMostSigBits = key.getMostSignificantBits();
  this.keyLeastSigBits = key.getLeastSignificantBits();
}
 
Example 3
Project: Note   File: NoteNotification.java   View Source Code Vote up 5 votes
public NoteNotification(String parentId, String notificationContent, Long delay) {
    this.content = notificationContent;
    this.delay = delay;
    UUID uuid = UUID.randomUUID();
    this.parentId = parentId;
    this.id = (int)(uuid.getMostSignificantBits() + uuid.getLeastSignificantBits());
}
 
Example 4
Project: monarch   File: VersionedStatsDiskLRURegionEntryOffHeapUUIDKey.java   View Source Code Vote up 5 votes
@Override
public boolean isKeyEqual(Object k) {
  if (k instanceof UUID) {
    UUID uuid = (UUID) k;
    return uuid.getLeastSignificantBits() == this.keyLeastSigBits
        && uuid.getMostSignificantBits() == this.keyMostSigBits;
  }
  return false;
}
 
Example 5
Project: monarch   File: VersionedThinDiskRegionEntryOffHeapUUIDKey.java   View Source Code Vote up 5 votes
@Override
public boolean isKeyEqual(Object k) {
  if (k instanceof UUID) {
    UUID uuid = (UUID) k;
    return uuid.getLeastSignificantBits() == this.keyLeastSigBits
        && uuid.getMostSignificantBits() == this.keyMostSigBits;
  }
  return false;
}
 
Example 6
Project: monarch   File: VMStatsDiskLRURegionEntryHeapUUIDKey.java   View Source Code Vote up 5 votes
@Override
public boolean isKeyEqual(Object k) {
  if (k instanceof UUID) {
    UUID uuid = (UUID) k;
    return uuid.getLeastSignificantBits() == this.keyLeastSigBits
        && uuid.getMostSignificantBits() == this.keyMostSigBits;
  }
  return false;
}
 
Example 7
Project: skylla   File: SkyllaBuffer.java   View Source Code Vote up 5 votes
public void writeUniqueId(UUID uniqueId) {
    long most = uniqueId.getMostSignificantBits();
    long least = uniqueId.getLeastSignificantBits();

    this.writeLong(most);
    this.writeLong(least);
}
 
Example 8
Project: monarch   File: VMStatsDiskLRURegionEntryHeapUUIDKey.java   View Source Code Vote up 5 votes
public VMStatsDiskLRURegionEntryHeapUUIDKey(RegionEntryContext context, UUID key, Object value) {
  super(context, (value instanceof RecoveredEntry ? null : value));
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
  initialize(context, value);
  this.keyMostSigBits = key.getMostSignificantBits();
  this.keyLeastSigBits = key.getLeastSignificantBits();
}
 
Example 9
Project: AndroidMuseumBleManager   File: ScanFilterCompat.java   View Source Code Vote up 5 votes
private boolean matchesServiceUuid(UUID uuid, UUID mask, UUID data) {
    if (mask == null) {
        return uuid.equals(data);
    }
    if ((uuid.getLeastSignificantBits() & mask.getLeastSignificantBits()) !=
            (data.getLeastSignificantBits() & mask.getLeastSignificantBits())) {
        return false;
    }
    return ((uuid.getMostSignificantBits() & mask.getMostSignificantBits()) ==
            (data.getMostSignificantBits() & mask.getMostSignificantBits()));
}
 
Example 10
Project: monarch   File: VMThinRegionEntryOffHeapUUIDKey.java   View Source Code Vote up 5 votes
@Override
public boolean isKeyEqual(Object k) {
  if (k instanceof UUID) {
    UUID uuid = (UUID) k;
    return uuid.getLeastSignificantBits() == this.keyLeastSigBits
        && uuid.getMostSignificantBits() == this.keyMostSigBits;
  }
  return false;
}
 
Example 11
Project: monarch   File: VersionedStatsRegionEntryHeapUUIDKey.java   View Source Code Vote up 5 votes
@Override
public boolean isKeyEqual(Object k) {
  if (k instanceof UUID) {
    UUID uuid = (UUID) k;
    return uuid.getLeastSignificantBits() == this.keyLeastSigBits
        && uuid.getMostSignificantBits() == this.keyMostSigBits;
  }
  return false;
}
 
Example 12
Project: monarch   File: VersionedThinLRURegionEntryOffHeapUUIDKey.java   View Source Code Vote up 5 votes
@Override
public boolean isKeyEqual(Object k) {
  if (k instanceof UUID) {
    UUID uuid = (UUID) k;
    return uuid.getLeastSignificantBits() == this.keyLeastSigBits
        && uuid.getMostSignificantBits() == this.keyMostSigBits;
  }
  return false;
}
 
Example 13
Project: monarch   File: VMThinRegionEntryOffHeapUUIDKey.java   View Source Code Vote up 5 votes
public VMThinRegionEntryOffHeapUUIDKey(RegionEntryContext context, UUID key,
    @Retained Object value) {
  super(context, value);
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
  this.keyMostSigBits = key.getMostSignificantBits();
  this.keyLeastSigBits = key.getLeastSignificantBits();
}
 
Example 14
Project: monarch   File: VMStatsLRURegionEntryOffHeapUUIDKey.java   View Source Code Vote up 5 votes
public VMStatsLRURegionEntryOffHeapUUIDKey(RegionEntryContext context, UUID key,
    @Retained Object value) {
  super(context, value);
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
  this.keyMostSigBits = key.getMostSignificantBits();
  this.keyLeastSigBits = key.getLeastSignificantBits();
}
 
Example 15
Project: monarch   File: VersionedThinLRURegionEntryHeapUUIDKey.java   View Source Code Vote up 5 votes
@Override
public boolean isKeyEqual(Object k) {
  if (k instanceof UUID) {
    UUID uuid = (UUID) k;
    return uuid.getLeastSignificantBits() == this.keyLeastSigBits
        && uuid.getMostSignificantBits() == this.keyMostSigBits;
  }
  return false;
}
 
Example 16
Project: monarch   File: VMStatsDiskRegionEntryOffHeapUUIDKey.java   View Source Code Vote up 5 votes
public VMStatsDiskRegionEntryOffHeapUUIDKey(RegionEntryContext context, UUID key,
    @Retained Object value) {
  super(context, (value instanceof RecoveredEntry ? null : value));
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
  initialize(context, value);
  this.keyMostSigBits = key.getMostSignificantBits();
  this.keyLeastSigBits = key.getLeastSignificantBits();
}
 
Example 17
Project: monarch   File: VMThinDiskLRURegionEntryOffHeapUUIDKey.java   View Source Code Vote up 5 votes
@Override
public boolean isKeyEqual(Object k) {
  if (k instanceof UUID) {
    UUID uuid = (UUID) k;
    return uuid.getLeastSignificantBits() == this.keyLeastSigBits
        && uuid.getMostSignificantBits() == this.keyMostSigBits;
  }
  return false;
}
 
Example 18
Project: jetfuel   File: Base36Tests.java   View Source Code Vote up 4 votes
@Test
public void testFormats() {

	UUID uid = UUID.randomUUID();

	long hi = uid.getMostSignificantBits();
	long lo = uid.getLeastSignificantBits();

	String shi = Long.toString(hi, 36);
	String slo = Long.toString(lo, 36);

	System.out.println(shi);
	System.out.println(slo);

	System.out.println(shi + slo);

	System.out.println(Long.toString(Long.MAX_VALUE, 36));

}
 
Example 19
Project: noise   File: BluetoothSyncService.java   View Source Code Vote up 4 votes
private static boolean matchesServiceUuid(UUID uuid) {
    return SERVICE_UUID_HALF.getMostSignificantBits() == uuid.getMostSignificantBits();
}
 
Example 20
Project: monarch   File: VersionedStatsRegionEntryHeapUUIDKey.java   View Source Code Vote up 4 votes
public VersionedStatsRegionEntryHeapUUIDKey(RegionEntryContext context, UUID key, Object value) {
  super(context, value);
  // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
  this.keyMostSigBits = key.getMostSignificantBits();
  this.keyLeastSigBits = key.getLeastSignificantBits();
}