Class: Ravensat::VarNode

Inherits:
Node
  • Object
show all
Defined in:
lib/ravensat/ast/var_node.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#children

Instance Method Summary collapse

Methods inherited from Node

#&, #clauses_size, #each, #each_by_descriptive, #to_s, #vars, #vars_size, #|

Constructor Details

#initializeVarNode

Returns a new instance of VarNode.



4
5
6
7
8
# File 'lib/ravensat/ast/var_node.rb', line 4

def initialize
  @value
  @children = []
  @dimacs_name
end

Instance Attribute Details

#dimacs_nameObject

Returns the value of attribute dimacs_name.



3
4
5
# File 'lib/ravensat/ast/var_node.rb', line 3

def dimacs_name
  @dimacs_name
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/ravensat/ast/var_node.rb', line 3

def value
  @value
end

Instance Method Details

#cnf?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/ravensat/ast/var_node.rb', line 14

def cnf?
  true
end

#evalObject



26
27
28
# File 'lib/ravensat/ast/var_node.rb', line 26

def eval
  @value
end

#resultObject



18
19
20
# File 'lib/ravensat/ast/var_node.rb', line 18

def result
  @value
end

#to_dimacsObject



22
23
24
# File 'lib/ravensat/ast/var_node.rb', line 22

def to_dimacs
  @dimacs_name
end

#~@Object



10
11
12
# File 'lib/ravensat/ast/var_node.rb', line 10

def ~@
  NotNode.new(self)
end