
/**
 * ExperimentData.java
 * This is stores all the SpectraData objects from an experiment.
 * Created: Dec 27, 2003
 *
 * @author Nathan Stevens
 * @version 0.1 3/13/2004 
 */
import java.util.*;
import java.io.*;

public class ExperimentData implements SpectraDataListFormat_1, Serializable {
  private String type;
  private Vector dataObjects;
  private Vector attachmentURL;
  private Vector keywords;
  private String[] metaInfo;
  private String notes;
  private String password;
  private boolean shared;
  private final int VERSION = 1;
  
  // default constructor
  public ExperimentData() { }
  
  public ExperimentData(String type, String[] metaInfo) {
    this.type = type;
    this.metaInfo = metaInfo;
    
    dataObjects = new Vector();
    attachmentURL = new Vector();
    keywords = new Vector();
    password = "none";
    notes = "none";
    shared = false;
  }
  
  // Method get the meta information array
  public String[] getMetaInfo() {
    return metaInfo;
  }
  
  // Method to set the meta information array
  public void setMetaInfo(String[] info) {
    metaInfo = info;
  }
  
  // Method to get the name of the experiment
  public String  getType() {
    return type;
  }
  
  // Method to add a data object
  public void addData(SpectraData sdata) {
	  dataObjects.addElement(sdata);
  }
  
  // Method to get the dataObjects
  public Vector getData() {
	  return dataObjects;
  }
  
  // Method to return the OOData at a specific index
  public SpectraData getData(int index) {
	  return (SpectraData)dataObjects.elementAt(index);
  }
  
  // Method to return the number of data objects in the experiment file
  public int getDataCount() {
	  return dataObjects.size();
  }
  
  // Method to remove a spectra data
  public void remove(int index) {
    dataObjects.removeElementAt(index);
  }
  
  // Method to remove all spectra data
  public void removeAll() {
    dataObjects.removeAllElements();
  }
  
  // Method get the notes
  public String getNotes() {
    return notes;
  }
  
  // Method to set notes for the data contained within
  public void setNotes(String notes) {
    this.notes = notes;
  }
  
  // Method to get the attachment URL list
  public Vector getAttachmentURL() {
    return attachmentURL;
  }
  
  // Method to set the attachment URL list
  public void setAttachmentURL(Vector urls) {
    attachmentURL = urls;
  }
  
  // Method to get the list of keywords for seaching purposes
  public Vector getKeywords() {
    return keywords;
  }
  
  // Method to set the list of keyowrds
  public void setKeywords(Vector keywords) {
    this.keywords = keywords;
  }
  
  // Method to see if data should be shared
  public boolean isShared() {
    return shared;
  }
  
  // Method to set the shared variable
  public void setShared(boolean b) {
    shared = b;
  }
  
  // Method to get the password
  public String getPassword() {
    return password;
  }
  
  // Method to set the password
  public void setPassword(String pw) {
    password = pw;
  }
  
  // get the version of this file
  public int getVersion() {
    return VERSION;
  }
  
  // Method to get the string representation of the data
  public String toString() {
    String name = type + "Data List";
    return name;
  }
} // --end class ExperimentData
