File: Parameter.py

package info (click to toggle)
cain 1.10%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 29,856 kB
  • sloc: cpp: 49,612; python: 14,988; xml: 11,654; ansic: 3,644; makefile: 133; sh: 2
file content (31 lines) | stat: -rw-r--r-- 912 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
"""Implements the Parameter class."""

class Parameter:
    """These are meant to be stored in a dictionary with the parameter
    identifiers as the keys. Parameters have the following member data:
    - self.value is the floating point value of the parameter.
    - self.initialValue is the initialValue of the parameter."""
    
    def __init__(self, initialValue):
        r"""
        Construct a parameter.
        >>> from Parameter import Parameter
        >>> p = Parameter(7)
        >>> p.initialValue
        7.0
        >>> p.value is None
        True
        """
        self.initialValue = float(initialValue)
        # Enforce initialization.
        self.value = None

    def initialize(self):
        r"""
        >>> from Parameter import Parameter
        >>> p = Parameter(11)
        >>> p.initialize()
        >>> p.value
        11.0
        """
        self.value = self.initialValue