1 /*
2 This is type.cpp
3
4 Coxeter version 3.0 Copyright (C) 2002 Fokko du Cloux
5 See file main.cpp for full copyright notice
6 */
7
8 #include "type.h"
9
10 namespace {
11
12 const char* affinetypes ="abcdefg";
13 const char *finitetypes = "ABCDEFGHI";
14 };
15
16 /****************************************************************************
17
18 Chapter I -- The Type class.
19
20 For now, a type contains just a name.
21
22 ****************************************************************************/
23
24 namespace coxeter {
25
Type()26 Type::Type():d_name("")
27
28 /*
29 Default constructor; yields the undefined type.
30 */
31
32 {}
33
Type(const char * str)34 Type::Type(const char* str):d_name(str)
35
36 /*
37 Makes the type with name str.
38 */
39
40 {}
41
~Type()42 Type::~Type()
43
44 /*
45 Just destroy the corresponding String.
46 */
47
48 {}
49
50 /*****************************************************************************
51
52 Chapter II -- Type recognition.
53
54 This section contains the definitions of the type-recognition functions
55 declared in this module. The following functions are defined :
56
57 - isAffineType(const Type&) : recognizes affine Coxeter groups;
58 - isFiniteType(const Type&) : recognizes finite Coxeter groups;
59 - isTypeA(const Type&) : recognizes type A;
60 - isTypeB(const Type&) : recognizes type B;
61 - isTypeD(const Type&) : recognizes type D;
62
63 *****************************************************************************/
64
isAffineType(const Type & x)65 bool isAffineType(const Type& x)
66
67 /*
68 Recognizes the type of an affine group. This function defines the class
69 of groups that will be treated as affine groups in this program; the i/o
70 setup is flexible enough that there is no reason that an affine group
71 should be entered otherwise.
72 */
73
74 {
75 if (strchr(affinetypes,x[0]) == NULL)
76 return false;
77 return true;
78 }
79
isFiniteType(const Type & type)80 bool isFiniteType(const Type& type)
81
82 /*
83 Recognizes the type of a finite group. Non-irreducible types are
84 allowed; they are words in the irreducible types. This function
85 defines the class of groups that will be treated as finite groups
86 in this program; the i/o setup is flexible enough that there is
87 no reason that a finite group should be entered otherwise.
88 */
89
90 {
91 for (Ulong j = 0; j < type.name().length(); ++j) {
92 if (strchr(finitetypes,type[j]) == NULL)
93 return false;
94 }
95
96 return true;
97 }
98
isTypeA(const Type & type)99 bool isTypeA(const Type& type)
100
101 /*
102 Recognizes if the group is of type A; it is assumed that isFiniteType
103 has already been checked.
104 */
105
106 {
107 return type[0] == 'A';
108 }
109
isTypeB(const Type & type)110 bool isTypeB(const Type& type)
111
112 /*
113 Recognizes if the group is of type B; it is assumed that isFiniteType
114 has already been checked.
115 */
116
117 {
118 return type[0] == 'B';
119 }
120
isTypeD(const Type & type)121 bool isTypeD(const Type& type)
122
123 /*
124 Recognizes if the group is of type D; it is assumed that isFiniteType
125 has already been checked.
126 */
127
128 {
129 return type[0] == 'D';
130 }
131
132 };
133
134