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.Core.Interface.ContainerBase import DataContainer
00022
00023
00024
00025
00026 from slimpy_base.Environment.InstanceManager import InstanceManager
00027
00028
00029 class BuilderBase( object ):
00030 """
00031 abstract class
00032 """
00033
00034
00035
00036 env = InstanceManager()
00037
00038
00039 def __init__(self):
00040 pass
00041
00042 def build(self, g, targets, sources, breakpoints, **k):
00043 raise NotImplementedError("Builer subclass must implement build method")
00044
00045 def isSource( self, val ):
00046 """
00047 test if val is a DataContainer or id of a DataContainer and
00048 if that DataContainer is full
00049 """
00050
00051 try:
00052
00053 node = self.env['table'][val]
00054 except KeyError:
00055 return False
00056 if isinstance( node, DataContainer ):
00057
00058 return node.isfull()
00059
00060 return False
00061
00062 def get_graph(self):
00063 return self._graph
00064
00065 def set_graph(self, graph):
00066 self._graph = graph
00067
00068 graph = property( get_graph, set_graph )
00069