Esempio n. 1
0
  /**
   * Generates a new Descriptor Object sharing none of the references of the original but containing
   * identical data.
   *
   * @return new Descriptor initialized with this Descriptor's data
   */
  public Object clone() {
    DescAggregate temp;
    try {
      temp = new DescAggregate(getCategory());
    } catch (BadDataException bdx) {
      throw new IllegalStateException(bdx.getMessage());
    }
    temp.setName(getName());
    temp.attributes = new Attribute[attributes.length];
    for (int i = 0; i < attributes.length; i++)
      temp.attributes[i] = (Attribute) attributes[i].clone();

    temp.idList = (TreeSet) idList.clone();
    temp.span = (span == null) ? null : (FrameSpan) span.clone();
    return temp;
  }
Esempio n. 2
0
  /** @inheritDoc */
  public Descriptor crop(FrameSpan span) {
    span.intersectWith(this.span);

    DescAggregate copy;
    try {
      copy = new DescAggregate(getCategory());
    } catch (BadDataException bdx) {
      throw new IllegalStateException(bdx.getMessage());
    }
    copy.setName(getName());
    copy.attributes = new Attribute[attributes.length];
    for (int i = 0; i < attributes.length; i++) {
      copy.attributes[i] = attributes[i].crop(span, this.span);
    }

    copy.idList = (TreeSet) idList.clone();
    copy.span = span;
    return copy;
  }