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;
16 import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
19 public class NLSLine {
21 private List elements;
25 this.elements = new ArrayList();
29 * Adds a NLS element to this line.
31 public void add(StringLiteral element) {
32 this.elements.add(element);
36 * returns an Iterator over NLSElements
38 public Iterator iterator() {
39 return this.elements.iterator();
42 public StringLiteral get(int index) {
43 return (StringLiteral) this.elements.get(index);
46 public void set(int index, StringLiteral literal) {
47 this.elements.set(index, literal);
50 public boolean exists(int index) {
51 return index >= 0 && index < this.elements.size();
55 return this.elements.size();
58 public String toString() {
59 StringBuffer result= new StringBuffer();
60 for (Iterator iter= iterator(); iter.hasNext(); ) {
61 result.append("\t"); //$NON-NLS-1$
62 result.append(iter.next().toString());
63 result.append("\n"); //$NON-NLS-1$
65 return result.toString();