1
//////////////////////////////////////////////////////////////////////////////////
2
// This file is part of Toolkit for Conceptual Modeling (TCM).
3
// (c) copyright 2001, Universiteit Twente.
4
// Author: Rik Eshuis (eshuis@cs.utwente.nl).
6
// TCM is free software; you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation; either version 2 of the License, or
9
// (at your option) any later version.
11
// TCM is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with TCM; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20
////////////////////////////////////////////////////////////////////////////////
21
#include "adshyperedge.h"
22
#include "adshypergraph.h"
23
#include "adsproperty.h"
24
#include "adsvariable.h"
25
#include "outputfile.h"
26
#include "adsclockconstraint.h"
27
//#include <stdlib.h> // for NULL only
32
ADSHyperEdge::ADSHyperEdge(ADSHyperGraph *a, Edge *e): HyperEdge(a,e){
38
bool ADSHyperEdge::AddProp(Prop *p){
39
for (propl.first();!propl.done();propl.next()){
40
if (*propl.cur()==*p) return False;
46
bool ADSHyperEdge::AddVar(ADSVar *v){
47
for (varl.first();!varl.done();varl.next()){
48
if (*varl.cur()==*v) return False;
54
void ADSHyperEdge::GetPropList(List <Prop *> &p){
58
void ADSHyperEdge::GetVarList(List <ADSVar *> &v){
63
void ADSHyperEdge::SetClockConstraint(ClockConstraint *c){
68
ClockConstraint *ADSHyperEdge::GetClockConstraint(){
73
bool ADSHyperEdge::hasClockConstraint(){
78
bool ADSHyperEdge::conflicts(ADSHyperEdge *he){
79
return conflict.contains(he);
82
bool ADSHyperEdge::isconflicting(){
83
return (conflict.count()>0);
86
void ADSHyperEdge::AddEdges(List <Subject *> l){
87
for (l.first();!l.done();l.next()){
88
edgelist.add(l.cur());
92
void ADSHyperEdge::GetEdges(List <Subject *> *l){
93
for (edgelist.first();!edgelist.done();edgelist.next()){
94
l->add(edgelist.cur());
99
string ADSHyperEdge::GetUniqueName(){
101
string hid=(unsigned int)GetId();
105
void ADSHyperEdge::WriteMembers(OutputFile *f){
106
(*f) << "HYPEREDGE ID " << GetId() <<"\n";
107
HyperEdge::WriteMembers(f);
108
for (propl.first();!propl.done();propl.next()){
109
(*f) << "\tPRoperty\n";
110
propl.cur()->Write(f);
113
(*f) << "Clock constraint\n";
114
if (cc!=NULL) cc->Write(f);
115
if (sendevent!=NULL){
116
(*f) << "\tSEND EVENT:\t";
120
for (inlist.first();!inlist.done();inlist.next()){
121
(*f) << "INLIST\n\t\t";
122
inlist.cur()->Write(f);
125
for (notinlist.first();!notinlist.done();notinlist.next()){
126
(*f) << "NOT INLIST\n\t\t";
127
notinlist.cur()->Write(f);
130
for (edgelist.first();!edgelist.done();edgelist.next()){
131
(*f) << "\tedge ID:\t" << edgelist.cur()->GetId() << "\n";
136
void ADSHyperEdge::WriteScreen(){
137
std::cout << "HYPEREDGE ID " << GetId() <<"\n";
139
for (propl.first();!propl.done();propl.next()){
140
std::cout << "\tPRoperty\n";
141
propl.cur()->Write();