module AdbSdkLib::Common

@private

Constants

System

@private

Public Class Methods

convert_map_to_hash(object) { |hash, getKey, getValue| ... } click to toggle source

Converts Java Map object to Ruby Hash object.

# File lib/adb_sdklib/common.rb, line 78
def convert_map_to_hash(object, &block)
  hash = Hash.new
  i = object.entrySet.iterator
  if block_given?
    while i.hasNext
      entry = i.next
      yield hash, entry.getKey, entry.getValue
    end
  else
    while i.hasNext
      entry = i.next
      hash[entry.getKey] = entry.getValue
    end
  end
  hash
end
same_jobject?(obj1, obj2) click to toggle source

Inspects whether two objects are the same of Java instance.

# File lib/adb_sdklib/common.rb, line 72
def same_jobject?(obj1, obj2)
  System.identityHashCode(obj1) \
    == System.identityHashCode(obj2)
end

Private Instance Methods

convert_map_to_hash(object) { |hash, getKey, getValue| ... } click to toggle source

Converts Java Map object to Ruby Hash object.

# File lib/adb_sdklib/common.rb, line 78
def convert_map_to_hash(object, &block)
  hash = Hash.new
  i = object.entrySet.iterator
  if block_given?
    while i.hasNext
      entry = i.next
      yield hash, entry.getKey, entry.getValue
    end
  else
    while i.hasNext
      entry = i.next
      hash[entry.getKey] = entry.getValue
    end
  end
  hash
end
same_jobject?(obj1, obj2) click to toggle source

Inspects whether two objects are the same of Java instance.

# File lib/adb_sdklib/common.rb, line 72
def same_jobject?(obj1, obj2)
  System.identityHashCode(obj1) \
    == System.identityHashCode(obj2)
end