Sha256: 0a83a1a4858d8416160932bb4e99119ddf3cdb67176b18ff2f2536e2e547cd13

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

class PropositionType

  attr_reader :label, :truthvalue

  def initialize(type, truthvalue=true)
    @type = type
    @label = type
    @truthvalue = truthvalue
  end
  def getType
    @type
  end

  def quantity
    if @label == "A"
      quantity = Quantity.new("universal")
    elsif @label == "E"
      quantity = Quantity.new("universal")
    elsif @label == "I"
      quantity = Quantity.new("particular")
    elsif @label == "O"
      quantity = Quantity.new("particular")
    else
      quantity = "not a valid type"
    end
    return quantity
  end
  def quality
    if @label == "A"
      quality = Quality.new("affirmative")
    elsif @label == "E"
      quality = Quality.new("negative")
    elsif @label == "I"
      quality = Quality.new("affirmative")
    elsif @label == "O"
      quality = Quality.new("negative")
    else
      quality = "not a valid type"
    end
    return quality
  end

  def proposition
    proposition = Proposition.new(Quantity.new(self.quantity.label), Term.new("S"), Quality.new(self.quality.label), Term.new("P"), @truthvalue)
    return proposition
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
catlogic-0.0.2 lib/catlogic/proposition_type.rb
catlogic-0.0.1 lib/catlogic/proposition_type.rb