Class: LogicTools::VarImp
- Defined in:
- lib/logic_tools/logicsimplify_qm.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.
230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/logic_tools/logicsimplify_qm.rb', line 230 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.
227 228 229 |
# File 'lib/logic_tools/logicsimplify_qm.rb', line 227 def implicant @implicant end |