File: AttributeDefinition.rb

package info (click to toggle)
tj3 3.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,048 kB
  • sloc: ruby: 36,481; javascript: 1,113; sh: 19; makefile: 17
file content (53 lines) | stat: -rw-r--r-- 2,310 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env ruby -w
# encoding: UTF-8
#
# = AttributeDefinition.rb -- The TaskJuggler III Project Management Software
#
# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014
#               by Chris Schlaeger <cs@taskjuggler.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#

class TaskJuggler

  # The AttributeDefinition describes the meta information of a PropertyTreeNode
  # attribute. It contains various information about the attribute. Based on
  # these bits of information, the PropertySet objects generate the attribute
  # lists for each PropertyTreeNode upon creation of the node.
  class AttributeDefinition
    attr_reader :id, :name, :objClass, :inheritedFromParent,
                :inheritedFromProject, :scenarioSpecific, :userDefined, :default

    # Create a new AttributeDefinition. _id_ is the ID of the attribute. It must
    # be unique within the PropertySet where it is used. _name_ is a more
    # descriptive text that will be used in report columns and the like.
    # _objClass_ is a reference to the class (not the object itself) of the
    # attribute. The possible classes all have names ending in Attribute.
    # _inheritedFromParent_ is a boolean flag that needs to be true if the
    # node can inherit the setting from the attribute of the parent node.
    # _inheritedFromProject_ is a boolen flag that needs to be true if the
    # node can inherit the setting from an attribute in the global scope.
    # _scenarioSpecific_ is a boolean flag that is set to true if the attribute
    # can have different values for each scenario. _default_ is the default
    # value that is set upon creation of the attribute.
    def initialize(id, name, objClass, inheritedFromParent, inheritedFromProject,
                   scenarioSpecific, default, userDefined = false)
      @id = id
      @name = name
      @objClass = objClass
      @inheritedFromParent = inheritedFromParent
      @inheritedFromProject = inheritedFromProject
      @scenarioSpecific = scenarioSpecific
      @default = default
      @userDefined = userDefined
      # Prevent objects from being deep copied.
      freeze
    end

  end

end