Class: CqlRuby::CqlBooleanNode

Inherits:
CqlNode
  • Object
show all
Defined in:
lib/cql_ruby/cql_nodes.rb,
lib/cql_ruby/cql_to_solr.rb

Direct Known Subclasses

CqlAndNode, CqlNotNode, CqlOrNode, CqlProxNode

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CqlNode

#check_xml, #getResultSetName, #render_prefixes, #render_sortkeys

Constructor Details

#initialize(left_node, right_node, modifier_set) ⇒ CqlBooleanNode

Returns a new instance of CqlBooleanNode.



165
166
167
168
169
170
# File 'lib/cql_ruby/cql_nodes.rb', line 165

def initialize( left_node, right_node, modifier_set )
  super()
  @left_node = left_node.dup
  @right_node = right_node.dup
  @modifier_set = modifier_set || ModifierSet.new( "=" )
end

Instance Attribute Details

#left_nodeObject

Returns the value of attribute left_node.



163
164
165
# File 'lib/cql_ruby/cql_nodes.rb', line 163

def left_node
  @left_node
end

#modifier_setObject

Returns the value of attribute modifier_set.



163
164
165
# File 'lib/cql_ruby/cql_nodes.rb', line 163

def modifier_set
  @modifier_set
end

#right_nodeObject

Returns the value of attribute right_node.



163
164
165
# File 'lib/cql_ruby/cql_nodes.rb', line 163

def right_node
  @right_node
end

Instance Method Details

#to_cqlObject



187
188
189
# File 'lib/cql_ruby/cql_nodes.rb', line 187

def to_cql
  "(#{@left_node.to_cql}) #{@modifier_set.to_cql} (#{@right_node.to_cql})"
end

#to_solrObject



157
158
159
# File 'lib/cql_ruby/cql_to_solr.rb', line 157

def to_solr
  "(#{@left_node.to_solr} #{@modifier_set.to_solr} #{@right_node.to_solr})"  
end

#to_xcql(xml = nil, prefixes = nil, sortkeys = nil) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/cql_ruby/cql_nodes.rb', line 172

def to_xcql( xml=nil, prefixes=nil, sortkeys=nil )
  xml = check_xml( xml )
  xml.triple do
    render_prefixes( xml, prefixes )
    modifier_set.to_xcql( xml, "boolean" )
    xml.leftOperand do
      left_node.to_xcql( xml )
    end
    xml.rightOperand do
      right_node.to_xcql( xml )
    end
    render_sortkeys( xml, sortkeys )
  end
end