Class: JavaClass::DoubleConstant

Inherits:
Constant
  • Object
show all
Defined in:
lib/javaclass/constant.rb

Overview

DoubleのConstant

Constant Summary

Constants inherited from Constant

Constant::CONSTANT_Class, Constant::CONSTANT_Double, Constant::CONSTANT_Fieldref, Constant::CONSTANT_Float, Constant::CONSTANT_Integer, Constant::CONSTANT_InterfaceMethodref, Constant::CONSTANT_Long, Constant::CONSTANT_Methodref, Constant::CONSTANT_NameAndType, Constant::CONSTANT_String, Constant::CONSTANT_Utf8

Instance Attribute Summary

Attributes inherited from Constant

#java_class, #tag

Instance Method Summary collapse

Methods included from Base

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

Constructor Details

#initialize(java_class, tag = nil, bytes = nil) ⇒ DoubleConstant

コンストラクタ

*java_class::constantの所有者であるJavaクラス *tag::constantの種類を示すタグ *bytes::値



414
415
416
417
# File 'lib/javaclass/constant.rb', line 414

def initialize( java_class, tag=nil, bytes=nil )
  super(java_class, tag)
  @bytes = bytes
end

Instance Method Details

#bytesObject



418
419
420
# File 'lib/javaclass/constant.rb', line 418

def bytes()
  DoubleConstant.value_from_bytes(@bytes)
end

#bytes=(value) ⇒ Object



421
422
423
# File 'lib/javaclass/constant.rb', line 421

def bytes=(value)
  raise "not implements yet." # TODO
end

#to_bytesObject



424
425
426
427
# File 'lib/javaclass/constant.rb', line 424

def to_bytes()
  tmp = super
  tmp += to_byte( @bytes, 8)
end

#to_sObject



428
429
430
431
432
433
# File 'lib/javaclass/constant.rb', line 428

def to_s
  tmp = bytes
  str =tmp.to_s
  str << "D" unless ( tmp.kind_of?(Float) && (tmp.nan? || tmp.infinite? ))
  return str
end