class Antlr4::Runtime::UUID

Attributes

lower[R]
upper[R]

Public Class Methods

decode(hex_string) click to toggle source
# File lib/antlr4/runtime/uuid.rb, line 42
def self.decode(hex_string)
  hex_string.to_i(16)
end
from_string(name) click to toggle source
# File lib/antlr4/runtime/uuid.rb, line 23
def self.from_string(name)
  components = name.split('-')
  if components.length != 5
    raise IllegalArgumentException, 'Invalid UUID string: ' + name
  end

  upper = decode(components[0])
  upper = upper << 16
  upper |= decode(components[1])
  upper = upper << 16
  upper |= decode(components[2])

  lower = decode(components[3])
  lower = lower << 48
  lower |= decode(components[4])

  UUID.new(upper, lower)
end
new(upper, lower) click to toggle source
# File lib/antlr4/runtime/uuid.rb, line 6
def initialize(upper, lower)
  @lower = lower
  @upper = upper
end

Public Instance Methods

==(other) click to toggle source
# File lib/antlr4/runtime/uuid.rb, line 15
def ==(other)
  if !other.nil?
    @lower == other.lower && @upper == other.upper
  else
    false
  end
end
to_s() click to toggle source
# File lib/antlr4/runtime/uuid.rb, line 11
def to_s
  @upper.to_s + @lower.to_s
end