Commit 2dee486e authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

Remove useless spaces in case of empty lines -_-

parent c2341f89
......@@ -2,7 +2,7 @@
## Author(s) : Michel Le Borgne
## Created : 04/2010
## Revision : 03/2012
## Source :
## Source :
##
## Copyright 2012 : IRISA/IRSET
##
......@@ -31,8 +31,8 @@
##
## Michel Le Borgne.
## IRISA Campus de Beaulieu
## 35042 RENNES Cedex, FRANCE
##
## 35042 RENNES Cedex, FRANCE
##
##
## Contributor(s): Geoffroy Andrieux, Nolwenn Le Meur
##
......@@ -43,23 +43,23 @@ Visitors for guarded transition model analysis
class TableVisitor(object):
"""
Visitor used to collect action and place declarations.
Events and conditions are not considered so implicit free clocks are
Events and conditions are not considered so implicit free clocks are
not registered.
The name of a place must be unique in a whole chart (no scope implemented).
The same holds for an event declared in an action.
Pseudo places used for inputs can be declared several time
TYPES: state, input, emit
TYPES: state, input, emit
OTHER TYPES: clock (used when free clocks are found)
"""
def __init__(self, erdisplay):
# place name -> (type, deepness)
# place name -> (type, deepness)
# type is state or input or emit (emitted events)
self.tab_symb = dict()
self.tab_symb = dict()
self.error_reporter = erdisplay # reporter to display errors
self.error = False # True if an error is found
self.deep = 0 # imbrication level of macro states
def declare(self, name, stype):
"""
Register an identifier with its type
......@@ -72,32 +72,32 @@ class TableVisitor(object):
except KeyError:
self.tab_symb[name] = (stype, self.deep)
return
def visit_chart_model(self, model):
"""
first step in the visit
"""
model.get_root().accept(self)
def visit_cstart_node(self, node):
"""
nothing to declare
"""
return
def visit_ctrap_node(self, node):
"""
nothing to declare
"""
return
def visit_csimple_node(self, node):
"""
register the node as a state
"""
self.declare(node.name, "state")
return
def visit_cinput_node(self, node):
"""
register the ident as input
......@@ -121,7 +121,7 @@ class TableVisitor(object):
"""
self.declare(node.name, "state")
return
def visit_cmacro_node(self, node):
"""
register the node as a state
......@@ -139,7 +139,7 @@ class TableVisitor(object):
for trans in gtr:
trans.accept(self)
return
def visit_ctop_node(self, node):
"""
after registering the node, visit subnodes and transitions
......@@ -152,7 +152,7 @@ class TableVisitor(object):
for gtr in node.transitions:
for trans in gtr:
trans.accept(self)
def visit_ctransition(self, trans):
"""
visit transition
......@@ -177,7 +177,7 @@ class FrontierVisitor(object):
"""
def __init__(self):
self.frontier = []
def is_frontier(self, node):
"""
Find if a node is a frontier node or a start node.
......@@ -190,13 +190,13 @@ class FrontierVisitor(object):
if trans.ori.is_start():
return True
return False
def visit_chart_model(self, model):
"""
Entrance for the visitor
"""
model.get_root().accept(self)
def visit_csimple_node(self, node):
"""
check if it is a frontier node
......@@ -209,31 +209,31 @@ class FrontierVisitor(object):
Nothing to do
"""
pass
def visit_ctrap_node(self, node):
"""
Nothing to do
"""
pass
pass
def visit_cinput_node(self, node):
"""
Nothing to do
"""
pass
def visit_cmacro_node(self, node):
"""
macros are not on the frontier
"""
pass
def visit_cperm_node(self, node):
"""
Nothing to do
"""
pass
def visit_ctop_node(self, node):
"""
visit subnodes
......@@ -241,24 +241,24 @@ class FrontierVisitor(object):
# sub states
for sst in node.sub_nodes:
sst.accept(self)
class IndirectFlowGraphBuilder(object):
"""
build a networkx indirect graph of transitions
"""
def __init__(self, nwx_graph):
"""
@param nwx_graph: networkx graph
@param nwx_graph: networkx graph
nwx_graph is populated by place nodes and transition edges
"""
self.graph = nwx_graph
def visit_chart_model(self, model):
"""
entrance through top node
"""
model.get_root().accept(self)
def visit_csimple_node(self, node):
"""
Nothing to do
......@@ -270,19 +270,19 @@ class IndirectFlowGraphBuilder(object):
Nothing to do
"""
pass
def visit_ctrap_node(self, node):
"""
Nothing to do
"""
pass
pass
def visit_cinput_node(self, node):
"""
Nothing to do
"""
pass
def visit_cmacro_node(self, node):
"""
visit sub elements
......@@ -293,38 +293,38 @@ class IndirectFlowGraphBuilder(object):
# sub states
for sst in node.sub_nodes:
sst.accept(self)
def visit_cperm_node(self, node):
"""
Nothing to do
"""
pass
def visit_ctop_node(self, node):
"""
same as macro
"""
self.visit_cmacro_node(node)
class DirectFlowGraphBuilder(object):
"""
build a networkx graph of transitions
"""
def __init__(self, nwx_graph, direct=True):
"""
@param nwx_graph: networkx Digraph
@param direct: true if direct graph is built (default), false for the inverse graph
@param nwx_graph: networkx Digraph
@param direct: true if direct graph is built (default), false for the inverse graph
nwx_graph is populated by place nodes and transition edges
"""
self.graph = nwx_graph
self.direction = direct
self.graph = nwx_graph
self.direction = direct
def visit_chart_model(self, model):
"""
entrance through top node
"""
model.get_root().accept(self)
def visit_csimple_node(self, node):
"""
Nothing to do
......@@ -336,19 +336,19 @@ class DirectFlowGraphBuilder(object):
Nothing to dot
"""
pass
def visit_ctrap_node(self, node):
"""
Nothing to do
"""
pass
pass
def visit_cinput_node(self, node):
"""
Nothing to do
"""
pass
def visit_cmacro_node(self, node):
"""
collect edges from transitions
......@@ -362,20 +362,20 @@ class DirectFlowGraphBuilder(object):
# sub states
for sst in node.sub_nodes:
sst.accept(self)
def visit_cperm_node(self, node):
"""
Nothing to do
"""
pass
def visit_ctop_node(self, node):
"""t
same as macro
"""
self.visit_cmacro_node(node)
class EstimExpVisitor(object):
"""
Partial Evaluator of event and condition expressions (subset of sig expressions)
......@@ -384,7 +384,7 @@ class EstimExpVisitor(object):
"""
def __init__(self, symb_t):
"""
@param symb_t: symbol table associating values to SOME places
@param symb_t: symbol table associating values to SOME places
"""
self.symb_table = symb_t # this symbol table must contains name-> value
......@@ -399,7 +399,7 @@ class EstimExpVisitor(object):
except KeyError:
val = 0 # indeterminate
return val
def visit_sig_const(self, cex):
"""
coding of the constant on 1,-1
......@@ -408,7 +408,7 @@ class EstimExpVisitor(object):
return 1
else:
return -1
def visit_sig_default(self, dex):
"""
this evaluation is valid for clocks only
......@@ -456,7 +456,7 @@ class SigExpIdCollectVisitor(object):
"""
def __init__(self):
"""
simple walker
simple walker
"""
pass
......@@ -465,13 +465,13 @@ class SigExpIdCollectVisitor(object):
@param iexp: the expression
"""
return [iexp.name]
def visit_sig_const(self, cexp):
"""
no id
"""
return []
def visit_sig_default(self, dexp):
"""
ids come from both operands
......@@ -508,6 +508,5 @@ class SigExpIdCollectVisitor(object):
"""
ll1 = nex.operand.accept(self)
return ll1
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment