Class: ChaosDetector::ChaosGraphs::DomainNode
Constant Summary
GraphTheory::Node::ROOT_NODE_NAME
Class Attribute Summary collapse
#is_root, #node_origin, #reduction
Instance Method Summary
collapse
#merge!, #name, #root?, #to_k
Constructor Details
#initialize(domain_name: nil, node_origin: nil, is_root: false, reduction: nil) ⇒ DomainNode
Returns a new instance of DomainNode.
8
9
10
|
# File 'lib/chaos_detector/chaos_graphs/domain_node.rb', line 8
def initialize(domain_name: nil, node_origin: nil, is_root: false, reduction: nil)
super(name: domain_name, root: is_root, node_origin: node_origin, reduction: reduction)
end
|
Class Attribute Details
.root_node(force_new: false) ⇒ Object
Returns the value of attribute root_node.
49
50
51
|
# File 'lib/chaos_detector/chaos_graphs/domain_node.rb', line 49
def root_node
@root_node
end
|
Instance Method Details
#==(other) ⇒ Object
20
21
22
|
# File 'lib/chaos_detector/chaos_graphs/domain_node.rb', line 20
def ==(other)
domain_name&.to_s == other&.domain_name&.to_s
end
|
#eql?(other) ⇒ Boolean
16
17
18
|
# File 'lib/chaos_detector/chaos_graphs/domain_node.rb', line 16
def eql?(other)
self == other
end
|
#graph_props ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/chaos_detector/chaos_graphs/domain_node.rb', line 32
def graph_props
props = super
if reduction
props.merge!(
cardinality_modules: reduction.reduction_count,
cardinality_functions: reduction.reduction_sum
)
end
super.merge(props)
end
|
#hash ⇒ Object
12
13
14
|
# File 'lib/chaos_detector/chaos_graphs/domain_node.rb', line 12
def hash
domain_name.hash
end
|
#subtitle ⇒ Object
28
29
30
|
# File 'lib/chaos_detector/chaos_graphs/domain_node.rb', line 28
def subtitle
root? ? 'Root Node' : ''
end
|
#title ⇒ Object
24
25
26
|
# File 'lib/chaos_detector/chaos_graphs/domain_node.rb', line 24
def title
super
end
|
#to_s ⇒ Object
Must be name/domain_name for comparisons:
44
45
46
|
# File 'lib/chaos_detector/chaos_graphs/domain_node.rb', line 44
def to_s
domain_name
end
|