Class: LogicTools::VarImp
- Defined in:
- lib/logic_tools/logicsimplify.rb
Overview
Describes a pseudo variable associated to an implicant.
Used for the Petrick's method
Constant Summary collapse
- @@base =
The index of the VarImp for building the variable names
0
Instance Attribute Summary collapse
-
#implicant ⇒ Object
readonly
The implicant the pseudo variable is associated to.
Attributes inherited from Variable
Instance Method Summary collapse
-
#initialize(implicant) ⇒ VarImp
constructor
Creates a pseudo variable assoctiated to an
implicant.
Methods inherited from Variable
#<=>, exists?, get, #inspect, #to_s
Constructor Details
#initialize(implicant) ⇒ VarImp
Creates a pseudo variable assoctiated to an implicant.
223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/logic_tools/logicsimplify.rb', line 223 def initialize(implicant) # Create the name of the variable name = nil begin name = "P" + @@base.to_s @@base += 1 end while Variable.exists?(name) # Create the variable super(name) # Associate it with the implicant @implicant = implicant implicant.var = self end |
Instance Attribute Details
#implicant ⇒ Object (readonly)
The implicant the pseudo variable is associated to.
220 221 222 |
# File 'lib/logic_tools/logicsimplify.rb', line 220 def implicant @implicant end |