2 Java class SpdFileContents is used to parse spd xml file.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 package org
.tianocore
.frameworkwizard
.packaging
.ui
;
16 import java
.io
.IOException
;
17 import java
.util
.ArrayList
;
18 import java
.util
.List
;
19 import java
.util
.ListIterator
;
20 import java
.util
.Vector
;
23 import org
.apache
.xmlbeans
.XmlObject
;
24 import org
.apache
.xmlbeans
.XmlOptions
;
25 import org
.apache
.xmlbeans
.XmlCursor
;
27 import org
.tianocore
.GuidDeclarationsDocument
;
29 import org
.tianocore
.LibraryClassDeclarationsDocument
;
31 import org
.tianocore
.ModuleTypeDef
;
32 import org
.tianocore
.MsaFilesDocument
;
33 import org
.tianocore
.PackageDefinitionsDocument
;
34 import org
.tianocore
.PackageHeadersDocument
;
35 import org
.tianocore
.PackageSurfaceAreaDocument
;
36 import org
.tianocore
.PcdDataTypes
;
37 import org
.tianocore
.PcdDeclarationsDocument
;
38 import org
.tianocore
.PpiDeclarationsDocument
;
39 import org
.tianocore
.ProtocolDeclarationsDocument
;
40 import org
.tianocore
.SpdHeaderDocument
;
41 import org
.tianocore
.GuidDeclarationsDocument
.GuidDeclarations
;
44 This class processes spd file contents such as add remove xml elements.
46 @since PackageEditor 1.0
49 public class SpdFileContents
{
51 private File file
= null;
53 private PackageSurfaceAreaDocument psad
= null;
55 private PackageSurfaceAreaDocument
.PackageSurfaceArea psaRoot
= null;
57 private SpdHeaderDocument
.SpdHeader spdHdr
= null;
59 private PackageDefinitionsDocument
.PackageDefinitions spdPkgDefs
= null;
61 private LibraryClassDeclarationsDocument
.LibraryClassDeclarations spdLibClassDeclarations
= null;
63 private MsaFilesDocument
.MsaFiles spdMsaFiles
= null;
65 private PackageHeadersDocument
.PackageHeaders spdModHdrs
= null;
67 private GuidDeclarationsDocument
.GuidDeclarations spdGuidDeclarations
= null;
69 private ProtocolDeclarationsDocument
.ProtocolDeclarations spdProtocolDeclarations
= null;
71 private PpiDeclarationsDocument
.PpiDeclarations spdPpiDeclarations
= null;
73 private PcdDeclarationsDocument
.PcdDeclarations spdPcdDefinitions
= null;
76 Constructor to create a new spd file
78 public SpdFileContents() {
80 psad
= PackageSurfaceAreaDocument
.Factory
.newInstance();
81 psaRoot
= psad
.addNewPackageSurfaceArea();
86 Constructor for existing document object
89 public SpdFileContents(PackageSurfaceAreaDocument
.PackageSurfaceArea psa
) {
91 spdHdr
= psaRoot
.getSpdHeader();
92 spdPkgDefs
= psaRoot
.getPackageDefinitions();
95 Constructor based on an existing spd file
97 @param f Existing spd file
99 public SpdFileContents(File f
) {
101 psad
= PackageSurfaceAreaDocument
.Factory
.parse(f
);
102 psaRoot
= psad
.getPackageSurfaceArea();
104 } catch (Exception e
) {
105 System
.out
.println(e
.toString());
110 Remove existing pcd definitions elements using XmlCursor
112 public void removeSpdPcdDefinition() {
113 XmlObject o
= psaRoot
.getPcdDeclarations();
116 XmlCursor cursor
= o
.newCursor();
118 spdPcdDefinitions
= null;
122 public void removeSpdPcdDefinition(int i
){
123 XmlObject o
= psaRoot
.getPcdDeclarations();
126 XmlCursor cursor
= o
.newCursor();
127 if (cursor
.toFirstChild()) {
128 for (int j
= 0; j
< i
; ++j
) {
129 cursor
.toNextSibling();
132 if (getSpdPcdDefinitionCount() == 0) {
141 Remove existing ppi declarations using XmlCursor
143 public void removeSpdPpiDeclaration() {
144 XmlObject o
= psaRoot
.getPpiDeclarations();
147 XmlCursor cursor
= o
.newCursor();
149 spdPpiDeclarations
= null;
153 public void removeSpdPpiDeclaration(int i
){
154 XmlObject o
= psaRoot
.getPpiDeclarations();
157 XmlCursor cursor
= o
.newCursor();
158 if (cursor
.toFirstChild()) {
159 for (int j
= 0; j
< i
; ++j
) {
160 cursor
.toNextSibling();
163 if (getSpdPpiDeclarationCount() == 0){
171 Remove existing protocols declarations using XmlCursor
173 public void removeSpdProtocolDeclaration() {
174 XmlObject o
= psaRoot
.getProtocolDeclarations();
177 XmlCursor cursor
= o
.newCursor();
179 spdProtocolDeclarations
= null;
183 public void removeSpdProtocolDeclaration(int i
) {
184 XmlObject o
= psaRoot
.getProtocolDeclarations();
187 XmlCursor cursor
= o
.newCursor();
188 if (cursor
.toFirstChild()) {
189 for (int j
= 0; j
< i
; ++j
) {
190 cursor
.toNextSibling();
193 if (getSpdProtocolDeclarationCount() == 0) {
201 Remove existing GUID declarations using XmlCursor
203 public void removeSpdGuidDeclaration() {
204 XmlObject o
= psaRoot
.getGuidDeclarations();
207 XmlCursor cursor
= o
.newCursor();
209 spdGuidDeclarations
= null;
213 public void removeSpdGuidDeclaration(int i
) {
214 XmlObject o
= psaRoot
.getGuidDeclarations();
217 XmlCursor cursor
= o
.newCursor();
218 if (cursor
.toFirstChild()) {
219 for (int j
= 0; j
< i
; ++j
) {
220 cursor
.toNextSibling();
223 if (getSpdGuidDeclarationCount() == 0) {
232 Remove existing spd package include files using XmlCursor
234 public void removeSpdPkgHeader() {
235 XmlObject o
= psaRoot
.getPackageHeaders();
238 XmlCursor cursor
= o
.newCursor();
244 public void removeSpdPkgHeader(int i
){
245 XmlObject o
= psaRoot
.getPackageHeaders();
248 XmlCursor cursor
= o
.newCursor();
249 if (cursor
.toFirstChild()) {
250 for (int j
= 0; j
< i
; ++j
) {
251 cursor
.toNextSibling();
254 if (getSpdPackageHeaderCount() == 0) {
263 Remove existing msa files using XmlCursor
265 public void removeSpdMsaFile() {
266 XmlObject o
= psaRoot
.getMsaFiles();
269 XmlCursor cursor
= o
.newCursor();
275 public void removeSpdMsaFile(int i
){
276 XmlObject o
= psaRoot
.getMsaFiles();
279 XmlCursor cursor
= o
.newCursor();
280 if (cursor
.toFirstChild()) {
281 for (int j
= 0; j
< i
; ++j
) {
282 cursor
.toNextSibling();
285 if (getSpdMsaFileCount() == 0) {
294 Remove existing library class declarations using XmlCursor
296 public void removeSpdLibClass() {
297 XmlObject o
= psaRoot
.getLibraryClassDeclarations();
300 XmlCursor cursor
= o
.newCursor();
302 spdLibClassDeclarations
= null;
306 public void removeSpdLibClass(int i
) {
307 XmlObject o
= psaRoot
.getLibraryClassDeclarations();
310 XmlCursor cursor
= o
.newCursor();
311 if (cursor
.toFirstChild()) {
312 for (int j
= 0; j
< i
; ++j
) {
313 cursor
.toNextSibling();
316 if (getSpdLibClassDeclarationCount() == 0) {
324 public void updateSpdLibClass(int i
, String lib
, String hdr
, String hlp
, String clsUsage
, String instanceVer
, String hdrAttribArch
, String hdrAttribModType
) {
325 XmlObject o
= psaRoot
.getLibraryClassDeclarations();
329 XmlCursor cursor
= o
.newCursor();
330 if (cursor
.toFirstChild()) {
331 for (int j
= 0; j
< i
; ++j
) {
332 cursor
.toNextSibling();
334 LibraryClassDeclarationsDocument
.LibraryClassDeclarations
.LibraryClass lc
= (LibraryClassDeclarationsDocument
.LibraryClassDeclarations
.LibraryClass
)cursor
.getObject();
336 lc
.setIncludeHeader(hdr
);
338 if (clsUsage
!= null) {
339 lc
.setRecommendedInstanceGuid(clsUsage
);
340 if (instanceVer
!= null){
341 lc
.setRecommendedInstanceVersion(instanceVer
);
343 lc
.unsetRecommendedInstanceVersion();
346 lc
.unsetRecommendedInstanceGuid();
347 lc
.unsetRecommendedInstanceVersion();
350 if (stringToList(hdrAttribArch
) != null){
351 lc
.setSupArchList(stringToList(hdrAttribArch
));
353 lc
.unsetSupArchList();
355 if (stringToList(hdrAttribModType
) != null){
356 lc
.setSupModuleList(stringToList(hdrAttribModType
));
358 lc
.unsetSupModuleList();
365 public void updateSpdMsaFile(int i
, String msaFile
, String mName
, String v
, String g
){
366 XmlObject o
= psaRoot
.getMsaFiles();
370 XmlCursor cursor
= o
.newCursor();
371 if (cursor
.toFirstChild()) {
372 for (int j
= 0; j
< i
; ++j
) {
373 cursor
.toNextSibling();
375 cursor
.setTextValue(msaFile
);
382 public void updateSpdGuidDecl(int i
, String name
, String cName
, String guid
, String hlp
, String archList
,
383 String modTypeList
, String guidTypeList
){
384 XmlObject o
= psaRoot
.getGuidDeclarations();
389 XmlCursor cursor
= o
.newCursor();
390 if (cursor
.toFirstChild()) {
391 for (int j
= 0; j
< i
; ++j
) {
392 cursor
.toNextSibling();
394 GuidDeclarationsDocument
.GuidDeclarations
.Entry e
= (GuidDeclarationsDocument
.GuidDeclarations
.Entry
)cursor
.getObject();
397 e
.setGuidValue(guid
);
399 if (stringToList(guidTypeList
) != null) {
400 e
.setGuidTypeList(stringToList(guidTypeList
));
403 e
.unsetGuidTypeList();
405 if (stringToList(archList
) != null){
406 e
.setSupArchList(stringToList(archList
));
409 e
.unsetSupArchList();
411 if (stringToList(modTypeList
) != null) {
412 e
.setSupModuleList(stringToList(modTypeList
));
415 e
.unsetSupModuleList();
422 public void updateSpdPpiDecl(int i
, String name
, String cName
, String guid
, String hlp
, String archList
,
424 XmlObject o
= psaRoot
.getPpiDeclarations();
429 XmlCursor cursor
= o
.newCursor();
430 if (cursor
.toFirstChild()) {
431 for (int j
= 0; j
< i
; ++j
) {
432 cursor
.toNextSibling();
434 PpiDeclarationsDocument
.PpiDeclarations
.Entry e
= (PpiDeclarationsDocument
.PpiDeclarations
.Entry
)cursor
.getObject();
437 e
.setGuidValue(guid
);
439 if (stringToList(archList
) != null){
440 e
.setSupArchList(stringToList(archList
));
443 e
.unsetSupArchList();
445 if (stringToList(modTypeList
) != null) {
446 e
.setSupModuleList(stringToList(modTypeList
));
449 e
.unsetSupModuleList();
455 public void updateSpdProtocolDecl(int i
, String name
, String cName
, String guid
, String hlp
, String archList
,
457 XmlObject o
= psaRoot
.getProtocolDeclarations();
462 XmlCursor cursor
= o
.newCursor();
463 if (cursor
.toFirstChild()) {
464 for (int j
= 0; j
< i
; ++j
) {
465 cursor
.toNextSibling();
467 ProtocolDeclarationsDocument
.ProtocolDeclarations
.Entry e
= (ProtocolDeclarationsDocument
.ProtocolDeclarations
.Entry
)cursor
.getObject();
470 e
.setGuidValue(guid
);
472 if (stringToList(archList
) != null){
473 e
.setSupArchList(stringToList(archList
));
476 e
.unsetSupArchList();
478 if (stringToList(modTypeList
) != null) {
479 e
.setSupModuleList(stringToList(modTypeList
));
482 e
.unsetSupModuleList();
488 public void updateSpdPkgHdr(int i
, String pkgName
, String hdrName
){
489 XmlObject o
= psaRoot
.getPackageHeaders();
494 XmlCursor cursor
= o
.newCursor();
495 if (cursor
.toFirstChild()) {
496 for (int j
= 0; j
< i
; ++j
) {
497 cursor
.toNextSibling();
500 PackageHeadersDocument
.PackageHeaders
.IncludePkgHeader iph
= (PackageHeadersDocument
.PackageHeaders
.IncludePkgHeader
)cursor
.getObject();
501 iph
.setModuleType(ModuleTypeDef
.Enum
.forString(pkgName
));
502 iph
.setStringValue(hdrName
);
507 public void updateSpdPcdDefinition(int i
, String cName
, String token
, String dataType
, String pcdItemTypes
,
508 String spaceGuid
, String defaultString
, String help
, String archList
, String modTypeList
){
509 XmlObject o
= psaRoot
.getPcdDeclarations();
512 XmlCursor cursor
= o
.newCursor();
513 if (cursor
.toFirstChild()) {
514 for (int j
= 0; j
< i
; ++j
) {
515 cursor
.toNextSibling();
517 PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry e
= (PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry
)cursor
.getObject();
520 e
.setDatumType(PcdDataTypes
.Enum
.forString(dataType
));
521 if (pcdItemTypes
!= null && pcdItemTypes
.length() > 0) {
522 String usage
[] = pcdItemTypes
.split("( )+");
523 List
<String
> l
= new ArrayList
<String
>();
524 for (int k
= 0; k
< usage
.length
; ++k
) {
530 e
.setTokenSpaceGuidCName(spaceGuid
);
531 e
.setDefaultValue(defaultString
);
533 if (archList
!= null && archList
.length() > 0){
534 e
.setSupArchList(stringToList(archList
));
536 if (modTypeList
!= null && modTypeList
.length() > 0){
537 e
.setSupModuleList(stringToList(modTypeList
));
543 Get spd file header contents into String array
545 @param s Caller allocated String array
547 public void getSpdHdrDetails(String
[] s
) {
548 if (getSpdHdr() == null) {
549 spdHdr
= psaRoot
.addNewSpdHeader();
551 s
[0] = getSpdHdrPkgName();
552 s
[1] = getSpdHdr().getGuidValue();
553 s
[2] = getSpdHdrVer();
554 // s[3] = getSpdHdr().getAbstract();
555 s
[4] = getSpdHdr().getDescription();
556 s
[5] = getSpdHdr().getCopyright();
557 s
[6] = getSpdHdrLicense();
562 Get the number of library class declarations from the size of List
566 public int getSpdLibClassDeclarationCount() {
567 if (psaRoot
.getLibraryClassDeclarations() == null
568 || psaRoot
.getLibraryClassDeclarations().getLibraryClassList() == null) {
571 return psaRoot
.getLibraryClassDeclarations().getLibraryClassList().size();
575 Get available library class declaration into String array
576 @param libClass Caller allocated two-dimentional String array
578 public void getSpdLibClassDeclarations(String
[][] libClass
) {
579 if (psaRoot
.getLibraryClassDeclarations() == null){
583 List
<LibraryClassDeclarationsDocument
.LibraryClassDeclarations
.LibraryClass
> l
= psaRoot
.getLibraryClassDeclarations().getLibraryClassList();
585 ListIterator li
= l
.listIterator();
586 while (li
.hasNext()) {
587 LibraryClassDeclarationsDocument
.LibraryClassDeclarations
.LibraryClass lc
= (LibraryClassDeclarationsDocument
.LibraryClassDeclarations
.LibraryClass
) li
.next();
589 libClass
[i
][0] = lc
.getName();
590 libClass
[i
][1] = lc
.getIncludeHeader();
591 libClass
[i
][2] = lc
.getHelpText();
592 // LAH added logic so you cannot set the version unless the GUID is defined.
593 /* LAH do not set now
594 if (lc.getRecommendedInstanceGuid() != null) {
595 libClass[i][3] = lc.getRecommendedInstanceGuid();
596 if (lc.getRecommendedInstanceVersion() != null) {
597 libClass[i][4] = lc.getRecommendedInstanceVersion();
601 if (lc
.getSupArchList() != null) {
602 libClass
[i
][5] = listToString(lc
.getSupArchList());
604 if (lc
.getSupModuleList() != null) {
605 libClass
[i
][6] = listToString(lc
.getSupModuleList());
616 Get the number of Msa files from the size of List
620 public int getSpdMsaFileCount() {
621 if (psaRoot
.getMsaFiles() == null || psaRoot
.getMsaFiles().getFilenameList() == null) {
624 return psaRoot
.getMsaFiles().getFilenameList().size();
628 Get available Msa file into String array
630 @param msaFile Caller allocated two-dimentional String array
632 public void getSpdMsaFiles(String
[][] msaFile
) {
633 if (psaRoot
.getMsaFiles() == null) {
636 List
<String
> l
= psaRoot
.getMsaFiles().getFilenameList();
638 ListIterator li
= l
.listIterator();
639 while (li
.hasNext()) {
640 msaFile
[i
][0] = (String
)li
.next();
647 Get the number of include header files in PackageHeaders from the size of List
651 public int getSpdPackageHeaderCount() {
652 if (psaRoot
.getPackageHeaders() == null || psaRoot
.getPackageHeaders().getIncludePkgHeaderList() == null) {
655 return psaRoot
.getPackageHeaders().getIncludePkgHeaderList().size();
659 Get available package header contents into String array
661 @param pkgHeader Caller allocated two-dimentional String array
663 public void getSpdPackageHeaders(String
[][] pkgHeader
) {
664 if (psaRoot
.getPackageHeaders() == null) {
668 List
<PackageHeadersDocument
.PackageHeaders
.IncludePkgHeader
> l
= psaRoot
.getPackageHeaders().getIncludePkgHeaderList();
670 ListIterator li
= l
.listIterator();
671 while (li
.hasNext()) {
672 PackageHeadersDocument
.PackageHeaders
.IncludePkgHeader ih
= (PackageHeadersDocument
.PackageHeaders
.IncludePkgHeader
) li
.next();
673 if (ih
.getModuleType() != null) {
674 pkgHeader
[i
][0] = ih
.getModuleType().toString();
677 pkgHeader
[i
][1] = ih
.getStringValue();
683 Get the number of GUID declarations from the size of List
687 public int getSpdGuidDeclarationCount() {
688 if (psaRoot
.getGuidDeclarations() == null || psaRoot
.getGuidDeclarations().getEntryList() == null) {
691 return psaRoot
.getGuidDeclarations().getEntryList().size();
695 Get available Guid declaration contents into String array
697 @param guid Caller allocated two-dimentional String array
699 public void getSpdGuidDeclarations(String
[][] guid
) {
700 if (psaRoot
.getGuidDeclarations() == null) {
704 List
<GuidDeclarationsDocument
.GuidDeclarations
.Entry
> l
= psaRoot
.getGuidDeclarations().getEntryList();
706 ListIterator li
= l
.listIterator();
707 while (li
.hasNext()) {
708 GuidDeclarationsDocument
.GuidDeclarations
.Entry e
= (GuidDeclarationsDocument
.GuidDeclarations
.Entry
) li
710 guid
[i
][0] = e
.getName();
711 guid
[i
][1] = e
.getCName();
712 if (e
.getGuidValue() != null) {
713 guid
[i
][2] = e
.getGuidValue();
715 guid
[i
][3] = e
.getHelpText();
716 guid
[i
][4] = listToString(e
.getSupArchList());
717 guid
[i
][5] = listToString(e
.getSupModuleList());
718 guid
[i
][6] = listToString(e
.getGuidTypeList());
724 Get the number of protocol declarations from the size of List
728 public int getSpdProtocolDeclarationCount() {
729 if (psaRoot
.getProtocolDeclarations() == null || psaRoot
.getProtocolDeclarations().getEntryList() == null) {
732 return psaRoot
.getProtocolDeclarations().getEntryList().size();
736 Get available protocol declaration contents into String array
738 @param protocol Caller allocated two-dimentional String array
740 public void getSpdProtocolDeclarations(String
[][] protocol
) {
741 if (psaRoot
.getProtocolDeclarations() == null) {
745 List
<ProtocolDeclarationsDocument
.ProtocolDeclarations
.Entry
> l
= psaRoot
.getProtocolDeclarations()
748 ListIterator li
= l
.listIterator();
749 while (li
.hasNext()) {
750 ProtocolDeclarationsDocument
.ProtocolDeclarations
.Entry e
= (ProtocolDeclarationsDocument
.ProtocolDeclarations
.Entry
) li
752 protocol
[i
][0] = e
.getName();
753 protocol
[i
][1] = e
.getCName();
754 if (e
.getGuidValue() != null) {
755 protocol
[i
][2] = e
.getGuidValue();
757 protocol
[i
][3] = e
.getHelpText();
758 protocol
[i
][4] = listToString(e
.getSupArchList());
759 protocol
[i
][5] = listToString(e
.getSupModuleList());
765 Get the number of Ppi declarations from the size of List
769 public int getSpdPpiDeclarationCount() {
770 if (psaRoot
.getPpiDeclarations() == null || psaRoot
.getPpiDeclarations().getEntryList() == null) {
773 return psaRoot
.getPpiDeclarations().getEntryList().size();
777 Get available Ppi declaration contents into String array
779 @param ppi Caller allocated two-dimentional String array
781 public void getSpdPpiDeclarations(String
[][] ppi
) {
782 if (psaRoot
.getPpiDeclarations() == null) {
786 List
<PpiDeclarationsDocument
.PpiDeclarations
.Entry
> l
= psaRoot
.getPpiDeclarations().getEntryList();
788 ListIterator li
= l
.listIterator();
789 while (li
.hasNext()) {
790 PpiDeclarationsDocument
.PpiDeclarations
.Entry e
= (PpiDeclarationsDocument
.PpiDeclarations
.Entry
) li
.next();
791 ppi
[i
][0] = e
.getName();
792 ppi
[i
][1] = e
.getCName();
793 if (e
.getGuidValue() != null) {
794 ppi
[i
][2] = e
.getGuidValue();
796 ppi
[i
][3] = e
.getHelpText();
797 ppi
[i
][4] = listToString(e
.getSupArchList());
798 ppi
[i
][5] = listToString(e
.getSupModuleList());
805 Get the number of Pcd definitions from the size of List
809 public int getSpdPcdDefinitionCount() {
810 if (psaRoot
.getPcdDeclarations() == null || psaRoot
.getPcdDeclarations().getPcdEntryList() == null) {
813 return psaRoot
.getPcdDeclarations().getPcdEntryList().size();
817 Get available Pcd definition contents into String array
819 @param pcd Caller allocated two-dimentional String array
821 public void getSpdPcdDefinitions(String
[][] pcd
, String pcdUsage
[][]) {
822 if (psaRoot
.getPcdDeclarations() == null) {
826 List
<PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry
> l
= psaRoot
.getPcdDeclarations().getPcdEntryList();
828 while (i
< l
.size()) {
829 PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry e
= (PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry
)l
.get(i
);
830 pcd
[i
][0] = e
.getCName();
831 pcd
[i
][1] = e
.getToken() + "";
832 pcd
[i
][2] = e
.getTokenSpaceGuidCName();
833 if (e
.getDatumType() != null) {
834 pcd
[i
][3] = e
.getDatumType().toString();
836 pcd
[i
][4] = e
.getDefaultValue()+"";
837 pcd
[i
][5] = e
.getHelpText();
838 String archList
= listToString(e
.getSupArchList());
839 if (archList
!= null) {
840 pcd
[i
][6] = archList
;
842 String modTypeList
= listToString(e
.getSupModuleList());
843 if (modTypeList
!= null) {
844 pcd
[i
][7] = modTypeList
;
848 while (j
< e
.getValidUsage().size() && j
< 5) {
849 pcdUsage
[i
][j
] = (String
)e
.getValidUsage().get(j
);
857 Save the processed xml contents to file
859 @param spdFile The file to save xml contents
860 @throws IOException Exceptions during file operation
862 public void saveAs(File spdFile
) throws IOException
{
864 XmlOptions options
= new XmlOptions();
866 options
.setCharacterEncoding("UTF-8");
867 options
.setSavePrettyPrint();
868 options
.setSavePrettyPrintIndent(2);
870 psad
.save(spdFile
, options
);
871 } catch (IOException e
) {
878 Generate SpdHeader contents using parameters passed in.
880 @param pkgName PackageName
882 @param pkgVer Version
883 @param pkgAbs Abstract
884 @param pkgDes Description
885 @param pkgCpRight Copyright
886 @param pkgLicense License
887 @param pkgCreateDate Created
888 @param pkgUpdateDate Updated
890 @param pkgType PackageType
891 @param pkgRdOnly ReadOnly
892 @param pkgRePkg RePackage
893 @param pkgSpec Reserved
894 @param pkgOutDir Reserved
896 public void genSpdHeader(String pkgName
, String pkgGuid
, String pkgVer
, String pkgAbs
, String pkgDes
,
897 String pkgCpRight
, String pkgLicense
, String pkgCreateDate
, String pkgUpdateDate
,
898 String pkgURL
, String pkgType
, String pkgRdOnly
, String pkgRePkg
, String pkgSpec
,
900 if (getSpdHdr() == null) {
901 spdHdr
= psaRoot
.addNewSpdHeader();
904 setSpdHdrPkgName(pkgName
);
905 setSpdHdrGuidValue(pkgGuid
);
906 setSpdHdrVer(pkgVer
);
907 setSpdHdrAbs(pkgAbs
);
908 setSpdHdrDescription(pkgDes
);
909 setSpdHdrCopyright(pkgCpRight
);
910 setSpdHdrLicense(pkgLicense
);
913 setSpdHdrSpec(pkgSpec
);
917 Generate library class declaration element using parameters passed in
919 @param libClassBaseName LibraryClass element value
920 @param libClassUsage Reserved
921 @param incHdrFileName IncludeHeader element value
922 @param incHdrAttribGuid Reserved
923 @param incHdrAttribArch Reserved
924 @param incHdrAttribPath Reserved
925 @param incHdrAttribClass Reserved
926 @param incHdrAttribVer Reserved
927 @param incHdrAttribOverrideID Reserved
928 @param incHdrAttribModuleType Reserved
930 public void genSpdLibClassDeclarations(String libClassBaseName
, String instanceUsage
, String incHdrFileName
,
931 String help
, String incHdrAttribArch
, String incHdrAttribPath
,
932 String incHdrAttribClass
, String incHdrAttribVer
,
933 String incHdrAttribOverrideID
, String incHdrAttribModuleType
) {
934 if (getSpdLibClassDeclarations() == null) {
935 spdLibClassDeclarations
= psaRoot
.addNewLibraryClassDeclarations();
938 // add contents under LibraryClassDeclarations tag
940 setSpdLibClassDeclaration(libClassBaseName
, instanceUsage
, incHdrFileName
, help
, incHdrAttribArch
,
941 incHdrAttribPath
, incHdrAttribClass
, incHdrAttribVer
, incHdrAttribOverrideID
,
942 incHdrAttribModuleType
, spdLibClassDeclarations
);
946 Set library class declaration contents under parent tag
948 @param clsName LibraryClass element value
949 @param clsUsage Reserved
950 @param hdrFile IncludeHeader element value
951 @param hdrAttribGuid Reserved
952 @param hdrAttribArch Reserved
953 @param hdrAttribPath Reserved
954 @param hdrAttribClass Reserved
955 @param hdrAttribVer Reserved
956 @param hdrAttribOverID Reserved
957 @param hdrAttribModType Reserved
958 @param parent The tag under which library class declaration goes to
960 public void setSpdLibClassDeclaration(String clsName
, String clsUsage
, String hdrFile
, String help
,
961 String hdrAttribArch
, String hdrAttribPath
, String hdrAttribClass
,
962 String instanceVer
, String hdrAttribOverID
, String hdrAttribModType
,
965 setSpdLibraryClass(clsName
, hdrFile
, help
, clsUsage
, instanceVer
, hdrAttribArch
, hdrAttribModType
, parent
);
970 Set the contents of LibraryClass under parent element
972 @param clsName LibraryClass element value
973 @param clsUsage Reserved
974 @param parent The tag under which library class declaration goes to
976 public void setSpdLibraryClass(String clsName
, String clsIncludeFile
, String help
, String clsUsage
, String instanceVer
, String hdrAttribArch
, String hdrAttribModType
, XmlObject parent
) {
977 LibraryClassDeclarationsDocument
.LibraryClassDeclarations
.LibraryClass lc
= ((LibraryClassDeclarationsDocument
.LibraryClassDeclarations
) parent
).addNewLibraryClass();
979 lc
.setIncludeHeader(clsIncludeFile
);
980 lc
.setHelpText(help
);
981 // LAH added logic so you cannot set the version unless the GUID is defined.
983 if (clsUsage != null) {
984 lc.setRecommendedInstanceGuid(clsUsage);
985 if (instanceVer != null) {
986 lc.setRecommendedInstanceVersion(instanceVer);
990 if (hdrAttribArch
!= null) {
991 lc
.setSupArchList(stringToList(hdrAttribArch
));
993 if (hdrAttribModType
!= null) {
994 lc
.setSupModuleList(stringToList(hdrAttribModType
));
996 lc
.unsetSupModuleList();
1002 Set contents of IncludeHeader under parent element
1004 @param modType Reserved
1005 @param hdrFile IncludeHeader element value
1006 @param hdrAttribGuid Reserved
1007 @param hdrAttribArch Reserved
1008 @param hdrAttribPath Reserved
1009 @param hdrAttribClass Reserved
1010 @param hdrAttribVer Reserved
1011 @param hdrAttribOverID Reserved
1012 @param parent The tag under which library class declaration goes to
1014 public void setSpdIncludeHeader(String modType
, String hdrFile
, String hdrAttribGuid
, String hdrAttribArch
,
1015 String hdrAttribPath
, String hdrAttribClass
, String hdrAttribVer
,
1016 String hdrAttribOverID
, XmlObject parent
) {
1018 if (parent
instanceof LibraryClassDeclarationsDocument
.LibraryClassDeclarations
) {
1019 } else if (parent
instanceof PackageHeadersDocument
.PackageHeaders
) {
1020 PackageHeadersDocument
.PackageHeaders
.IncludePkgHeader ih
= null;
1021 ih
= ((PackageHeadersDocument
.PackageHeaders
) parent
).addNewIncludePkgHeader();
1022 ih
.setStringValue(hdrFile
);
1023 ih
.setModuleType(ModuleTypeDef
.Enum
.forString(modType
));
1028 if (hdrAttribGuid
!= null) {
1030 if (hdrAttribPath
!= null) {
1032 if (hdrAttribClass
!= null) {
1034 if (hdrAttribVer
!= null) {
1036 if (hdrAttribOverID
!= null) {
1042 Generate MsaFile element.
1044 @param msaFileName MsaFile element value
1045 @param archType Reserved
1047 public void genSpdMsaFiles(String msaFileName
, String moduleName
, String ver
, String guid
) {
1048 if (getSpdMsaFiles() == null) {
1049 spdMsaFiles
= psaRoot
.addNewMsaFiles();
1051 setSpdMsaFile(msaFileName
, moduleName
, ver
, guid
, spdMsaFiles
);
1056 Set MsaFile contents under parent element.
1058 @param msaFileName MsaFile element value
1059 @param parent Element under which MsaFile goes to
1061 public void setSpdMsaFile(String msaFileName
, String moduleName
, String ver
, String guid
, XmlObject parent
) {
1062 MsaFilesDocument
.MsaFiles f
= (MsaFilesDocument
.MsaFiles
)parent
;
1063 f
.addNewFilename().setStringValue(msaFileName
);
1064 // f.setFilename(msaFileName);
1065 // f.setModuleName(moduleName);
1066 // f.setModuleVersion(ver);
1067 // f.setModuleGuid(guid);
1071 Generate PackageHeader element using parameters passed in.
1073 @param ModHdrModType ModuleType attribute of IncludeHeader element
1074 @param hdrFile IncludeHeader element value
1075 @param hdrAttribGuid Reserved
1076 @param hdrAttribArch Reserved
1077 @param hdrAttribPath Reserved
1078 @param hdrAttribClass Reserved
1079 @param hdrAttribVer Reserved
1080 @param hdrAttribOverID Reserved
1082 public void genSpdModuleHeaders(String ModHdrModType
, String hdrFile
, String hdrAttribGuid
, String hdrAttribArch
,
1083 String hdrAttribPath
, String hdrAttribClass
, String hdrAttribVer
,
1084 String hdrAttribOverID
) {
1085 if (getSpdModHdrs() == null) {
1086 spdModHdrs
= psaRoot
.addNewPackageHeaders();
1090 // add IncludeHeader under PackageHeaders element
1092 setSpdIncludeHeader(ModHdrModType
, hdrFile
, hdrAttribGuid
, hdrAttribArch
, hdrAttribPath
, hdrAttribClass
,
1093 hdrAttribVer
, hdrAttribOverID
, spdModHdrs
);
1097 Generate GUID declaration element using parameters passed in.
1099 @param guidDeclEntryName Name attribute of Entry element
1100 @param guidDeclCName CName element value
1101 @param guidDeclGuid Guid element value
1102 @param guidDeclFeatureFlag Reserved
1104 public void genSpdGuidDeclarations(String guidDeclEntryName
, String guidDeclCName
, String guidDeclGuid
,
1105 String guidDeclHelp
, Vector
<String
> archList
, Vector
<String
> modTypeList
,
1106 Vector
<String
> guidTypeList
) {
1107 if (getSpdGuidDeclarations() == null) {
1108 spdGuidDeclarations
= psaRoot
.addNewGuidDeclarations();
1111 setSpdEntry(guidDeclEntryName
, guidDeclCName
, guidDeclGuid
, guidDeclHelp
, archList
, modTypeList
, guidTypeList
, spdGuidDeclarations
);
1115 Generate protocol declaration element using parameters passed in.
1117 @param protocolDeclEntryName Name attribute of Entry element
1118 @param protocolDeclCName CName element value
1119 @param protocolDeclGuid Guid element value
1120 @param protocolDeclFeatureFlag Reserved
1122 public void genSpdProtocolDeclarations(String protocolDeclEntryName
, String protocolDeclCName
,
1123 String protocolDeclGuid
, String protocolDeclFeatureFlag
,
1124 Vector
<String
> archList
, Vector
<String
> modTypeList
) {
1125 if (getSpdProtocolDeclarations() == null) {
1126 spdProtocolDeclarations
= psaRoot
.addNewProtocolDeclarations();
1129 setSpdEntry(protocolDeclEntryName
, protocolDeclCName
, protocolDeclGuid
, protocolDeclFeatureFlag
,
1130 archList
, modTypeList
, null, spdProtocolDeclarations
);
1134 Generate PPI declaration element using parameters passed in.
1136 @param ppiDeclEntryName Name attribute of Entry element
1137 @param ppiDeclCName CName element value
1138 @param ppiDeclGuid Guid element value
1139 @param ppiDeclFeatureFlag Reserved
1141 public void genSpdPpiDeclarations(String ppiDeclEntryName
, String ppiDeclCName
, String ppiDeclGuid
,
1142 String ppiDeclFeatureFlag
, Vector
<String
> archList
, Vector
<String
> modTypeList
) {
1143 if (getSpdPpiDeclarations() == null) {
1144 spdPpiDeclarations
= psaRoot
.addNewPpiDeclarations();
1147 setSpdEntry(ppiDeclEntryName
, ppiDeclCName
, ppiDeclGuid
, ppiDeclFeatureFlag
, archList
, modTypeList
, null, spdPpiDeclarations
);
1151 Set Entry contents using parameters passed in
1153 @param entryName Name attribute of Entry element
1154 @param cName CName element value
1155 @param guid Guid element value
1156 @param featureFlag Reserved
1157 @param parent The tag under which Entry element goes to
1159 public void setSpdEntry(String entryName
, String cName
, String guid
, String help
,
1160 Vector
<String
> archList
, Vector
<String
> modTypeList
,
1161 Vector
<String
> guidTypeList
, XmlObject parent
) {
1163 if (parent
instanceof GuidDeclarationsDocument
.GuidDeclarations
) {
1164 GuidDeclarationsDocument
.GuidDeclarations
.Entry e
= ((GuidDeclarations
) parent
).addNewEntry();
1165 e
.setName(entryName
);
1167 e
.setGuidValue(guid
);
1168 e
.setHelpText(help
);
1169 e
.setGuidTypeList(guidTypeList
);
1170 e
.setSupArchList(archList
);
1171 e
.setSupModuleList(modTypeList
);
1172 // if (guidTypeList != null && guidTypeList.size() > 0) {
1173 // e.setGuidTypeList(new ArrayList<String>(guidTypeList));
1175 // if (archList != null && archList.size() > 0){
1176 // e.setSupArchList(new ArrayList<String>(archList));
1178 // if (modTypeList != null && modTypeList.size() > 0) {
1179 // e.setSupModuleList(new ArrayList<String>(modTypeList));
1183 if (parent
instanceof ProtocolDeclarationsDocument
.ProtocolDeclarations
) {
1184 ProtocolDeclarationsDocument
.ProtocolDeclarations
.Entry pe
= ((ProtocolDeclarationsDocument
.ProtocolDeclarations
) parent
)
1186 pe
.setName(entryName
);
1188 pe
.setGuidValue(guid
);
1189 pe
.setHelpText(help
);
1190 pe
.setSupArchList(archList
);
1191 pe
.setSupModuleList(modTypeList
);
1192 // if (archList != null && archList.size() > 0){
1193 // pe.setSupArchList(new ArrayList<String>(archList));
1195 // if (modTypeList != null && modTypeList.size() > 0) {
1196 // pe.setSupModuleList(new ArrayList<String>(modTypeList));
1200 if (parent
instanceof PpiDeclarationsDocument
.PpiDeclarations
) {
1201 PpiDeclarationsDocument
.PpiDeclarations
.Entry ppe
= ((PpiDeclarationsDocument
.PpiDeclarations
) parent
)
1203 ppe
.setName(entryName
);
1204 ppe
.setCName(cName
);
1205 ppe
.setGuidValue(guid
);
1206 ppe
.setHelpText(help
);
1207 ppe
.setSupArchList(archList
);
1208 ppe
.setSupModuleList(modTypeList
);
1209 // if (archList != null && archList.size() > 0){
1210 // ppe.setSupArchList(new ArrayList<String>(archList));
1212 // if (archList != null && modTypeList.size() > 0) {
1213 // ppe.setSupModuleList(new ArrayList<String>(modTypeList));
1223 Generate Pcd definition using parameters passed in
1225 @param pcdItemTypes ItemType attribute of PcdEntry element
1226 @param cName C_Name element value
1227 @param token Token element value
1228 @param dataType DatumType element value
1229 @param skuEnable Reserved
1231 @param maxSku Reserved
1232 @param hiiEnable Reserved
1233 @param varGuid Reserved
1234 @param varName Reserved
1235 @param defaultString DefaultString element value
1237 public void genSpdPcdDefinitions(String cName
, String token
, String dataType
, String pcdItemTypes
,
1238 String spaceGuid
, String defaultString
, String help
, String archList
,
1239 String modTypeList
) {
1240 if (getSpdPcdDefinitions() == null) {
1241 spdPcdDefinitions
= psaRoot
.addNewPcdDeclarations();
1244 setSpdPcdEntry(pcdItemTypes
, cName
, token
, dataType
, spaceGuid
, help
,
1245 defaultString
, archList
, modTypeList
, spdPcdDefinitions
);
1249 Set Pcd entry contents under parent tag
1251 @param pcdItemTypes ItemType attribute of PcdEntry element
1252 @param cName C_Name element value
1253 @param token Token element value
1254 @param dataType DatumType element value
1255 @param spaceGuid Reserved
1256 @param help Reserved
1257 @param defaultString DefaultString element value
1258 @param parent Tag under which PcdEntry goes to
1260 public void setSpdPcdEntry(String pcdItemTypes
, String cName
, String token
, String dataType
, String spaceGuid
, String help
,
1261 String defaultString
, String archList
, String modTypeList
, XmlObject parent
) {
1263 PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry pe
= ((PcdDeclarationsDocument
.PcdDeclarations
) parent
).addNewPcdEntry();
1265 //ToDo: maybe multiple types in, need parse pcdItemTypes.
1266 String usage
[] = pcdItemTypes
.split("( )+");
1267 List
<String
> l
= new ArrayList
<String
>();
1268 for (int i
= 0; i
< usage
.length
; ++i
) {
1271 pe
.setValidUsage(l
);
1274 pe
.setDatumType(PcdDataTypes
.Enum
.forString(dataType
));
1275 pe
.setDefaultValue(defaultString
);
1276 pe
.setTokenSpaceGuidCName(spaceGuid
);
1277 pe
.setHelpText(help
);
1278 if (archList
!= null){
1279 pe
.setSupArchList(stringToList(archList
));
1281 pe
.unsetSupArchList();
1283 if (modTypeList
!= null){
1284 pe
.setSupModuleList(stringToList(modTypeList
));
1286 pe
.unsetSupModuleList();
1291 Get PpiDeclarations element
1293 @return PpiDeclarationsDocument.PpiDeclarations
1295 public PpiDeclarationsDocument
.PpiDeclarations
getSpdPpiDeclarations() {
1296 if (spdPpiDeclarations
== null) {
1297 spdPpiDeclarations
= psaRoot
.getPpiDeclarations();
1299 return spdPpiDeclarations
;
1303 Get ProtocolDeclarations element
1305 @return ProtocolDeclarationsDocument.ProtocolDeclarations
1307 public ProtocolDeclarationsDocument
.ProtocolDeclarations
getSpdProtocolDeclarations() {
1308 if (spdProtocolDeclarations
== null) {
1309 spdProtocolDeclarations
= psaRoot
.getProtocolDeclarations();
1311 return spdProtocolDeclarations
;
1315 Get GuidDeclarations element
1317 @return GuidDeclarationsDocument.GuidDeclarations
1319 public GuidDeclarationsDocument
.GuidDeclarations
getSpdGuidDeclarations() {
1320 if (spdGuidDeclarations
== null) {
1321 spdGuidDeclarations
= psaRoot
.getGuidDeclarations();
1323 return spdGuidDeclarations
;
1327 Get PcdDefinitions element
1329 @return PcdDefinitionsDocument.PcdDefinitions
1331 public PcdDeclarationsDocument
.PcdDeclarations
getSpdPcdDefinitions() {
1332 if (spdPcdDefinitions
== null) {
1333 spdPcdDefinitions
= psaRoot
.getPcdDeclarations();
1335 return spdPcdDefinitions
;
1339 Get PackageHeaders element
1341 @return PackageHeadersDocument.PackageHeaders
1343 public PackageHeadersDocument
.PackageHeaders
getSpdModHdrs() {
1344 if (spdModHdrs
== null) {
1345 spdModHdrs
= psaRoot
.getPackageHeaders();
1351 Get MsaFiles element
1353 @return MsaFilesDocument.MsaFiles
1355 public MsaFilesDocument
.MsaFiles
getSpdMsaFiles() {
1356 if (spdMsaFiles
== null) {
1357 spdMsaFiles
= psaRoot
.getMsaFiles();
1363 Get LibraryClassDeclarations element
1365 @return LibraryClassDeclarationsDocument.LibraryClassDeclarations
1367 public LibraryClassDeclarationsDocument
.LibraryClassDeclarations
getSpdLibClassDeclarations() {
1368 if (spdLibClassDeclarations
== null) {
1369 spdLibClassDeclarations
= psaRoot
.getLibraryClassDeclarations();
1371 return spdLibClassDeclarations
;
1374 public PackageDefinitionsDocument
.PackageDefinitions
getSpdPkgDefs() {
1375 if (spdPkgDefs
== null) {
1376 spdPkgDefs
= psaRoot
.addNewPackageDefinitions();
1381 Get SpdHeader element
1383 @return SpdHeaderDocument.SpdHeader
1385 public SpdHeaderDocument
.SpdHeader
getSpdHdr() {
1386 if (spdHdr
== null) {
1387 spdHdr
= psaRoot
.addNewSpdHeader();
1393 Set value to Guid element
1395 @param guid The value set to Guid element
1397 public void setSpdHdrGuidValue(String guid
) {
1398 getSpdHdr().setGuidValue(guid
);
1402 Get Version element under SpdHdr
1406 public String
getSpdHdrVer() {
1407 return getSpdHdr().getVersion();
1411 Set value to Version element
1413 @param ver The value set to Version element
1415 public void setSpdHdrVer(String ver
) {
1416 getSpdHdr().setVersion(ver
);
1419 public String
getSpdHdrAbs(){
1420 return getSpdHdr().getAbstract();
1425 Set value to Abstract element
1427 @param abs The value set to Abstract element
1429 public void setSpdHdrAbs(String abs
) {
1431 getSpdHdr().setAbstract(abs
);
1434 public String
getSpdHdrDescription(){
1435 return getSpdHdr().getDescription();
1438 Set value to Description element
1440 @param des The value set to Description element
1442 public void setSpdHdrDescription(String des
) {
1443 getSpdHdr().setDescription(des
);
1446 public String
getSpdHdrCopyright(){
1447 return getSpdHdr().getCopyright();
1450 Set value to Copyright element
1452 @param cpRit The value set to Copyright element
1454 public void setSpdHdrCopyright(String cpRit
) {
1456 getSpdHdr().setCopyright(cpRit
);
1460 Get License element under SpdHdr
1464 public String
getSpdHdrLicense() {
1465 if (getSpdHdr().getLicense() != null) {
1466 return getSpdHdr().getLicense().getStringValue();
1472 Set value to License element
1474 @param license The value set to License element
1476 public void setSpdHdrLicense(String license
) {
1477 if (getSpdHdr().getLicense() == null){
1478 getSpdHdr().addNewLicense().setStringValue(license
);
1481 getSpdHdr().getLicense().setStringValue(license
);
1485 public String
getSpdHdrUrl(){
1486 if (getSpdHdr().getLicense() != null) {
1487 return getSpdHdr().getLicense().getURL();
1492 public void setSpdHdrUrl(String url
){
1493 getSpdHdr().getLicense().setURL(url
);
1497 Get PackageName element under SpdHdr
1501 public String
getSpdHdrPkgName() {
1503 return getSpdHdr().getPackageName();
1507 Set value to PackageName element
1509 @param pkgName The value set to PackageName element
1511 public void setSpdHdrPkgName(String pkgName
) {
1512 getSpdHdr().setPackageName(pkgName
);
1515 public String
getSpdHdrGuidValue(){
1516 return getSpdHdr().getGuidValue();
1522 @return SpecificationDocument.Specification
1524 public String
getSpdHdrSpec() {
1525 return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
1526 // return getSpdHdr().getSpecification();
1534 public void setSpdHdrSpec(String spec
) {
1535 spec
= "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
1536 getSpdHdr().setSpecification(spec
);
1540 public String
getSpdPkgDefsRdOnly(){
1541 return getSpdPkgDefs().getReadOnly() + "";
1544 Set value to ReadOnly element
1546 @param rdOnly The value set to ReadOnly element
1548 public void setSpdPkgDefsRdOnly(String rdOnly
) {
1550 getSpdPkgDefs().setReadOnly(new Boolean(rdOnly
));
1553 public String
getSpdPkgDefsRePkg(){
1554 return getSpdPkgDefs().getRePackage() + "";
1557 Set value to RePackage element
1559 @param rePkg The value set to RePackage element
1561 public void setSpdPkgDefsRePkg(String rePkg
) {
1563 getSpdPkgDefs().setRePackage(new Boolean(rePkg
));
1567 Set value to URL element
1569 @param url The value set to URL element
1571 // public void setSpdHdrURL(String url) {
1572 // getSpdHdr().setURL(url);
1580 public File
getFile() {
1587 @param file File with xml format
1589 public void setFile(File file
) {
1593 private List
<String
> stringToList(String s
){
1594 if (s
== null || s
.length() == 0) {
1597 Vector
<String
> al
= new Vector
<String
>();
1598 String
[] sArray
= s
.split(" ");
1599 for(int i
= 0; i
< sArray
.length
; ++i
){
1605 private String
listToString(List l
) {
1610 ListIterator li
= l
.listIterator();
1611 while(li
.hasNext()) {