intial source from ttp://www.sf.net/projects/wdte
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.js.core / src / net / sourceforge / phpeclipse / js / core / model / JSClassElement.java
1 /*
2  * Created on May 15, 2003
3  *========================================================================
4  * Modifications history
5  *========================================================================
6  * $Log: not supported by cvs2svn $
7  * Revision 1.1  2004/02/26 02:25:42  agfitzp
8  * renamed packages to match xml & css
9  *
10  * Revision 1.1  2004/02/05 03:10:08  agfitzp
11  * Initial Submission
12  *
13  * Revision 1.1.2.1  2003/12/12 21:37:24  agfitzp
14  * Experimental work for Classes view
15  *
16  * Revision 1.2  2003/05/30 20:53:09  agfitzp
17  * 0.0.2 : Outlining is now done as the user types. Some other bug fixes.
18  *
19  *
20  *========================================================================
21 */
22 package net.sourceforge.phpeclipse.js.core.model;
23
24 import java.util.HashMap;
25
26 import org.eclipse.core.resources.IFile;
27
28 /**
29  * @author fitzpata
30  *
31  */
32 public class JSClassElement extends JSElement
33 {
34         protected HashMap childrenByName;
35         protected boolean isPrototype = false;
36
37         /**
38          * @param aName
39          * @param offset
40          * @param length
41          */
42         public JSClassElement(IFile aFile, String aName, int offset, int length)
43         {
44                 super(aFile, aName, offset, length);
45                 childrenByName = new HashMap();
46         }
47
48         public void addChildElement(JSElement anElement)
49         {
50                 String elementName = anElement.getName();
51                 if(!childrenByName.containsKey(elementName))
52                 {
53                         this.children.add(anElement);
54                         this.childrenByName.put(elementName, anElement);
55                         anElement.setParent(this);
56                 }
57         }
58
59         public int category()
60         {
61                 return CLASS;   
62         }
63
64         /**
65          * @return
66          */
67         public boolean isPrototype()
68         {
69                 return isPrototype;
70         }
71
72         /**
73          * @param b
74          */
75         public void setPrototype(boolean b)
76         {
77                 isPrototype = b;
78         }
79
80 }