class TaskJuggler::AllocationAttribute

Public Class Methods

new(property, type, container) click to toggle source
Calls superclass method TaskJuggler::ListAttributeBase.new
# File lib/taskjuggler/Attributes.rb, line 57
def initialize(property, type, container)
  super

  set(Array.new)
end
tjpId() click to toggle source
# File lib/taskjuggler/Attributes.rb, line 63
def AllocationAttribute::tjpId
  'allocation'
end

Public Instance Methods

to_s(query = nil) click to toggle source
# File lib/taskjuggler/Attributes.rb, line 76
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_tjp() click to toggle source
# File lib/taskjuggler/Attributes.rb, line 67
def to_tjp
  out = []
  get.each do |allocation|
    out.push("allocate #{allocation.to_tjp}\n")
    # TODO: incomplete
  end
  out
end