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
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.parser;
13 import java.util.ArrayList;
14 import java.util.Iterator;
15 import java.util.List;
17 import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
20 public class NLSLine {
22 private List elements;
26 this.elements = new ArrayList();
30 * Adds a NLS element to this line.
32 public void add(StringLiteral element) {
33 this.elements.add(element);
37 * returns an Iterator over NLSElements
39 public Iterator iterator() {
40 return this.elements.iterator();
43 public StringLiteral get(int index) {
44 return (StringLiteral) this.elements.get(index);
47 public void set(int index, StringLiteral literal) {
48 this.elements.set(index, literal);
51 public boolean exists(int index) {
52 return index >= 0 && index < this.elements.size();
56 return this.elements.size();
59 public String toString() {
60 StringBuffer result= new StringBuffer();
61 for (Iterator iter= iterator(); iter.hasNext(); ) {
62 result.append("\t"); //$NON-NLS-1$
63 result.append(iter.next().toString());
64 result.append("\n"); //$NON-NLS-1$
66 return result.toString();