mCRL2
Loading...
Searching...
No Matches
transition.h
Go to the documentation of this file.
1// Author(s): Muck van Weerdenburg, Jan Friso Groote
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9
10
11#ifndef MCRL2_LTS_DETAIL_TRANSITION_H
12#define MCRL2_LTS_DETAIL_TRANSITION_H
13
14#include <set>
16
17namespace mcrl2
18{
19namespace lts
20{
21
22namespace detail
23{
24
25inline std::size_t apply_hidden_labels(const std::size_t n, const std::set<std::size_t>& hidden_action_set)
26{
27 if (hidden_action_set.count(n)==0)
28 {
29 return n;
30 }
31 return lts::const_tau_label_index; // 0 is the index of the internal action.
32}
33
35{
36 protected:
37 const std::set<std::size_t>& m_hide_action_set;
38
39 public:
40 compare_transitions_slt(const std::set<std::size_t>& hide_action_set)
41 : m_hide_action_set(hide_action_set)
42 {}
43
44 bool operator()(const transition& t1, const transition& t2)
45 {
46 if (t1.from() != t2.from())
47 {
48 return t1.from() < t2.from();
49 }
50 else
51 {
52 const std::size_t n1=apply_hidden_labels(t1.label(), m_hide_action_set);
53 const std::size_t n2=apply_hidden_labels(t2.label(), m_hide_action_set);
54 if (n1 != n2)
55 {
56 return n1 < n2;
57 }
58 else
59 {
60 return t1.to() < t2.to();
61 }
62 }
63 }
64};
65
67{
68 protected:
69 const std::set<std::size_t>& m_hide_action_set;
70
71 public:
72 compare_transitions_lts(const std::set<std::size_t>& hide_action_set)
73 : m_hide_action_set(hide_action_set)
74 {}
75
76 bool operator()(const transition& t1, const transition& t2)
77 {
78 const std::size_t n1=apply_hidden_labels(t1.label(), m_hide_action_set);
79 const std::size_t n2=apply_hidden_labels(t2.label(), m_hide_action_set);
80 if (n1 != n2)
81 {
82 return n1 < n2;
83 }
84 else if (t1.to() != t2.to())
85 {
86 return t1.to() < t2.to();
87 }
88 else
89 {
90 return t1.from() < t2.from();
91 }
92 }
93};
94
96{
97 protected:
98 const std::set<std::size_t>& m_hide_action_set;
99
100 public:
101 compare_transitions_tls(const std::set<std::size_t>& hide_action_set)
102 : m_hide_action_set(hide_action_set)
103 {}
104
105 bool operator()(const transition& t1, const transition& t2)
106 {
107 if (t1.to() != t2.to())
108 {
109 return t1.to() < t2.to();
110 }
111 else
112 {
113 const std::size_t n1=apply_hidden_labels(t1.label(), m_hide_action_set);
114 const std::size_t n2=apply_hidden_labels(t2.label(), m_hide_action_set);
115 if (n1 != n2)
116 {
117 return n1 < n2;
118 }
119 else
120 {
121 return t1.from() < t2.from();
122 }
123 }
124 }
125};
126
128{
129 protected:
130 const std::set<std::size_t>& m_hide_action_set;
131
132 public:
133 compare_transitions_tsl(const std::set<std::size_t>& hide_action_set)
134 : m_hide_action_set(hide_action_set)
135 {}
136
137 bool operator()(const transition& t1, const transition& t2)
138 {
139 if (t1.to() != t2.to())
140 {
141 return t1.to() < t2.to();
142 }
143 else if (t1.from() != t2.from())
144 {
145 return t1.from() < t2.from();
146 }
147 else
148 {
149 const std::size_t n1=apply_hidden_labels(t1.label(), m_hide_action_set);
150 const std::size_t n2=apply_hidden_labels(t2.label(), m_hide_action_set);
151 return n1 < n2;
152 }
153 }
154};
155
157{
158 protected:
159 const std::set<std::size_t>& m_hide_action_set;
160
161 public:
162 compare_transitions_tl(const std::set<std::size_t>& hide_action_set)
163 : m_hide_action_set(hide_action_set)
164 {}
165
166 bool operator()(const transition& t1, const transition& t2)
167 {
168 if (t1.to() != t2.to())
169 {
170 return t1.to() < t2.to();
171 }
172 else
173 {
174 const std::size_t n1=apply_hidden_labels(t1.label(), m_hide_action_set);
175 const std::size_t n2=apply_hidden_labels(t2.label(), m_hide_action_set);
176 return n1 < n2;
177 }
178 }
179};
180
181
183{
184 public:
186 {}
187
188 bool operator()(const transition& t1, const transition& t2)
189 {
190 return t1.to() < t2.to();
191 }
192};
193
194} // detail
195} // lts
196} // mcrl2
197
198#endif
compare_transitions_lts(const std::set< std::size_t > &hide_action_set)
Definition transition.h:72
bool operator()(const transition &t1, const transition &t2)
Definition transition.h:76
const std::set< std::size_t > & m_hide_action_set
Definition transition.h:69
const std::set< std::size_t > & m_hide_action_set
Definition transition.h:37
bool operator()(const transition &t1, const transition &t2)
Definition transition.h:44
compare_transitions_slt(const std::set< std::size_t > &hide_action_set)
Definition transition.h:40
bool operator()(const transition &t1, const transition &t2)
Definition transition.h:188
bool operator()(const transition &t1, const transition &t2)
Definition transition.h:166
compare_transitions_tl(const std::set< std::size_t > &hide_action_set)
Definition transition.h:162
const std::set< std::size_t > & m_hide_action_set
Definition transition.h:159
const std::set< std::size_t > & m_hide_action_set
Definition transition.h:98
compare_transitions_tls(const std::set< std::size_t > &hide_action_set)
Definition transition.h:101
bool operator()(const transition &t1, const transition &t2)
Definition transition.h:105
compare_transitions_tsl(const std::set< std::size_t > &hide_action_set)
Definition transition.h:133
const std::set< std::size_t > & m_hide_action_set
Definition transition.h:130
bool operator()(const transition &t1, const transition &t2)
Definition transition.h:137
A class containing triples, source label and target representing transitions.
Definition transition.h:47
size_type from() const
The source of the transition.
Definition transition.h:81
size_type label() const
The label of the transition.
Definition transition.h:87
size_type to() const
The target of the transition.
Definition transition.h:94
std::size_t apply_hidden_labels(const std::size_t n, const std::set< std::size_t > &hidden_action_set)
Definition transition.h:25
static const std::size_t const_tau_label_index
Definition transition.h:27
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
A header file defining a transition as a triple from,label,to.