Class: JavaClass::LocalVariable

Inherits:
Object
  • Object
show all
Includes:
Base, Converters
Defined in:
lib/javaclass/attribute.rb

Overview

ローカル変数

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Converters

convert_code, convert_field_descriptor, convert_method_descriptor

Methods included from Base

#==, #===, #dump, #eql?, #hash, #to_byte

Constructor Details

#initialize(java_class, start_pc = nil, length = nil, name_index = nil, descriptor_index = nil, index = nil) ⇒ LocalVariable

Returns a new instance of LocalVariable.



957
958
959
960
961
962
963
964
965
# File 'lib/javaclass/attribute.rb', line 957

def initialize( java_class, start_pc=nil, \
  length=nil, name_index=nil, descriptor_index=nil, index=nil )
  @java_class=java_class
  @start_pc = start_pc
  @length = length
  @name_index = name_index
  @descriptor_index = descriptor_index
  @index = index
end

Instance Attribute Details

#descriptor_indexObject

Returns the value of attribute descriptor_index.



985
986
987
# File 'lib/javaclass/attribute.rb', line 985

def descriptor_index
  @descriptor_index
end

#indexObject

Returns the value of attribute index.



986
987
988
# File 'lib/javaclass/attribute.rb', line 986

def index
  @index
end

#lengthObject

Returns the value of attribute length.



983
984
985
# File 'lib/javaclass/attribute.rb', line 983

def length
  @length
end

#name_indexObject

Returns the value of attribute name_index.



984
985
986
# File 'lib/javaclass/attribute.rb', line 984

def name_index
  @name_index
end

#start_pcObject

Returns the value of attribute start_pc.



982
983
984
# File 'lib/javaclass/attribute.rb', line 982

def start_pc
  @start_pc
end

Instance Method Details

#descriptorObject



972
973
974
# File 'lib/javaclass/attribute.rb', line 972

def descriptor
  @java_class.get_constant_value( @descriptor_index )
end

#nameObject



969
970
971
# File 'lib/javaclass/attribute.rb', line 969

def name
  @java_class.get_constant_value( @name_index )
end

#to_bytesObject



975
976
977
978
979
980
981
# File 'lib/javaclass/attribute.rb', line 975

def to_bytes
  bytes =  to_byte( @start_pc, 2 )
  bytes += to_byte( @length, 2 )
  bytes += to_byte( @name_index, 2 )
  bytes += to_byte( @descriptor_index, 2 )
  bytes += to_byte( @index, 2 )
end

#to_sObject



966
967
968
# File 'lib/javaclass/attribute.rb', line 966

def to_s
  "#{convert_field_descriptor(descriptor)} #{name}"
end