1 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 29 public void add(StringLiteral element) { 30 this.elements.add(element); 31 } 32 33 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"); result.append(iter.next().toString()); 61 result.append("\n"); } 63 return result.toString(); 64 } 65 } 66 | Popular Tags |