Class: JavaClass::FloatConstant

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

Overview

Floatの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) ⇒ FloatConstant

コンストラクタ

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



324
325
326
327
# File 'lib/javaclass/constant.rb', line 324

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

Instance Method Details

#bytesObject



328
329
330
# File 'lib/javaclass/constant.rb', line 328

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

#bytes=(value) ⇒ Object



331
332
333
# File 'lib/javaclass/constant.rb', line 331

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

#to_bytesObject



334
335
336
337
# File 'lib/javaclass/constant.rb', line 334

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

#to_sObject



338
339
340
341
342
343
# File 'lib/javaclass/constant.rb', line 338

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