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.



1120
1121
1122
1123
1124
# File 'lib/voruby/adql/adql.rb', line 1120

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.



1118
1119
1120
# File 'lib/voruby/adql/adql.rb', line 1118

def nature
  @nature
end

#sigmaObject

Returns the value of attribute sigma.



1118
1119
1120
# File 'lib/voruby/adql/adql.rb', line 1118

def sigma
  @sigma
end

#tablesObject

Returns the value of attribute tables.



1118
1119
1120
# File 'lib/voruby/adql/adql.rb', line 1118

def tables
  @tables
end

Class Method Details

.from_xml(node) ⇒ Object



1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
# File 'lib/voruby/adql/adql.rb', line 1167

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



1162
1163
1164
1165
# File 'lib/voruby/adql/adql.rb', line 1162

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