Class: ProjectSimulator::TimeConstraint

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timesx, times: timesx, time: nil) ⇒ TimeConstraint

Returns a new instance of TimeConstraint.



436
437
438
# File 'lib/projectsimulator.rb', line 436

def initialize(timesx, times: timesx, time: nil)
  @times, @time = times, time
end

Instance Attribute Details

#timeObject

Returns the value of attribute time.



434
435
436
# File 'lib/projectsimulator.rb', line 434

def time
  @time
end

Instance Method Details

#matchObject



440
441
442
# File 'lib/projectsimulator.rb', line 440

def match()
  ChronicBetween.new(@times).within?(@time)
end

#to_nodeObject



444
445
446
447
# File 'lib/projectsimulator.rb', line 444

def to_node()
  Rexle::Element.new(:constraint, \
                     attributes: {type: :time, times: @times})      
end

#to_rowxObject



449
450
451
# File 'lib/projectsimulator.rb', line 449

def to_rowx()            
  "constraint: %s" %  @times
end