[Bio] / KahApp / KahModuleExample.py Repository:
ViewVC logotype

View of /KahApp/KahModuleExample.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Fri Mar 11 21:33:13 2005 UTC (14 years, 9 months ago) by efrank
Branch: MAIN
CVS Tags: before-dynamics-persistence, lwc, treatman-lastDay-0, preTreatmanDyn, HEAD
Changes since 1.1: +2 -1 lines
1. introduce Model as king of the hill rather than RecoElem.
2. migrations to follow
3. new modules for by-peg filtering
4. first stab at externalized app fwk
5. moved seed data factory

bunch of timing code still in this ...need to take out


from KahApp.KahModule import KahModule

class KahModuleExample( KahModule ):
    def __init__( self, name ):
        KahModule.__init__(self, name)


    def config( self, cfg ):
        """
        Just shows how to register some paramters we expect
        to get.
        
        @type cfg: KahConfigSection
        """

        print self.name(), " config()"

        cfg.regInt( "int1", 1)
        cfg.regInt( "int2", 2)
        cfg.regFloat( "float1", 10.0)
        cfg.regString( "string1", "theString1" )

        return

    def process( self, aModel, re, cfg):
        """
        Just prints out the param values.  Note that some
        may be overridden

        @type re: RecoElem
        @type aModel: KahOM.Model
        @type cfg: KahConfigSection
        """

        print self.name(), " process():"

        print "int1 is   : ", cfg.getInt( "int1")
        if ( cfg.wasOverridden( "int1" )) : print "   int1 was overridden"

        print "int2 is   : ", cfg.getInt( "int2")
        if ( cfg.wasOverridden( "int2" )) : print "   int2 was overridden"

        print "string1 is:", cfg.getString( "string1")
        if ( cfg.wasOverridden( "string1" )) : print "   string1 was overridden"

        print
        
        return

    
    def finish( self, cfg):
        """
        Last thing called
        """

        print self.name(), " finish()"
        return
        

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3