-
Notifications
You must be signed in to change notification settings - Fork 5
/
type.cpp
133 lines (92 loc) · 2.7 KB
/
type.cpp
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
/*
This is type.cpp
Coxeter version 3.0 Copyright (C) 2002 Fokko du Cloux
See file main.cpp for full copyright notice
*/
#include "type.h"
namespace {
const char* affinetypes ="abcdefg";
const char *finitetypes = "ABCDEFGHI";
};
/****************************************************************************
Chapter I -- The Type class.
For now, a type contains just a name.
****************************************************************************/
namespace coxeter {
Type::Type():d_name("")
/*
Default constructor; yields the undefined type.
*/
{}
Type::Type(const char* str):d_name(str)
/*
Makes the type with name str.
*/
{}
Type::~Type()
/*
Just destroy the corresponding String.
*/
{}
/*****************************************************************************
Chapter II -- Type recognition.
This section contains the definitions of the type-recognition functions
declared in this module. The following functions are defined :
- isAffineType(const Type&) : recognizes affine Coxeter groups;
- isFiniteType(const Type&) : recognizes finite Coxeter groups;
- isTypeA(const Type&) : recognizes type A;
- isTypeB(const Type&) : recognizes type B;
- isTypeD(const Type&) : recognizes type D;
*****************************************************************************/
bool isAffineType(const Type& x)
/*
Recognizes the type of an affine group. This function defines the class
of groups that will be treated as affine groups in this program; the i/o
setup is flexible enough that there is no reason that an affine group
should be entered otherwise.
*/
{
if (strchr(affinetypes,x[0]) == NULL)
return false;
return true;
}
bool isFiniteType(const Type& type)
/*
Recognizes the type of a finite group. Non-irreducible types are
allowed; they are words in the irreducible types. This function
defines the class of groups that will be treated as finite groups
in this program; the i/o setup is flexible enough that there is
no reason that a finite group should be entered otherwise.
*/
{
for (Ulong j = 0; j < type.name().length(); ++j) {
if (strchr(finitetypes,type[j]) == NULL)
return false;
}
return true;
}
bool isTypeA(const Type& type)
/*
Recognizes if the group is of type A; it is assumed that isFiniteType
has already been checked.
*/
{
return type[0] == 'A';
}
bool isTypeB(const Type& type)
/*
Recognizes if the group is of type B; it is assumed that isFiniteType
has already been checked.
*/
{
return type[0] == 'B';
}
bool isTypeD(const Type& type)
/*
Recognizes if the group is of type D; it is assumed that isFiniteType
has already been checked.
*/
{
return type[0] == 'D';
}
};