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
////////////////////////////////////////////////////////////////////////////////
23
#define HASHSIZE 100003
26
#include "adsvaluation.h"
27
#include "adstransition.h"
30
ValuationHashList::ValuationHashList() {
32
for (i = 0; i < HASHSIZE; i++) {
37
void ValuationHashList::add(ADSValuation *adk,int key) {
39
if (!hash_list[key]) hash_list[key]=new List<ADSValuation *> ;
40
hash_list[key]->add(adk);
43
ADSValuation *ValuationHashList::isin(ADSValuation *adk,int key) {
45
List <ADSValuation *> *l=hash_list[key];
47
for (l->first();!l->done();l->next()){
48
if (*(l->cur())==*adk) return l->cur();
54
void ValuationHashList::Write(OutputFile *f){
57
for (i = 0; i < HASHSIZE; i++) {
58
(*f) << "entry:\t"<< i << "\t\tused:\t"<< (hash_list[i]==NULL?0:hash_list[i]->count() ) << "\n" ;
59
if (hash_list[i]!=NULL) j=j+hash_list[i]->count();
61
(*f) << "\nTotal:\t"<< j <<"\n\n\n\n";
65
TransitionHashList::TransitionHashList() {
67
for (i = 0; i < HASHSIZE; i++) {
72
void TransitionHashList::add(ADSTransition *t,int key) {
74
if (!hash_list[key]) hash_list[key]=new List<ADSTransition *> ;
75
hash_list[key]->add(t);
78
ADSTransition *TransitionHashList::isin(ADSTransition *t,int key) {
80
List <ADSTransition *> *l=hash_list[key];
82
for (l->first();!l->done();l->next()){
83
if (*(l->cur())==*t) return l->cur();
89
void TransitionHashList::Write(OutputFile *f){
91
for (i = 0; i < HASHSIZE; i++) {
92
(*f) << "entry:\t"<< i << "\t\tused:\t"<< (hash_list[i]==NULL?0:hash_list[i]->count() ) << "\n" ;