List<Templete> childrenTemplete = pattern.getChildrenTempletes();
if (!childrenTemplete.isEmpty()) {
Element childTempleteElement = new Element("childTempleteList", pbd);
Iterator childTempleteIterator = childrenTemplete.iterator();
while (childTempleteIterator.hasNext()) {
Templete childTemplete = (Templete) childTempleteIterator.next();
String childTempleteName = childTemplete.getName();
childTempleteElement.addContent(new Element("templete", pbd).setAttribute("name", childTempleteName));
}
childrenElement.addContent(childTempleteElement);
}
patternElement.addContent(childrenElement);
//�Ѹ�ģʽ����ģʽ�б�
patternList.addContent(patternElement);
}
//�洢����ģ��
Map<String, Templete> allTempletes = patternBase.getAllTempletes();
Iterator templeteIterator = allTempletes.values().iterator();
while (templeteIterator.hasNext()) {
Templete templete = (Templete) templeteIterator.next();
String templeteName = templete.getName();
Element templeteElement = new Element("templete", pbd);
templeteElement.setAttribute("name", templeteName);
String parentType;
String parentName;
//���ø���������ģʽ��Ҳ������ģ��
if (templete.getParentType() == "templete") {
parentType = "templete";
parentName = ((Templete) templete.getParent()).getName();
} else {
parentType = "pattern";
parentName = ((Pattern) templete.getParent()).getName();
}
Element parentElement = new Element("parent", pbd);
parentElement.setAttribute("type", parentType).setAttribute("name", parentName);
templeteElement.addContent(parentElement);
List<Templete> tChildTempletes = templete.getChildrenTempletes();
if (!tChildTempletes.isEmpty()) {
Element tChildTempleteElement = new Element("childTempleteList", pbd);
Iterator tChildTempleteIterator = tChildTempletes.iterator();
while (tChildTempleteIterator.hasNext()) {
Templete tChildTemplete = (Templete) tChildTempleteIterator.next();
String tChildTempleteName = tChildTemplete.getName();
Element childElement = new Element("Templete", pbd);
childElement.setAttribute("name", tChildTempleteName);
tChildTempleteElement.addContent(childElement);
}
templeteElement.addContent(tChildTempleteElement);