initial contribution
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / editor / model / WikipediaSection.java
1 /***********************************************************************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
3  * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
4  * http://www.eclipse.org/legal/cpl-v10.html
5  * 
6  * Contributors: IBM Corporation - initial API and implementation
7  **********************************************************************************************************************************/
8 package net.sourceforge.phpeclipse.wiki.editor.model;
9
10 import java.util.ArrayList;
11
12 public class WikipediaSection {
13   protected static WikipediaSection[] NO_CHILDREN = new WikipediaSection[0];
14
15   private WikipediaSection fParent;
16
17   private String fName;
18
19   private int fOffset;
20   private int fLength;
21   private int fheaderLevel;
22   protected ArrayList recipeElements;
23
24   WikipediaSection(WikipediaSection parent, String name, int level, int offset, int length) {
25     fParent = parent;
26     fName = name;
27     fheaderLevel = level;
28     fOffset = offset;
29     fLength = length;
30     recipeElements = new ArrayList();
31   }
32
33
34   public Object[] getChildren() {
35     return recipeElements.toArray();
36   }
37
38   public String getName() {
39     return fName;
40   }
41
42   public int getOffset() {
43     return fOffset;
44   }
45
46   public int getLength() {
47     return fLength;
48   }
49
50   /**
51    * @param index
52    * @param element
53    */
54   public void add(int index, WikipediaSection element) {
55     recipeElements.add(index, element);
56   }
57
58   /**
59    * @param o
60    * @return
61    */
62   public boolean add(WikipediaSection o) {
63     return recipeElements.add(o);
64   }
65
66   /**
67    * @param index
68    * @return
69    */
70   public WikipediaSection get(int index) {
71     return (WikipediaSection) recipeElements.get(index);
72   }
73
74   /**
75    * @return
76    */
77   public int size() {
78     return recipeElements.size();
79   }
80   
81   /**
82    * @param length The length to set.
83    */
84   public void setLength(int length) {
85     fLength = length;
86   }
87
88   /**
89    * @param offset The fOffset to set.
90    */
91   public void setoffset(int offset) {
92     fOffset = offset;
93   }
94   /**
95    * @return Returns the headerLevel.
96    */
97   public int getHeaderLevel() {
98     return fheaderLevel;
99   }
100   /**
101    * @param fheaderLevel The headerLevel to set.
102    */
103   public void setHeaderLevel(int fheaderLevel) {
104     this.fheaderLevel = fheaderLevel;
105   }
106   /**
107    * @return Returns the parent.
108    */
109   public WikipediaSection getParent() {
110     return fParent;
111   }
112   /**
113    * @param parent The parent to set.
114    */
115   public void setParent(WikipediaSection parent) {
116     fParent = parent;
117   }
118 }