class Bliftax::Implicant::Bit
A class that represents one bit of an implicant
Constants
- DC
Don’t care
- EPSILON
- INPUT
- NULL
- OFF
- ON
- OUTPUT
Attributes
bit[RW]
label[RW]
type[RW]
Public Class Methods
new(label, bit, type)
click to toggle source
Creates a new Bit
instance.
@param label [String] the label corresponding to this bit. @param bit [String] the bit (can be 1, 0, -, E, or N). @param type [Symbol] the type of this bit (input or output).
# File lib/bliftax/implicant/bit.rb, line 22 def initialize(label, bit, type) fail 'Label has to be a String' unless label.is_a?(String) fail 'Bit has to be a String' unless bit.is_a?(String) @label = label @bit = bit @type = type end
Public Instance Methods
!=(other)
click to toggle source
Checks for inequality.
@param other [Object] whatever to compare against.
@return [true, false] true if two bits are not equal, false otherwise.
# File lib/bliftax/implicant/bit.rb, line 46 def !=(other) @bit != other.bit || @type != other.type end
==(other)
click to toggle source
Checks for equality.
@param other [Object] whatever to compare against.
@return [true, false] true if two bits are equal, false otherwise.
# File lib/bliftax/implicant/bit.rb, line 36 def ==(other) @bit == other.bit && @type == other.type end
Also aliased as: eql?
hash()
click to toggle source
Returns the hash value of this instance.
@return [Integer] the hash value of this instance.
# File lib/bliftax/implicant/bit.rb, line 53 def hash [@bit, @type].hash end
to_s()
click to toggle source
Return the string version of this bit.
@return [String] string representation of this bit.
# File lib/bliftax/implicant/bit.rb, line 60 def to_s format '%-6s %-8s %s', @type.to_s.upcase, @label, @bit end