A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / parser / NLSLine.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v0.5 
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v05.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.parser;
12
13 import java.util.ArrayList;
14 import java.util.Iterator;
15 import java.util.List;
16
17 import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
18
19 public class NLSLine {
20
21         private List elements;
22
23         public NLSLine() {
24                 this.elements = new ArrayList();
25         }
26
27         /**
28          * Adds a NLS element to this line.
29          */
30         public void add(StringLiteral element) {
31                 this.elements.add(element);
32         }
33
34         /**
35          * returns an Iterator over NLSElements
36          */
37         public Iterator iterator() {
38                 return this.elements.iterator();
39         }
40
41         public StringLiteral get(int index) {
42                 return (StringLiteral) this.elements.get(index);
43         }
44
45         public void set(int index, StringLiteral literal) {
46                 this.elements.set(index, literal);
47         }
48
49         public boolean exists(int index) {
50                 return index >= 0 && index < this.elements.size();
51         }
52
53         public int size() {
54                 return this.elements.size();
55         }
56
57         public String toString() {
58                 StringBuffer result = new StringBuffer();
59                 for (Iterator iter = iterator(); iter.hasNext();) {
60                         result.append("\t"); //$NON-NLS-1$
61                         result.append(iter.next().toString());
62                         result.append("\n"); //$NON-NLS-1$
63                 }
64                 return result.toString();
65         }
66 }