5
KLocation::KLocation(unsigned c)
14
KLocation::~KLocation() {
18
KLocation::KLocation(const KLocation ©)
19
:Vector<Subject *>(copy),
20
inputset(copy.inputset),
22
transSet(copy.transSet),
23
Transient(copy.Transient) {
24
/* makes deep copies of the lists, but shallow copies of the Subject
25
pointers. However, the PtrSet copying makes deep copies. */
29
KLocation::KLocation(const List<Subject *> ©)
30
:Vector<Subject *>(copy),
38
bool KLocation::operator==(const KLocation &comp) const {
39
if ( count() != comp.count() )
41
for ( int i = count() ; --i >= 0 ; )
42
if ( (*this)[i] != comp[i] )
44
return inputset == comp.inputset;
48
bool KLocation::operator<(const KLocation &comp) const {
49
if ( count() != comp.count() )
50
return count() < comp.count();
51
for ( int i = count() ; --i >= 0 ; )
52
if ( (*this)[i] != comp[i] )
53
return (char *)((*this)[i]) - (char *)(comp[i]) < 0;
54
return inputset < comp.inputset;
58
bool KLocation::HasProp(const string &prop) const {
59
/* Checks whether this KLocation has the property prop. */
60
for ( int i = count() ; --i >= 0 ; ) {
61
const char *cp = (*this)[i]->GetName()->getstr();
63
while ( *cp && isspace(*cp) )
75
while ( *++ep && ! isspace(*ep) && '[' != *ep )
77
if ( memcmp(cp, prop.getstr(), ep - cp) == 0 )
87
string KLocation::GetProp() const {
88
string result = inputset.GetEvents("I_");
89
for ( int i = count() ; --i >= 0 ; ) {
90
const char *cp = (*this)[i]->GetName()->getstr(), *bp;
94
if ( result.length() )
96
result.add(cp, bp ? bp - cp : 0);
101
bp = strchr(cp, ']');
107
char *cp = const_cast<char *>(result.getstr());
108
for ( int i = result.length() ; --i >= 0 ; )
109
if ( isspace(cp[i]) )
115
string KLocation::GetInvar() const {
116
string result = inputset.GetGuards();
118
if ( result.length() )
119
result += " and t=0";
123
for ( int i = count() ; --i >= 0 ; ) {
124
const char *cp = (*this)[i]->GetName()->getstr(), *bp;
126
bp = strchr(cp, '[');
130
bp = strchr(cp, ']');
132
if ( result.length() )
135
result.add(cp, bp ? bp - cp : 0);
143
char *cp = const_cast<char *>(result.getstr());
144
for ( int i = result.length() ; --i >= 0 ; )
145
if ( isspace(cp[i]) )