Class: VORuby::ADQL::XMatch

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

Overview

A cross match expression.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tables, nature, sigma) ⇒ XMatch

Returns a new instance of XMatch.



1106
1107
1108
1109
1110
# File 'lib/voruby/adql/adql.rb', line 1106

def initialize(tables, nature, sigma)
	self.tables = tables
	self.nature = nature
	self.sigma = sigma
end

Instance Attribute Details

#natureObject

Returns the value of attribute nature.



1104
1105
1106
# File 'lib/voruby/adql/adql.rb', line 1104

def nature
  @nature
end

#sigmaObject

Returns the value of attribute sigma.



1104
1105
1106
# File 'lib/voruby/adql/adql.rb', line 1104

def sigma
  @sigma
end

#tablesObject

Returns the value of attribute tables.



1104
1105
1106
# File 'lib/voruby/adql/adql.rb', line 1104

def tables
  @tables
end

Class Method Details

.from_xml(node) ⇒ Object



1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
# File 'lib/voruby/adql/adql.rb', line 1153

def self.from_xml(node)
  tables = []
  node.elements.each('Table') do |tbl_node|
    table = XMatchTableAlias.from_xml(tbl_node)
    tables.push(table)
  end
	  
  nature_node = REXML::XPath.first(node, 'Nature')
  nature = Nature.from_xml(nature_node)

  sigma_node = REXML::XPath.first(node, 'Sigma')
  sigma = Sigma.from_xml(sigma_node)

  return XMatch.new(tables, nature, sigma)
end

Instance Method Details

#to_adqlsObject



253
254
255
256
# File 'lib/voruby/adql/transforms.rb', line 253

def to_adqls
	tables = self.tables.collect{|x| x.to_adqls}.join(', ')
	"XMATCH(#{tables}) #{nature.value} #{sigma.value}"
end

#to_sObject



1148
1149
1150
1151
# File 'lib/voruby/adql/adql.rb', line 1148

def to_s
	tables = self.tables.collect{|x| x.to_s}.join('|')
	"{tables=#{tables},nature=#{self.nature},sigma=#{self.sigma}}"
end