Class: TaskJuggler::AllocationAttribute

Inherits:
ListAttributeBase show all
Defined in:
lib/taskjuggler/Attributes.rb

Instance Attribute Summary

Attributes inherited from AttributeBase

#inherited, #property, #provided, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ListAttributeBase

#isList?, isList?

Methods inherited from AttributeBase

#get, #id, #inherit, isList?, #isList?, mode, #name, #nil?, #reset, #set, setMode, #to_num, #to_rti, #to_sort

Constructor Details

#initialize(property, type, container) ⇒ AllocationAttribute

Returns a new instance of AllocationAttribute.



59
60
61
62
63
# File 'lib/taskjuggler/Attributes.rb', line 59

def initialize(property, type, container)
  super

  set(Array.new)
end

Class Method Details

.tjpIdObject



65
66
67
# File 'lib/taskjuggler/Attributes.rb', line 65

def AllocationAttribute::tjpId
  'allocation'
end

Instance Method Details

#to_s(query = nil) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/taskjuggler/Attributes.rb', line 78

def to_s(query = nil)
  out = +''
  first = true
  get.each do |allocation|
    if first
      first = false
    else
      out << "\n"
    end
    out << '[ '
    firstR = true
    allocation.candidates.each do |resource|
      if firstR
        firstR = false
      else
        out << ', '
      end
      out << resource.fullId
    end
    modes = %w(order lowprob lowload hiload random)
    out << " ] select by #{modes[allocation.selectionMode]} "
    out << 'mandatory ' if allocation.mandatory
    out << 'persistent ' if allocation.persistent
  end
  out
end

#to_tjpObject



69
70
71
72
73
74
75
76
# File 'lib/taskjuggler/Attributes.rb', line 69

def to_tjp
  out = []
  get.each do |allocation|
    out.push("allocate #{allocation.to_tjp}\n")
    # TODO: incomplete
  end
  out
end