package osa.attribute.atgrammar.grammar;

import java.util.*;

import osa.attribute.atgrammar.grammar.symbols.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2005</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class SymbolsString
  implements Cloneable
  {
  ArrayList string=new ArrayList();

  protected int length=0;

  public SymbolsString()
    {
    }

  public void appendSymbol(Symbol symbol)
    {
    string.add(symbol);
    length++;
    }

  public void insertSymbolAt(int index, Symbol symbol)
    {
    string.add(index, symbol);
    length++;
    }

  public void deleteSymbolAt(int index)
    {
    string.remove(index);
    length--;
    }

  public Symbol getSymbolAt(int index)
    {
    Symbol return_value=null;
    if(index>=this.length)
      {
      return null;
      }
    return_value=(Symbol)string.get(index);
    return return_value;
    }

  public int getLength()
    {
    return string.size();
    }

  public String toString()
    {
    String result=new String();

    for(int i=0;i<this.length;i++)
       {
       result+=this.getSymbolAt(i).toString();
       }
    return result;
    }

  public Object clone()
    {
    SymbolsString cloned=new SymbolsString();
    cloned.length=length;
    for(int i=0;i<length;i++)
       {
       cloned.string.add(((Symbol)string.get(i)).clone());
       }
    return cloned;
    }

  public void deleteSymbol(Symbol symbol)
    {
    Symbol temp_symbol;
    for(int i=0;i<length;i++)
       {
       temp_symbol=string.get(i);
       if(temp_symbol.get == symbo)
       }
    }

  }