Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/dyndoc/common/dynArray.rb

Overview

Since more than one language is used for Array transfert This stuff is moved from R4rb package to here

> Undone because R4rb is not self-content

> methods :> and :< overloaded from R4rb

Instance Method Summary collapse

Instance Method Details

#<(out) ⇒ Object

out represents here an R or Julia expression to execute and put inside the Array



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/dyndoc/common/dynArray.rb', line 49

def <(out) #out represents here an R or Julia expression to execute and put inside the Array
    out.strip!
	mode=:r 
	#out represents here an R or Julia object
	if out =~ /^jl\:/
		mode,out=:jl,out[3..-1]
	elsif out =~ /^(r|R)\:/
		out=out[2..-1]
	end
	case mode
	when :r
    	self.rb2R=nil unless @rb2R
    	@rb2R << out
    	@rb2R > self
    when :jl
    	self.rb2jl! unless @rb2jl
    	@rb2jl << out
    	@rb2jl > self
    end
    	
    return self
end

#>(out) ⇒ Object

out is a String representing a R or Julia expression



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/dyndoc/common/dynArray.rb', line 27

def >(out)
	out.strip!
	mode=:r 
	#out represents here an R or Julia object
	if out =~ /^jl\:/
		mode,out=:jl,out[3..-1]
	elsif out =~ /^(r|R)\:/
		out=out[2..-1]
	end
	case mode
	when :r
	    self.rb2R=nil unless @rb2R
	    @rb2R << out
	    @rb2R < self
	when :jl
		self.rb2jl=nil unless @rb2jl
	    @rb2jl << out
	    @rb2jl < self
	end
    return self
end

#rb2jl!Object

Already in R4rb and still there to be self-contents def rb2R=(mode=nil) ##puts “rb2R mode #object_id”;p mode mode=R4rb unless mode return if @rb2R_mode and @rb2R_mode==mode @rb2R_mode=mode unless @rb2R_mode @rb2R=(@rb2R_mode==Rserve ? Rserve::RVector.new(“”) : R2rb::RVector.new(“”) ) ##puts “rb2R=”;p @rb2R end



21
22
23
24
# File 'lib/dyndoc/common/dynArray.rb', line 21

def rb2jl! #only one mode
	@rb2jl= Julia::Vector.new("") 
	##puts "rb2jl=";p @rb2jl
end