File: RandomDefinitionsGenerator.h

package info (click to toggle)
magnus 20060324-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 19,404 kB
  • ctags: 20,466
  • sloc: cpp: 130,118; ansic: 37,076; tcl: 10,970; perl: 1,109; makefile: 963; sh: 403; yacc: 372; csh: 57; awk: 33; asm: 10
file content (203 lines) | stat: -rw-r--r-- 5,437 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
// Copyright (C) 2000 The New York Group Theory Cooperative
// See magnus/doc/COPYRIGHT for the full notice.
//
// Contents: Declaration of class RandomDefinitionsGenerator
//
// Principal Author: Alexei Miasnikov
//
// Status: in progress
//
// Revision History:
//


#ifndef _RANDOM_DEFINITIONS_H_
#define _RANDOM_DEFINITIONS_H_

#include "RandomNumbers.h"
#include "FPGroup.h"
#include "Chars.h"
#include "ViewContents.h"
#include <iostream.h>

// ------------------------------------  RandomDefinitionGenerate -----------------------------------
class RandomDefinitionGenerate
{
public:
  RandomDefinitionGenerate() : gw("Parameters") { }

  virtual void readParameters(istream& istr); 
  virtual void requireParameters() = 0; 
  virtual void printDefinition() = 0;
protected:  
  GroupWindow gw;
};

class RandomWordGenerate : public RandomDefinitionGenerate
{
public:
  RandomWordGenerate(istream& is, const FPGroup& p, Chars id);
  void requireParameters(); 
  void printDefinition();

private:

  RandomWordGenerate(const RandomWordGenerate &);
  // just for safety sake

  Chars generateWord( );

  istream& istr; 
  FPGroup parent; 
  Chars theID;
  UniformRandom ur;
  int averagelength;
};

// ------------------------------------  RandomCollectionOfWordsGenerate -----------------------------------

class RandomCollectionOfWordsGenerate : public RandomDefinitionGenerate
{
public:
  RandomCollectionOfWordsGenerate(istream& is, const FPGroup& p, Chars id, bool isS = false);
  void requireParameters(); 
  void printDefinition();

private:

  RandomCollectionOfWordsGenerate(const RandomCollectionOfWordsGenerate &);
  // just for safety sake

  Chars generateCollection( );

  istream& istr; 
  FPGroup parent; 
  Chars theID;
  UniformRandom ur;
  int averagelength;
  int numberOfWords;
  bool isSet;
};

// ------------------------------------  RandomMapGenerate -----------------------------------

class RandomMapGenerate : public RandomDefinitionGenerate
{
public:
  RandomMapGenerate(istream& is, const FPGroup& p, Chars id);
  void requireParameters(); 
  void printDefinition();

private:

  RandomMapGenerate(const RandomMapGenerate &);
  // just for safety sake

  Chars generateMap( );

  istream& istr; 
  FPGroup parent; 
  Chars theID;
  UniformRandom ur;
  int averagelength;

};
// ------------------------------------  RandomGroupGenerate -----------------------------------

class RandomGroupGenerate : public RandomDefinitionGenerate
{
public:
  RandomGroupGenerate(istream& is, Chars id, bool iF = false, bool iN = false, bool iOR = false);
  void requireParameters(); 
  void printDefinition();

private:

  RandomGroupGenerate(const RandomGroupGenerate &);
  // just for safety sake

  Chars generateGroup( );

  istream& istr; 
  Chars theID;
  int maxGens;
  int maxRels;
  int averageRels;
  int nilpClass;

  bool isFree;
  bool isNilpotent;
  bool isOR;
};

// ------------------------------------  RandomSCGroupGenerate -----------------------------------

class RandomSCGroupGenerate : public RandomDefinitionGenerate
{
public:
  RandomSCGroupGenerate(istream& is, Chars id);
  void requireParameters(); 
  void printDefinition();

private:

  RandomSCGroupGenerate(const RandomSCGroupGenerate &);
  // just for safety sake

  Chars generateSCGroup( );

  istream& istr; 
  Chars theID;
  int maxGens;
  int maxRels;
  int averageRels;

};

//---------------------------------------------------------------------------//
//--------------------- RandomDefinitionsGenerator --------------------------//
//---------------------------------------------------------------------------//


class RandomDefinitionsGenerator

{
  
 private:
  
  /////////////////////////////////////////////////////////////////////////
  //                                                                     //
  // Constructors:                                                       //
  //                                                                     //
  /////////////////////////////////////////////////////////////////////////
  
  RandomDefinitionsGenerator( );
  
  /////////////////////////////////////////////////////////////////////////
  //                                                                     //
  // Public Members Touched by Friends:                                  //
  //                                                                     //
  /////////////////////////////////////////////////////////////////////////
  
  friend class SessionManager;
  
  static void readMessage(istream& istr);
  // Used by class SessionManager.
  // this function reads message from the front end which is request for 
  // a definition of an algebraic object. Format of the message is following:
  //   "object_type  window_name", here object type is a string identifying the 
  // object to be defined and window_name - is a  name for a text window where
  // definition will be displayed.
  
  static Chars generateFPGroupPresentation();
    
  /////////////////////////////////////////////////////////////////////////
  //                                                                     //
  // Data Members:                                                       //
  //                                                                     //
  /////////////////////////////////////////////////////////////////////////
  
  static RandomDefinitionGenerate* defGenerator;
};

#endif