removed Makefile; lifted repo/org.ibex.tool/src/ to src/
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / parser / NLSLine.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 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 org.eclipse.jdt.internal.compiler.parser;
12
13 import java.util.ArrayList;
14 import java.util.Iterator;
15 import java.util.List;
16 import org.eclipse.jdt.internal.compiler.ast.StringLiteral;
17
18 public class NLSLine {
19
20         private List elements;
21
22         public NLSLine() {
23                 this.elements = new ArrayList();
24         }
25         
26         /**
27          * Adds a NLS element to this line.
28          */
29         public void add(StringLiteral element) {
30                 this.elements.add(element);
31         }
32         
33         /**
34          * returns an Iterator over NLSElements
35          */
36         public Iterator iterator() {
37                 return this.elements.iterator();
38         }
39         
40         public StringLiteral get(int index) {
41                 return (StringLiteral) this.elements.get(index);
42         }
43         
44         public void set(int index, StringLiteral literal) {
45                 this.elements.set(index, literal);
46         }
47         
48         public boolean exists(int index) {
49                 return index >= 0 && index < this.elements.size();
50         }
51         
52         public int size(){
53                 return this.elements.size();
54         }
55         
56         public String toString() {
57                 StringBuffer result= new StringBuffer();
58                 for (Iterator iter= iterator(); iter.hasNext(); ) {
59                         result.append("\t"); //$NON-NLS-1$
60                         result.append(iter.next().toString());
61                         result.append("\n"); //$NON-NLS-1$
62                 }
63                 return result.toString();
64         }
65 }