Class: VORuby::ADQL::TrigonometricFunction

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

Overview

Represents a trigonometric function.

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(name, arg, allow = nil) ⇒ TrigonometricFunction

Returns a new instance of TrigonometricFunction.



495
496
497
498
499
# File 'lib/voruby/adql/adql.rb', line 495

def initialize(name, arg, allow=nil)
	self.name = name
	self.arg = arg
	self.allow = allow
end

Instance Attribute Details

#allowObject

Returns the value of attribute allow.



493
494
495
# File 'lib/voruby/adql/adql.rb', line 493

def allow
  @allow
end

#argObject

Returns the value of attribute arg.



493
494
495
# File 'lib/voruby/adql/adql.rb', line 493

def arg
  @arg
end

#nameObject

Returns the value of attribute name.



493
494
495
# File 'lib/voruby/adql/adql.rb', line 493

def name
  @name
end

Class Method Details

.from_xml(node) ⇒ Object



525
526
527
528
529
530
531
532
533
534
535
# File 'lib/voruby/adql/adql.rb', line 525

def self.from_xml(node)
  name = TrigonometricFunctionName.from_xml(node)
  arg_node = REXML::XPath.first(node, 'Arg')
  arg = Arg.from_xml(arg_node)
  allow_node = REXML::XPath.first(node, 'Allow')
  allow = nil
  if allow_node
    allow = Allow.from_xml(allow_node)
  end
  return TrigonometricFunction.new(name, arg, allow)
end

Instance Method Details

#to_adqlsObject



111
112
113
114
115
116
117
# File 'lib/voruby/adql/transforms.rb', line 111

def to_adqls
	  if self.allow
		  "#{self.name.to_adqls}(#{self.allow.to_adqls} #{self.arg.to_adqls})"
		else
		  "#{self.name.to_adqls}(#{self.arg.to_adqls})" 
		end
end

#to_sObject



521
522
523
# File 'lib/voruby/adql/adql.rb', line 521

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