Class: VORuby::ADQL::V1_0::XMatch

Inherits:
Search
  • Object
show all
Defined in:
lib/voruby/adql/1.0/adql.rb

Overview

A cross match expression

Defined Under Namespace

Classes: XMatchTableAliasList

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(tables, nature, sigma) ⇒ XMatch

Returns a new instance of XMatch.



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

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.



1138
1139
1140
# File 'lib/voruby/adql/1.0/adql.rb', line 1138

def nature
  @nature
end

#sigmaObject

Returns the value of attribute sigma.



1138
1139
1140
# File 'lib/voruby/adql/1.0/adql.rb', line 1138

def sigma
  @sigma
end

#tablesObject

Returns the value of attribute tables.



1138
1139
1140
# File 'lib/voruby/adql/1.0/adql.rb', line 1138

def tables
  @tables
end

Class Method Details

.from_xml(xml) ⇒ Object



1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
# File 'lib/voruby/adql/1.0/adql.rb', line 1209

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    XMatchTableAliasList.new(
      REXML::XPath.match(root, 'x:Table', {'x' => obj_ns.uri}).collect{ |el| xml_to_obj(el) }
    ),
    Comparison.new(REXML::XPath.first(root, 'x:Nature', {'x' => obj_ns.uri}).text),
    xml_to_obj(REXML::XPath.first(root, 'x:Sigma', {'x' => obj_ns.uri}))
  )
end

.xml_typeObject



1140
# File 'lib/voruby/adql/1.0/adql.rb', line 1140

def self.xml_type; 'xMatchType' end

Instance Method Details

#==(m) ⇒ Object



1184
1185
1186
1187
1188
# File 'lib/voruby/adql/1.0/adql.rb', line 1184

def ==(m)
  self.tables == m.tables and
  self.nature == m.nature and
  self.sigma == m.sigma
end

#to_sObject



1190
1191
1192
# File 'lib/voruby/adql/1.0/adql.rb', line 1190

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

#to_xml(name = nil) ⇒ Object



1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
# File 'lib/voruby/adql/1.0/adql.rb', line 1194

def to_xml(name=nil)
  el = super(name)
  
  self.tables.each{ |t| el.add_element(t.to_xml('Table')) }
  
  nature = element_root('Nature', 'comparisonType')
  nature.text = self.nature.to_s
  el.add_element(nature)
  
  el.add_element(self.sigma.to_xml('Sigma'))
  
  collapse_namespaces(el)
  el
end