Class: MSSMT::ComputedNode
- Inherits:
-
Object
- Object
- MSSMT::ComputedNode
- Defined in:
- lib/mssmt/computed_node.rb
Overview
Node within a MS-SMT that has already had its node_hash and sum computed, i.e., its preimage is not available.
Instance Attribute Summary collapse
-
#node_hash ⇒ Object
readonly
Returns the value of attribute node_hash.
-
#sum ⇒ Object
readonly
Returns the value of attribute sum.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(node_hash, sum) ⇒ ComputedNode
constructor
Constructor.
Constructor Details
#initialize(node_hash, sum) ⇒ ComputedNode
Constructor
12 13 14 15 16 17 18 |
# File 'lib/mssmt/computed_node.rb', line 12 def initialize(node_hash, sum) @node_hash = node_hash if sum > Tree::MAX_SUM_VALUE raise OverflowError, "sum: #{sum} is overflow" end @sum = sum end |
Instance Attribute Details
#node_hash ⇒ Object (readonly)
Returns the value of attribute node_hash.
6 7 8 |
# File 'lib/mssmt/computed_node.rb', line 6 def node_hash @node_hash end |
#sum ⇒ Object (readonly)
Returns the value of attribute sum.
6 7 8 |
# File 'lib/mssmt/computed_node.rb', line 6 def sum @sum end |
Instance Method Details
#==(other) ⇒ Object
20 21 22 23 |
# File 'lib/mssmt/computed_node.rb', line 20 def ==(other) return false unless [BranchNode, ComputedNode].include?(other.class) node_hash == other.node_hash && sum == other.sum end |