Class: Mmac::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/mmac/rule.rb

Overview

Main Data/Rule for MMac (in here is mushroom, …)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conditions, labels, *option) ⇒ Rule

Returns a new instance of Rule.



28
29
30
31
32
33
34
35
36
# File 'lib/mmac/rule.rb', line 28

def initialize (conditions, labels, *option)
  @conditions = conditions
  @labels = labels
  if !option.empty?
    @supp = option[0]
    @conf = option[1]
    @actOccr = option[2]
  end
end

Instance Attribute Details

#actOccrObject

Returns actOccr.

Returns:

  • actOccr



26
27
28
# File 'lib/mmac/rule.rb', line 26

def actOccr
  @actOccr
end

#conditionsObject

Returns Array of conditions.

Returns:

  • Array of conditions



10
11
12
# File 'lib/mmac/rule.rb', line 10

def conditions
  @conditions
end

#confObject

Returns Conf of rule.

Returns:

  • Conf of rule



22
23
24
# File 'lib/mmac/rule.rb', line 22

def conf
  @conf
end

#labelsObject

Returns array of labels: result of these conditions.

Returns:

  • array of labels: result of these conditions



14
15
16
# File 'lib/mmac/rule.rb', line 14

def labels
  @labels
end

#suppObject

Returns Supp of rule.

Returns:

  • Supp of rule



18
19
20
# File 'lib/mmac/rule.rb', line 18

def supp
  @supp
end

Instance Method Details

#==(other) ⇒ Object



38
39
40
# File 'lib/mmac/rule.rb', line 38

def ==(other)
  self.conditions == other.conditions && self.labels == other.labels
end

#isParent?(other) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/mmac/rule.rb', line 42

def isParent?(other)
  (self.conditions - other.conditions).empty? && self.labels == other.labels
end