Class: JavaClass::LineNumberTableAttribute
- Defined in:
- lib/javaclass/attribute.rb
Overview
行番号属性
Instance Attribute Summary collapse
-
#line_numbers ⇒ Object
Returns the value of attribute line_numbers.
Attributes inherited from Attribute
Instance Method Summary collapse
-
#initialize(java_class, name_index, line_numbers = []) ⇒ LineNumberTableAttribute
constructor
コンストラクタ.
-
#line_number(start_pc) ⇒ Object
start_pcに対応する位置の行番号オブジェクトがあればそれを返す。 *start_pc::コードの番号 戻り値::start_pcに対応する位置のソースの行番号オブジェクト。見つからなければnil.
- #to_bytes ⇒ Object
Methods inherited from Attribute
Methods included from Base
#==, #===, #dump, #eql?, #hash, #to_byte
Constructor Details
#initialize(java_class, name_index, line_numbers = []) ⇒ LineNumberTableAttribute
コンストラクタ
*java_class::属性の所有者であるJavaクラス *name_index::名前を示すconstant_poolのインデックス
871 872 873 874 |
# File 'lib/javaclass/attribute.rb', line 871 def initialize( java_class, name_index, line_numbers=[] ) super( java_class, name_index) @line_numbers = line_numbers end |
Instance Attribute Details
#line_numbers ⇒ Object
Returns the value of attribute line_numbers.
894 895 896 |
# File 'lib/javaclass/attribute.rb', line 894 def line_numbers @line_numbers end |
Instance Method Details
#line_number(start_pc) ⇒ Object
start_pcに対応する位置の行番号オブジェクトがあればそれを返す。
*start_pc::コードの番号 戻り値::start_pcに対応する位置のソースの行番号オブジェクト。見つからなければnil
880 881 882 883 884 |
# File 'lib/javaclass/attribute.rb', line 880 def line_number( start_pc ) return @line_numbers.find {|l| l.start_pc == start_pc } end |
#to_bytes ⇒ Object
885 886 887 888 889 890 891 892 893 |
# File 'lib/javaclass/attribute.rb', line 885 def to_bytes bytes = super body = to_byte( @line_numbers.length, 2 ) @line_numbers.each {|l| body += l.to_bytes() } bytes += to_byte( body.length, 4 ) bytes += body end |