Class: VORuby::ADQL::UnaryExpr

Inherits:
ScalarExpression show all
Defined in:
lib/voruby/adql/adql.rb,
lib/voruby/adql/transforms.rb

Overview

Represents an unary expression such as -(a.ra)

Instance Attribute Summary collapse

Attributes inherited from ScalarExpression

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ScalarExpression

#is_scalar?

Constructor Details

#initialize(oper, arg) ⇒ UnaryExpr

Returns a new instance of UnaryExpr.



237
238
239
240
241
242
# File 'lib/voruby/adql/adql.rb', line 237

def initialize(oper, arg)
	super("#{oper}#{arg}")
			
	self.arg = arg
	self.oper = oper
end

Instance Attribute Details

#argObject

Returns the value of attribute arg.



235
236
237
# File 'lib/voruby/adql/adql.rb', line 235

def arg
  @arg
end

#operObject

Returns the value of attribute oper.



235
236
237
# File 'lib/voruby/adql/adql.rb', line 235

def oper
  @oper
end

Class Method Details

.from_xml(node) ⇒ Object



268
269
270
271
272
273
# File 'lib/voruby/adql/adql.rb', line 268

def self.from_xml(node)
 oper = UnaryOperator.new(node.attributes['Oper'])
 arg_node = REXML::XPath.first(node, 'Arg')
 arg = ScalarExpression.from_xml(arg_node)
 return UnaryExpr.new(oper, arg)
end

Instance Method Details

#to_adqlsObject



38
39
40
# File 'lib/voruby/adql/transforms.rb', line 38

def to_adqls
	"#{self.oper.to_adqls}#{self.arg.to_adqls}"
end

#to_sObject



264
265
266
# File 'lib/voruby/adql/adql.rb', line 264

def to_s
	"{arg=#{self.oper},oper=#{self.arg}}"
end