PyutLinkedObject.py :  » UML » Python-UML-Tool » pyut-1.4.0 » src » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » UML » Python UML Tool 
Python UML Tool » pyut 1.4.0 » src » PyutLinkedObject.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

__version__ = "$Revision: 1.6 $"
__author__ = "EI5, eivd, Group Burgbacher - Waelti"
__date__ = "2001-12-05"

from PyutObject import PyutObject
#from wxPython.wx     import True, False
#from types           import *

class PyutLinkedObject(PyutObject):
    """
    An object which can be connected to other one.
    This class provides all support for link management in data layer. All
    classes that may be interconnected (classes for examples) should inherate
    this class to have all links support.

    :version: $Revision: 1.6 $
    :author: Philippe Waelti
    :contact: pwaelti@eivd.ch
    """


    def __init__(self, name=""):
        """
        Constructor.

        @param string name : object name
        @since 1.0
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        PyutObject.__init__(self, name)

        

        self._links = []
        self._fathers = []
        self._filename = ""


    #>------------------------------------------------------------------------

    def getNextSafeID(self):
        """
        Get the next safe id

        @author C.Dutoit
        """
        # Verify that next id is not already used
        while self.isIDUsed(PyutLinkedObject.nextId):
            PyutLinkedObject.nextId+=1

    #>------------------------------------------------------------------------

    def __getstate__(self):
        """
        For deepcopy operations, tells which fields to avoid copying.
        Deepcopy must not copy the links to other classes, or it would result
        in copying all the diagram.

        @since 1.0
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        dict = self.__dict__.copy()
        dict["_links"] = []
        return dict

    #>------------------------------------------------------------------------

    def getLinks(self):
        """
        Return a list of the links.
        This is not a copy, but the original one. Any change made to it is
        directly made on the class.

        @since 1.1
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        return self._links

    #>------------------------------------------------------------------------

    def setLinks(self, links):
        """
        Replace the actual links by those given in the list.
        The methods passed are not copied, but used directly.

        @since 1.1
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        self._links = links

    #>------------------------------------------------------------------------

    def addLink(self, link):
        """
        Add the given link to the links

        @since 1.0
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        self._links.append(link)

    #>------------------------------------------------------------------------

    def getFathers(self):
        """
        Return a list of the fathers. 
        This is not a copy, but the original one. Any change made to it is
        directly made on the class.

        @since 1.0
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        return self._fathers

    #>------------------------------------------------------------------------

    def setFathers(self, fathers):
        """
        Replace the actual fathers by those given in the list.
        The methods passed are not copied, but used directly.

        @since 1.0
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        self._fathers = fathers

    #>------------------------------------------------------------------------

    def addFather(self, father):
        """
        Add a father in a fathers list

        @since 1.0
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        return self._fathers.append(father)

    #>------------------------------------------------------------------------

    def setFilename(self, filename):
        """
        Set the associated filename.
        This is used by the reverse engineering plugins.

        @param String filename
        @since 1.0
        """
        self._filename = filename

    #>------------------------------------------------------------------------

    def getFilename(self):
        """
        Get the associated filename.
        "" is returned if there's no filename.

        @return String
        @since 1.0
        """
        return self._filename
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.