Module: JavaClass::Base
- Included in:
- AccessFlag, Annotation, AnnotationElement, AnnotationElementValue, Attribute, Class, Constant, Excpetion, InnerClass, LineNumber, LocalVariable, LocalVariableType, Member
- Defined in:
- lib/javaclass/base.rb
Instance Method Summary collapse
-
#==(other) ⇒ Object
オブジェクト比較メソッド.
- #===(other) ⇒ Object
-
#dump ⇒ Object
16進数表現の文字列形式に変換する.
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#to_byte(value, length) ⇒ Object
0..255の数字の配列に変換する.
Instance Method Details
#==(other) ⇒ Object
オブジェクト比較メソッド
30 31 32 |
# File 'lib/javaclass/base.rb', line 30 def ==(other) _eql?(other) { |a,b| a == b } end |
#===(other) ⇒ Object
33 34 35 |
# File 'lib/javaclass/base.rb', line 33 def ===(other) _eql?(other) { |a,b| a === b } end |
#dump ⇒ Object
16進数表現の文字列形式に変換する
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/javaclass/base.rb', line 18 def dump() buff = "" i = 1 self.to_bytes().each {|b| buff << sprintf("%0.2X", b) buff << (i%16==0 ? "\n" : i%4==0 ? " " : "") i+=1 } return buff.strip end |
#eql?(other) ⇒ Boolean
36 37 38 |
# File 'lib/javaclass/base.rb', line 36 def eql?(other) _eql?(other) { |a,b| a.eql? b } end |
#hash ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/javaclass/base.rb', line 39 def hash hash = 0 values.each {|v| hash = v.hash + 31 * hash } return hash end |
#to_byte(value, length) ⇒ Object
0..255の数字の配列に変換する
7 8 9 10 11 12 13 14 15 |
# File 'lib/javaclass/base.rb', line 7 def to_byte( value, length ) return [0x00]*length if value == nil tmp = [] length.times {|i| tmp.unshift( value & 0xFF ) value >>= 8 } return tmp end |