class ActivityDiagram

Public Class Methods

new() click to toggle source
# File lib/dibnahs_dogs.rb, line 214
  def initialize
# =8= 27022004    self.name = "New_Activity_Diagram"
    @name = "New_Activity_Diagram"
    @Diagram = Array::new
  end

Public Instance Methods

addAccomplishment() click to toggle source
# File lib/dibnahs_dogs.rb, line 235
def addAccomplishment
  self.addActivity("accomplishment","self.clear","")
  #self.link("accomplishment","initiator","")
end
addActivity(name,functionality,documentation) click to toggle source
# File lib/dibnahs_dogs.rb, line 222
def addActivity(name,functionality,documentation)
  a = Activity::new
  a.name = name
  a.activity = name # the name of the function called in set_State
  a.functionality = functionality #the contents of the function above
  a.documentation = documentation
  @Diagram << a
  tmp = ""
  tmp
end
addDecision(name,documentation) click to toggle source
# File lib/dibnahs_dogs.rb, line 258
def addDecision(name,documentation)
  a = Decision::new
  a.name = name
  a.activity = name
  a.documentation = documentation
  @Diagram << a
  tmp = ""
  tmp 
end
addInitiator() click to toggle source
# File lib/dibnahs_dogs.rb, line 232
def addInitiator
  self.addActivity("initiator","","")
end
clear() click to toggle source
# File lib/dibnahs_dogs.rb, line 219
def clear
  @Diagram = ""
end
draw() click to toggle source
# File lib/dibnahs_dogs.rb, line 307
def draw #self.inspect
  tmp = "#{@name}\n\n"
  @Diagram.each {|a|
    tmp += "#{a.name}(#{a.serialNo}) \n"
    if a.instance_of?(Decision) then
      a.pointsTo.each{|b|
        tmp += "\tpoints to #{b.at(0)} if #{b.at(1)}\n"      
      }
    else
      tmp += "\tpoints to #{a.pointsTo}\n"   
    end
  }
  tmp
end
makeAction() click to toggle source
# File lib/dibnahs_dogs.rb, line 284
def makeAction
  tmp = ""
  @Diagram.each { |a|
    tmp += "\tdef #{a.activity}\n"
    tmp1 = ""
    if a.instance_of?(Decision)then
      tmp += "if"
      a.pointsTo.each{|b|
        tmp += "#{tmp1} #{b.at(1)} then \n\tself.goto(#{b.at(0)})\n"
        tmp1 = "elsif"
      }
      tmp += "end\n"
    else
        tmp += "\t #{a.functionality}\n"
      unless a.pointsTo == a.serialNo #or a.instance_of?(Decision) then #infinite loop ;)
        tmp += "\t  self.goto(#{a.pointsTo})\n"
      else
      end
    end
    tmp += "end\n"
  }
  tmp
end
makeHash() click to toggle source
# File lib/dibnahs_dogs.rb, line 274
def makeHash
  tmp = " @hash = {\n\t"
  tmp1 = ""
  @Diagram.each { |a|
    tmp += "#{tmp1}\t\t '#{a.activity}' => #{a.serialNo}"
    tmp1 = ",\n"
  }
  tmp += "\n\t}  "
  tmp
end
makeWhen() click to toggle source
# File lib/dibnahs_dogs.rb, line 267
def makeWhen
  tmp = ""
  @Diagram.each { |a|
    tmp += "\twhen state = @hash['#{a.activity}'] then action = #{a.activity}\n"
  }
  tmp
end