Factory模式:Windows工厂生产按钮和编辑框
AbstractFactory模式:苹果工厂和Windows工厂生产按钮和编辑框
Factory模式
①定义创建对象的接口,封装了对象的创建;②使得具体化类的工作延迟到了子类中。D:\MathTool\gaptool>FiniteGroupGL(2,R)的子群GAP[6,1]:bO=1
GL(2,R)的子群GAP[6,1]:
GL(2,R)的子群GAP[6,2]:bO=1
GL(2,R)的子群GAP[6,2]:
GAP[8,1]:
GAP[8,2]=GAP[4,1]×GAP[2,1]:
GL(2,R)的子群GAP[8,3]:bO=1
GL(2,R)的子群GAP[8,3]:
GL(2,C)的子群GAP[8,4]:bU=1,bO=0
GL(2,C)的子群GAP[8,4]:
GL(2,8)的12阶子群GAP[12,1]:
GL(2,8)的12阶子群GAP[12,2]:
GL(2,4)的12阶子群GAP[12,3]:
GL(2,8)的12阶子群GAP[12,4]:
GL(2,8)的12阶子群GAP[12,5]:
GL(2,14)的16阶子群GAP[16,1]:
GL(2,12)的16阶子群GAP[16,4]:
GAP[16,6]:
GL(2,14)的16阶子群GAP[16,7]:
GL(2,3)的16阶子群GAP[16,8]:
GL(2,14)的16阶子群GAP[16,9]:
GAP[16,13]:
GAP[24,2]=GAP[8,1]×GAP[3,1]:
GL(2,3)的24阶子群GAP[24,3]:
GL(2,14)的24阶子群GAP[24,4]:
GL(2,17)的24阶子群GAP[24,5]:
GL(2,14)的24阶子群GAP[24,6]:
GL(2,12)的24阶子群GAP[24,7]:
GL(2,4)的24阶子群GAP[24,8]:
GAP[24,9]=GAP[8,2]×GAP[3,1]:
GAP[24,12]:
GAP[24,13]=GAP[12,3]×GAP[2,1]:
GAP[24,14]=GAP[12,4]×GAP[2,1]:
GAP[24,15]=GAP[12,5]×GAP[2,1]:
GL(2,12)的32阶子群GAP[32,9]:
GL(2,7)的32阶子群GAP[32,19]:
GAP[32,37]=GAP[16,6]×GAP[2,1]:
GAP[32,48]=GAP[16,13]×GAP[2,1]:
GL(2,14)的48阶子群GAP[48,2]:
GL(2,6)的48阶子群GAP[48,6]:
GL(2,R)的子群GAP[48,7]:bO=1
GL(2,R)的子群GAP[48,7]:
GL(2,14)的48阶子群GAP[48,8]:
GL(2,12)的48阶子群GAP[48,13]:
GL(2,8)的48阶子群GAP[48,14]:
GL(2,12)的48阶子群GAP[48,23]:
GAP[48,24]=GAP[16,6]×GAP[3,1]:
GL(2,3)的48阶子群GAP[48,29]:
GL(2,4)的48阶子群GAP[48,30]:
GL(2,6)的48阶子群GAP[48,32]:
GAP[48,47]=GAP[16,13]×GAP[3,1]:
GL(2,4)的48阶子群GAP[48,48]:
GL(2,4)的48阶子群GAP[48,49]:
#include"FiniteGroup.h"
#include"DecompositionGroup.h"
#include"GLnR.h"
#include"GLnC.h"
#include"GL2Zn.h"
#include"PermGroup.h"
typedef IGroup*(*newGFunc)(int);
class grouptool
{
public:
grouptool();
~grouptool();
public:
static int NumberSmallGroups(int n);
static newGFunc newGn(int n);
static vector<int> Cn(int n);
static IGroup* newT1(int n);
static IGroup* newT2(int n);
static IGroup* newT3(int n);
static IGroup* newCn(int n);
static IGroup* newG6(int ID);
static IGroup* newG8(int ID);
static IGroup* newG12(int ID);
static IGroup* newG16(int ID);
static IGroup* newG24(int ID);
static IGroup* newG32(int ID);
static IGroup* newG48(int ID);
};
IGroup* grouptool::newT1(int n){
GL2Zn *t1=new GL2Zn();
t1->m_n=n;
vector<TM2> gen;
TM2 a(4);
TM2 b(4);
a[0]=0;
a[1]=1;
a[2]=n-1;
a[3]=0;
b[0]=n-1;
b[1]=n-1;
b[2]=n-1;
b[3]=0;
gen.push_back(a);
gen.push_back(b);
t1->s_Arr=GL2Zn::FG(gen,n);
return t1;
}
IGroup* grouptool::newT2(int n){
GL2Zn *t=new GL2Zn();
t->m_n=n;
vector<TM2> gen;
TM2 a(4);
TM2 b(4);
a[0]=0;
a[1]=n-1;
a[2]=n-1;
a[3]=0;
b[0]=n-1;
b[1]=n-1;
b[2]=n-1;
b[3]=0;
gen.push_back(a);
gen.push_back(b);
t->s_Arr=GL2Zn::FG(gen,n);
return t;
}
IGroup* grouptool::newT3(int n){
GL2Zn *t=new GL2Zn();
t->m_n=n;
vector<TM2> gen;
TM2 a(4);
TM2 b(4);
a[0]=0;
a[1]=n-1;
a[2]=1;
a[3]=0;
b[0]=n-1;
b[1]=1;
b[2]=0;
b[3]=n-1;
gen.push_back(a);
gen.push_back(b);
t->s_Arr=GL2Zn::FG(gen,n);
return t;
}
// 生成循环群C_n的凯莱表
vector<int> grouptool::Cn(int n){
vector<int> v(n*n);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
int ij=(i+j)%n;
v[i*n+j]=ij;
}
}
return v;
}
int grouptool::NumberSmallGroups(int n){
static map<int,int> M;
if(M.size()==0){
M.insert(make_pair(6,2));
M.insert(make_pair(8,5));
M.insert(make_pair(12,5));
M.insert(make_pair(16,14));
M.insert(make_pair(24,15));
M.insert(make_pair(32,51));
M.insert(make_pair(48,52));
}
map<int,int>::const_iterator it=M.find(n);
if(it!=M.end()){
return it->second;
}
return 0;
}
newGFunc grouptool::newGn(int n){
static map<int,newGFunc> M;
if(M.size()==0){
M.insert(make_pair(6,grouptool::newG6));
M.insert(make_pair(8,grouptool::newG8));
M.insert(make_pair(12,grouptool::newG12));
M.insert(make_pair(16,grouptool::newG16));
M.insert(make_pair(24,grouptool::newG24));
M.insert(make_pair(32,grouptool::newG32));
M.insert(make_pair(48,grouptool::newG48));
}
map<int,newGFunc>::const_iterator it=M.find(n);
if(it!=M.end()){ <