PyutLink.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 » PyutLink.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

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

from PyutObject import PyutObject
from types import *

class PyutLink(PyutObject):
    """
    A standard link between Class or Note.

    A PyutLink represents a UML link between Class in Pyut.

    Example::
        myLink  = PyutLink("linkName", 0, "0", "*")

    :version: $Revision: 1.5 $
    :author: Deve Roux
    :contact: droux@eivd.ch
    """

    def __init__(self, name="", linkType=0, cardSrc="", cardDest="",
                 bidir=0, source=None, destination=None):
        """
        Constructor.

        @param string name     : for the link name
        @param int    type     : type of link
        @param string  cardSrc : cardinality of source of link
        @param string  cardDest: cardinality of destination of link
        @param boolean bidir   : design if link is bidirational or not
        @param obj source      : source of the link
        @param obj destination : where goes the link
        @since 1.0
        @author Deve Roux <droux@eivd.ch>
        @modified Laurent Burgbacher <lb@alawa.ch>
            added source field
        """
        PyutObject.__init__(self, name)
        self._type    = linkType
        self._cardSrc = cardSrc
        self._cardDes = cardDest
        self._bidir   = bidir
        self._src     = source
        self._dest    = destination
        

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

    def __str__(self):
        """
        String representation.

        @return : string representing link
        @since 1.0
        @author Deve Roux <droux@eivd.ch>
        """
        return _("(%s) links from %s to %s") % \
                (self.getName(), self._src, self._dest)


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

    def getSrcCard(self):
        """
        Return a string representing cardinality source. 

        @return string source cardinality
        @since 1.0
        @author Deve Roux <droux@eivd.ch>
        """
        return self._cardSrc

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

    def setSrcCard(self, cardSrc):
        """
        Updating source cardinality.

        @param  string cardSrc
        @since 1.0
        @author Deve Roux <droux@eivd.ch>
        """
        self._cardSrc = cardSrc
    
    #>------------------------------------------------------------------------

    def getDestCard(self):
        """
        Return a string representing cardinality destination. 

        @return string destination cardinality
        @since 1.0
        @author Deve Roux <droux@eivd.ch>
        """
        return self._cardDes
    
    #>------------------------------------------------------------------------

    def setDestCard(self, cardDest):
        """
        Updating destination cardinality.

        @param string cardDest
        @since 1.0
        @author Deve Roux <droux@eivd.ch>
        """
        self._cardDes = cardDest
    
    #>------------------------------------------------------------------------

    def getSource(self):
        """
        Return the source object of the link

        @return object Class or Note
        @since 1.0
        @author Laurent Burgbacher <lb@alawa.ch>
        """
        return self._src
    
    #>------------------------------------------------------------------------
    
    def setSource(self, source):
        """
        Set the source object of this link.

        @param PyutClass or PyutNote source
        @since 1.0
        @author Laurent Burgbacher <lb@alawa.ch>
        """
        self._src = source
   
    #>------------------------------------------------------------------------

    def getDestination(self):
        """
        Return an object destination who is linked to this link. 

        @return object Class or Note
        @since 1.0
        @author Deve Roux <droux@eivd.ch>
        """
        return self._dest
    
    #>------------------------------------------------------------------------
    
    def setDestination(self, destination):
        """
        Updating destination.

        @param PyutClass or PyutNote destination
        @since 1.0
        @author Deve Roux <droux@eivd.ch>
        """
        self._dest = destination
   
    #>------------------------------------------------------------------------

    def getBidir(self):
        """
        To know if the link is bidirectional.

        @return boolean
        @since 1.0
        @author Deve Roux <droux@eivd.ch>
        """
        return self._bidir
    
    #>------------------------------------------------------------------------
    
    def setBidir(self, bidirectional):
        """
        Updating bidirectional.

        @param boolean bidirectional
        @since 1.0
        @author Deve Roux <droux@eivd.ch>
        """
        self._bidir = bidirectional 

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

    def setType(self, theType):
        """
        Updating type of link.

        @param int type : Type of the link
        @since 1.2
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        if type(theType) == StringType or type(theType) == UnicodeType:
            try:
                theType = int(theType)
            except:
                theType = 0
        self._type = theType

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

    def getType(self):
        """
        To get the link type.

        @return int : The type of the link
        @since 1.2
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        return self._type



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.