1   /*
2    *  Copyright (c) 1998-2001, The University of Sheffield.
3    *
4    *  This file is part of GATE (see http://gate.ac.uk/), and is free
5    *  software, licenced under the GNU Library General Public License,
6    *  Version 2, June 1991 (in the distribution as file licence.html,
7    *  and also available at http://gate.ac.uk/gate/licence.html).
8    *
9    *  Valentin Tablan 12/12/2000
10   *
11   *  $Id: AnnotationSetEvent.java,v 1.3 2001/09/21 12:21:54 valyt Exp $
12   */
13  
14  package gate.event;
15  
16  import java.util.EventObject;
17  import gate.*;
18  
19  /**
20   * This class models events fired by an {@link gate.AnnotationSet}.
21   */
22  public class AnnotationSetEvent extends GateEvent{
23  
24    /**Event type used for situations when a new annotation has been added*/
25    public static final int ANNOTATION_ADDED = 201;
26  
27    /**Event type used for situations when an annotation has been removed*/
28    public static final int ANNOTATION_REMOVED = 202;
29  
30  
31    /**
32     * Constructor.
33     * @param source the {@link gate.AnnotationSet} that fired the event
34     * @param type the type of the event
35     * @param sourceDocument the {@link gate.Document} for wich the annotation
36     * was added or removed.
37     * @param annotation the annotation added or removed.
38     */
39    public AnnotationSetEvent(AnnotationSet source,
40                              int type,
41                              Document sourceDocument,
42                              Annotation annotation) {
43      super(source, type);
44      this.sourceDocument = sourceDocument;
45      this.annotation = annotation;
46    }
47  
48    /**
49     * Gets the document that has had an annotation added or removed.
50     * @return a {@link gate.Document}
51     */
52    public gate.Document getSourceDocument() {
53      return sourceDocument;
54    }
55  
56    /**
57     * Gets the annotation that has been added or removed
58     * @return a {@link gate.Annotation}
59     */
60    public gate.Annotation getAnnotation() {
61      return annotation;
62    }
63  
64    private gate.Document sourceDocument;
65    private gate.Annotation annotation;
66  }