00001 __copyright__ = """
00002 Copyright 2008 Sean Ross-Ross
00003 """
00004 __license__ = """
00005 This file is part of SLIMpy .
00006
00007 SLIMpy is free software: you can redistribute it and/or modify
00008 it under the terms of the GNU Lesser General Public License as published by
00009 the Free Software Foundation, either version 3 of the License, or
00010 (at your option) any later version.
00011
00012 SLIMpy is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015 GNU Lesser General Public License for more details.
00016
00017 You should have received a copy of the GNU Lesser General Public License
00018 along with SLIMpy . If not, see <http://www.gnu.org/licenses/>.
00019 """
00020
00021 from slimpy_base.api.Plugins.slim2rsf.sfCommandFactory import rsfCommandFactory
00022 from slimpy_base.api.Plugins.slim2rsf.sfcommands.sfConverter import sfConverter
00023 from slimpy_base.Core.Interface.ContainerBase import DataContainer
00024
00025 iscontainer = lambda obj : isinstance(obj , DataContainer )
00026
00027 class cmpfixture( sfConverter ):
00028 cmd = None
00029
00030 @classmethod
00031 def constr( cls, command, *params ):
00032 cls.eqShape(command, params)
00033
00034 @classmethod
00035 def trans( cls, cmd, space, *spaces ):
00036 cls.change(space, data_type = "int" )
00037
00038 return space
00039
00040 @classmethod
00041 def map( cls, src, cmd ):
00042 cmd = cls.default_function( cmd, "boolcmp" )
00043
00044 right = cmd.kparams['right']
00045
00046 if not iscontainer(right):
00047 cmd = cls.keywordmap(cmd, {"right":"right_f"})
00048
00049 cmd.kparams.update( sign=cls.cmd )
00050 return cls.pack( cmd )
00051
00052 class all( object ):
00053
00054 class eq( cmpfixture ):
00055 cmd = 'eq'
00056 class gt( cmpfixture ):
00057 cmd = 'gt'
00058 class ge( cmpfixture ):
00059 cmd = 'ge'
00060 class le( cmpfixture ):
00061 cmd = 'lq'
00062 class lt( cmpfixture ):
00063 cmd = 'lt'
00064 class ne( cmpfixture ):
00065 cmd = 'ne'
00066 class and_( cmpfixture ):
00067 cmd = 'and'
00068 class or_( cmpfixture ):
00069 cmd = 'or'
00070
00071 sffactory = rsfCommandFactory()
00072 sffactory.addallfrom( all )
00073
00074