Class: Locomotive::RelationalAlgebra::Numbering
- Inherits:
-
Unary
- Object
- RelAlgAstNode
- Operator
- Unary
- Locomotive::RelationalAlgebra::Numbering
- Defined in:
- lib/locomotive/relational_algebra/operators/ranking/basic_ranking.rb
Instance Attribute Summary collapse
-
#res ⇒ Object
readonly
Returns the value of attribute res.
-
#sort_by ⇒ Object
readonly
Returns the value of attribute sort_by.
Attributes inherited from Operator
Attributes included from AstHelpers::AstNode
#kind, #left_child, #owner, #right_child, #value
Instance Method Summary collapse
- #child=(op) ⇒ Object
- #clone ⇒ Object
-
#initialize(op, res, sortby) ⇒ Numbering
constructor
A new instance of Numbering.
- #set(var, plan) ⇒ Object
- #xml_content ⇒ Object
Methods inherited from Operator
#bound, #free, #to_xml, #xml_kind, #xml_schema
Methods included from XML
Methods included from AstHelpers::Annotations
Methods included from AstHelpers::AstNode
#has_left_child?, #has_right_child?, #is_leaf?, #traverse, #traverse_strategy=
Constructor Details
#initialize(op, res, sortby) ⇒ Numbering
Returns a new instance of Numbering.
28 29 30 31 32 |
# File 'lib/locomotive/relational_algebra/operators/ranking/basic_ranking.rb', line 28 def initialize(op, res, sortby) @res = res @sort_by = to_sort_by sortby super(op) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Locomotive::AstHelpers::Annotations
Instance Attribute Details
#res ⇒ Object (readonly)
Returns the value of attribute res.
24 25 26 |
# File 'lib/locomotive/relational_algebra/operators/ranking/basic_ranking.rb', line 24 def res @res end |
#sort_by ⇒ Object (readonly)
Returns the value of attribute sort_by.
24 25 26 |
# File 'lib/locomotive/relational_algebra/operators/ranking/basic_ranking.rb', line 24 def sort_by @sort_by end |
Instance Method Details
#child=(op) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/locomotive/relational_algebra/operators/ranking/basic_ranking.rb', line 34 def child=(op) unless op.schema.attributes?(sort_by.attributes) raise CorruptedSchema, "Schema #{op.schema.attributes} does not " \ "contain all attributes of #{sort_by.attributes}." end self.schema = op.schema + Schema.new({ @res => [RNat.instance] }) super(op) end |
#clone ⇒ Object
51 52 53 54 55 |
# File 'lib/locomotive/relational_algebra/operators/ranking/basic_ranking.rb', line 51 def clone self.class.new(child.clone, res.clone, sort_by.clone) end |
#set(var, plan) ⇒ Object
57 58 59 60 61 62 |
# File 'lib/locomotive/relational_algebra/operators/ranking/basic_ranking.rb', line 57 def set(var, plan) self.class.new( child.set(var,plan), res.clone, sort_by.clone) end |
#xml_content ⇒ Object
44 45 46 47 48 49 |
# File 'lib/locomotive/relational_algebra/operators/ranking/basic_ranking.rb', line 44 def xml_content content do [column( :name => res.to_xml, :new => true), sort_by.to_xml].join end end |