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;
 
  19 public class NLSLine {
 
  21         private List elements;
 
  24                 this.elements = new ArrayList();
 
  28          * Adds a NLS element to this line.
 
  30         public void add(StringLiteral element) {
 
  31                 this.elements.add(element);
 
  35          * returns an Iterator over NLSElements
 
  37         public Iterator iterator() {
 
  38                 return this.elements.iterator();
 
  41         public StringLiteral get(int index) {
 
  42                 return (StringLiteral) this.elements.get(index);
 
  45         public void set(int index, StringLiteral literal) {
 
  46                 this.elements.set(index, literal);
 
  49         public boolean exists(int index) {
 
  50                 return index >= 0 && index < this.elements.size();
 
  54                 return this.elements.size();
 
  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$
 
  64                 return result.toString();