Class: VORuby::ADQL::V1_0::BetweenPred

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

Overview

Represents the Between expression of a query

Direct Known Subclasses

NotBetweenPred

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(arg1, arg2, arg3) ⇒ BetweenPred

Returns a new instance of BetweenPred.



1396
1397
1398
1399
1400
# File 'lib/voruby/adql/1.0/adql.rb', line 1396

def initialize(arg1, arg2, arg3)
  self.arg1 = arg1
  self.arg2 = arg2
  self.arg3 = arg3
end

Instance Attribute Details

#arg1Object

Returns the value of attribute arg1.



1392
1393
1394
# File 'lib/voruby/adql/1.0/adql.rb', line 1392

def arg1
  @arg1
end

#arg2Object

Returns the value of attribute arg2.



1392
1393
1394
# File 'lib/voruby/adql/1.0/adql.rb', line 1392

def arg2
  @arg2
end

#arg3Object

Returns the value of attribute arg3.



1392
1393
1394
# File 'lib/voruby/adql/1.0/adql.rb', line 1392

def arg3
  @arg3
end

Class Method Details

.from_xml(xml) ⇒ Object



1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
# File 'lib/voruby/adql/1.0/adql.rb', line 1441

def self.from_xml(xml)
  root = element_from(xml)
  
  args = REXML::XPath.match(root, 'x:Arg', {'x' => obj_ns.uri})
  self.new(
    xml_to_obj(args[0]),
    xml_to_obj(args[1]),
    xml_to_obj(args[2])
  )
end

.xml_typeObject



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

def self.xml_type; 'betweenPredType' end

Instance Method Details

#==(p) ⇒ Object



1420
1421
1422
1423
1424
# File 'lib/voruby/adql/1.0/adql.rb', line 1420

def ==(p)
  self.arg1 == p.arg1 and
  self.arg2 == p.arg2 and
  self.arg3 == p.arg3
end

#to_sObject



1426
1427
1428
# File 'lib/voruby/adql/1.0/adql.rb', line 1426

def to_s
  "#{self.arg1} BETWEEN #{self.arg2} AND #{self.arg3}"
end

#to_xml(name = nil) ⇒ Object



1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
# File 'lib/voruby/adql/1.0/adql.rb', line 1430

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.arg1.to_xml('Arg'))
  el.add_element(self.arg2.to_xml('Arg'))
  el.add_element(self.arg3.to_xml('Arg'))
  
  collapse_namespaces(el)
  el
end