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のインデックス
867 868 869 870 |
# File 'lib/javaclass/attribute.rb', line 867 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.
890 891 892 |
# File 'lib/javaclass/attribute.rb', line 890 def line_numbers @line_numbers end |
Instance Method Details
#line_number(start_pc) ⇒ Object
start_pcに対応する位置の行番号オブジェクトがあればそれを返す。
*start_pc::コードの番号戻り値::start_pcに対応する位置のソースの行番号オブジェクト。見つからなければnil
876 877 878 879 880 |
# File 'lib/javaclass/attribute.rb', line 876 def line_number( start_pc ) return @line_numbers.find {|l| l.start_pc == start_pc } end |
#to_bytes ⇒ Object
881 882 883 884 885 886 887 888 889 |
# File 'lib/javaclass/attribute.rb', line 881 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 |