package W3C.PICS;
import java.util.Vector;

/**
 * SingleLabel represents a single-label as defined in
 * PICS 1.1 Label Syntax and Communication Protocals
 *
 * @see W3C.PICS.Rating
 * @see W3C.PICS.SingleLabelDialog
 */
public class SingleLabel
{

  public SingleLabel()
  {
     ratinglist=new Vector();
  }

  public void addRating(Rating r)
  {
    ratinglist.addElement(r);
  }

  /**
   * @return A string description of the SingleLabel as defined in
   *         PICS 1.1 specification
   */
  public String toString()
  {
    String ratingstring="";
    if (Lby!=null)
        ratingstring+="by \"" + Lby + "\"\n";
    if (Lfor!=null)
        ratingstring+="for \"" + Lfor + "\"\n";
    if (Lgeneric)
        ratingstring+=" gen true ";

    ratingstring+="r (";

    for (int i=0;i<ratinglist.size();i++)
    {
     if (i!=0) ratingstring+=" ";
     ratingstring+=ratinglist.elementAt(i);
    }

    ratingstring+=")";
    return ratingstring;
  }

  public Vector getRatingList()
  {
    return ratinglist;
  }

  public String getBy()
  {
    return Lby;
  }

  public void setBy(String s)
  {
    Lby=s;
  }


  public String getFor()
  {
    return Lfor;
  }

  public void setFor(String s)
  {
    Lfor=s;
  }

  public void setGeneric(boolean b)
  {
    Lgeneric=b;
  }


  private Vector ratinglist;

  private String Lby=null;
  private String Lfor=null;
  private boolean Lgeneric=false;
  private String Lsignature=null;
  private String Luntil=null;
  private String Lexp=null;
  private String Dat=null;
  private String Ocomment=null;

}

