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

The following are Jave code examples for showing how to use getLeastSignificantBits() 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: mp4parser_android   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: BaseClient   File: EntityLiving.java   View Source Code Vote up 6 votes
public EntityLiving(World worldIn)
{
    super(worldIn);
    this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null);
    this.lookHelper = new EntityLookHelper(this);
    this.moveHelper = new EntityMoveHelper(this);
    this.jumpHelper = new EntityJumpHelper(this);
    this.bodyHelper = new EntityBodyHelper(this);
    this.navigator = this.getNewNavigator(worldIn);
    this.senses = new EntitySenses(this);

    for (int i = 0; i < this.equipmentDropChances.length; ++i)
    {
        this.equipmentDropChances[i] = 0.085F;
    }

    UUID uuid = this.getUniqueID();
    long j = uuid.getLeastSignificantBits();
    this.randomMobsId = (int)(j & 2147483647L);
}
 
Example 3
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 4
Project: monarch   File: VMThinLRURegionEntryOffHeapUUIDKey.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: VMStatsRegionEntryHeapUUIDKey.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: act-platform   File: IdMapper.java   View Source Code Vote up 5 votes
/**
 * Maps a global UUID to a numeric internal ID.
 *
 * @param id Global ID, must not be null.
 * @return Mapped internal ID
 */
public static long toInternalID(UUID id) {
  if (id == null) throw new IllegalArgumentException("id must not be null.");
  if (id.getMostSignificantBits() != 0) throw new IllegalArgumentException("most significant bits must not be set.");
  if (id.getLeastSignificantBits() < 0) throw new IllegalArgumentException("least significant bits must not be negative.");
  return id.getLeastSignificantBits();
}
 
Example 7
Project: monarch   File: VersionedThinRegionEntryOffHeapUUIDKey.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 8
Project: monarch   File: VersionedThinDiskLRURegionEntryOffHeapUUIDKey.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 9
Project: monarch   File: VMThinDiskLRURegionEntryOffHeapUUIDKey.java   View Source Code Vote up 5 votes
public VMThinDiskLRURegionEntryOffHeapUUIDKey(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 10
Project: monarch   File: VersionedStatsRegionEntryOffHeapUUIDKey.java   View Source Code Vote up 5 votes
public VersionedStatsRegionEntryOffHeapUUIDKey(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 11
Project: monarch   File: VersionedStatsDiskRegionEntryHeapUUIDKey.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: VersionedStatsDiskRegionEntryHeapUUIDKey.java   View Source Code Vote up 5 votes
public VersionedStatsDiskRegionEntryHeapUUIDKey(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 13
Project: monarch   File: VersionedStatsDiskLRURegionEntryHeapUUIDKey.java   View Source Code Vote up 5 votes
public VersionedStatsDiskLRURegionEntryHeapUUIDKey(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 14
Project: monarch   File: VersionedThinDiskRegionEntryHeapUUIDKey.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 15
Project: monarch   File: VersionedStatsRegionEntryOffHeapUUIDKey.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: VMThinDiskRegionEntryHeapUUIDKey.java   View Source Code Vote up 5 votes
public VMThinDiskRegionEntryHeapUUIDKey(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 17
Project: monarch   File: VMThinDiskRegionEntryOffHeapUUIDKey.java   View Source Code Vote up 5 votes
public VMThinDiskRegionEntryOffHeapUUIDKey(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 18
Project: monarch   File: VMThinLRURegionEntryHeapUUIDKey.java   View Source Code Vote up 4 votes
public VMThinLRURegionEntryHeapUUIDKey(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 19
Project: monarch   File: VMStatsLRURegionEntryHeapUUIDKey.java   View Source Code Vote up 4 votes
public VMStatsLRURegionEntryHeapUUIDKey(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 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();
}