RC2 compatibility
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / core / jdom / DOMFactory.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.core.jdom;
12
13 import net.sourceforge.phpdt.internal.core.jdom.DOMBuilder;
14 import net.sourceforge.phpdt.internal.core.jdom.SimpleDOMBuilder;
15
16
17
18 /**
19  * Standard implementation of <code>IDOMFactory</code>, and the only means
20  * of creating JDOMs and document fragments.
21  * <p>
22  * This class may be instantiated; it is not intended to be subclassed.
23  * </p>
24  */
25 public class DOMFactory implements IDOMFactory {
26 /**
27  * Creates a new DOM factory.
28  */
29 public DOMFactory() {}
30 /* (non-Javadoc)
31  * Method declared on IDOMFactory.
32  */
33 public IDOMCompilationUnit createCompilationUnit() {
34         return (new DOMBuilder()).createCompilationUnit();
35 }
36 /* (non-Javadoc)
37  * Method declared on IDOMFactory.
38  */
39 public IDOMCompilationUnit createCompilationUnit(char[] sourceCode, String name)  {
40         if(sourceCode == null) {
41                 return null;
42         }               
43         return (new SimpleDOMBuilder()).createCompilationUnit(sourceCode, name.toCharArray());
44 }
45 /* (non-Javadoc)
46  * Method declared on IDOMFactory.
47  */
48 public IDOMCompilationUnit createCompilationUnit(String sourceCode, String name) {
49         if(sourceCode == null) {
50                 return null;
51         }       
52         return (new SimpleDOMBuilder()).createCompilationUnit(sourceCode.toCharArray(), name.toCharArray());
53 }
54 /* (non-Javadoc)
55  * Method declared on IDOMFactory.
56  */
57 //public IDOMField createField() {
58 //      return createField("Object aField;"+ Util.LINE_SEPARATOR); //$NON-NLS-1$
59 //}
60 ///* (non-Javadoc)
61 // * Method declared on IDOMFactory.
62 // */
63 //public IDOMField createField(String sourceCode) {
64 //      if(sourceCode == null) {
65 //              return null;
66 //      }               
67 //      return (new DOMBuilder()).createField(sourceCode.toCharArray());
68 //}
69 /* (non-Javadoc)
70  * Method declared on IDOMFactory.
71  */
72 //public IDOMImport createImport() {
73 //      return (new DOMBuilder()).createImport();
74 //}
75 ///* (non-Javadoc)
76 // * Method declared on IDOMFactory.
77 // */
78 //public IDOMImport createImport(String sourceCode) {
79 //      if(sourceCode == null) {
80 //              return null;
81 //      }               
82 //      return (new DOMBuilder()).createImport(sourceCode.toCharArray());
83 //}
84 /* (non-Javadoc)
85  * Method declared on IDOMFactory.
86  */
87 //public IDOMInitializer createInitializer() {
88 //      return createInitializer("static {}"+ Util.LINE_SEPARATOR); //$NON-NLS-1$
89 //}
90 ///* (non-Javadoc)
91 // * Method declared on IDOMFactory.
92 // */
93 //public IDOMInitializer createInitializer(String sourceCode) {
94 //      if(sourceCode == null) {
95 //              return null;
96 //      }               
97 //      return (new DOMBuilder()).createInitializer(sourceCode.toCharArray());
98 //}
99 /* (non-Javadoc)
100  * Method declared on IDOMFactory.
101  */
102 //public IDOMMethod createMethod() {
103 //      return createMethod("public void newMethod() {"+ Util.LINE_SEPARATOR+"}"+ Util.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
104 //}
105 ///* (non-Javadoc)
106 // * Method declared on IDOMFactory.
107 // */
108 //public IDOMMethod createMethod(String sourceCode) {
109 //      if(sourceCode == null) {
110 //              return null;
111 //      }               
112 //      return (new DOMBuilder()).createMethod(sourceCode.toCharArray());
113 //}
114 /* (non-Javadoc)
115  * Method declared on IDOMFactory.
116  */
117 public IDOMPackage createPackage() {
118         return (new DOMBuilder()).createPackage();
119 }
120 /* (non-Javadoc)
121  * Method declared on IDOMFactory.
122  */
123 //public IDOMPackage createPackage(String sourceCode) {
124 //      if(sourceCode == null) {
125 //              return null;
126 //      }               
127 //      return (new DOMBuilder()).createPackage(sourceCode.toCharArray());
128 //}
129 ///* (non-Javadoc)
130 // * Method declared on IDOMFactory.
131 // */
132 //public IDOMType createType() {
133 //      return createType("public class AClass {"+ Util.LINE_SEPARATOR +"}"+ Util.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
134 //}
135 /* (non-Javadoc)
136  * Method declared on IDOMFactory.
137  */
138 //public IDOMType createClass() {
139 //      return createType("public class AClass {"+ Util.LINE_SEPARATOR +"}"+ Util.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
140 //}
141 ///* (non-Javadoc)
142 // * Method declared on IDOMFactory.
143 // */
144 //public IDOMType createInterface() {
145 //      return createType("public interface AnInterface {"+ Util.LINE_SEPARATOR +"}"+ Util.LINE_SEPARATOR); //$NON-NLS-2$ //$NON-NLS-1$
146 //}
147 /* (non-Javadoc)
148  * Method declared on IDOMFactory.
149  */
150 //public IDOMType createType(String sourceCode) {
151 //      if(sourceCode == null) {
152 //              return null;
153 //      }               
154 //      return (new DOMBuilder()).createType(sourceCode.toCharArray());
155 //}
156 }