package uk.co.patrickhaston.mars;

// This class holds a record of who said what during a conversation.
// It is not kept beyond the end of the conversation.

public class MarsStatements extends MarsArray 
{
  public MarsStatements()
  {
    this.CollectionName = "[Statements]";
  }

  // This should be unnecessary, but you never know...
  public void readData(String line)
  {
    int idx = readIndex(line);
    if (idx>0)
    {
      MarsStatement s = new MarsStatement(line);

      this.setElementAt(s, idx);
    }
  }

  // This function add a statement to the conversation.
  public void addStatement(String speaker, String theText)
  {
    MarsStatement s = new MarsStatement(size());
    s.speaker = speaker;
    s.theText = theText;
    this.addElement(s);
  }
}
