Go to the documentation of this file.00001 """
00002 Copyright (c) 2013, Cogniteam
00003 All rights reserved.
00004
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are met:
00007
00008 * Redistributions of source code must retain the above copyright
00009 notice, this list of conditions and the following disclaimer.
00010
00011 * Redistributions in binary form must reproduce the above copyright
00012 notice, this list of conditions and the following disclaimer in the
00013 documentation and/or other materials provided with the distribution.
00014
00015 * Neither the name of the Cogniteam nor the
00016 names of its contributors may be used to endorse or promote products
00017 derived from this software without specific prior written permission.
00018
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00022 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
00023 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00024 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00025 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00026 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00028 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 """
00030
00031 from .graph import Graph
00032
00033
00034 class DecisionGraph(Graph):
00035
00036 def __init__(self, name, graph_id, node_name, node_exe_file, node_exe_dir, dot_processor, key, parent=None):
00037 super(DecisionGraph, self).__init__(dot_processor=dot_processor, source=None, parent=parent)
00038 self.name = name
00039 self.graph_id = graph_id
00040 self.node_name = node_name
00041 self.node_exe_file = node_exe_file
00042 self.node_exe_dir = node_exe_dir
00043 self.key = key
00044
00045 self.source = self._get_dot_file_name()
00046
00047 def _get_dot_file_name(self):
00048 if not self.node_exe_file.startswith('/'):
00049 return self.node_exe_dir.replace('lib', 'share') + '/graphs/' + self.name + '.dot'
00050
00051 return self.node_exe_file.replace('lib', 'share').replace(self.node_exe_file.split('/')[-1], 'graphs') \
00052 + '/' + self.name + '.dot'