1   /*
2    *  Copyright (c) 1998-2005, 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.6 2005/01/11 13:51:34 ian Exp $
12   */
13  
14  package gate.event;
15  
16  import gate.*;
17  
18  /**
19   * This class models events fired by an {@link gate.AnnotationSet}.
20   */
21  public class AnnotationSetEvent extends GateEvent{
22  
23    /**Event type used for situations when a new annotation has been added*/
24    public static final int ANNOTATION_ADDED = 201;
25  
26    /**Event type used for situations when an annotation has been removed*/
27    public static final int ANNOTATION_REMOVED = 202;
28  
29  
30    /**
31     * Constructor.
32     * @param source the {@link gate.AnnotationSet} that fired the event
33     * @param type the type of the event
34     * @param sourceDocument the {@link gate.Document} for wich the annotation
35     * was added or removed.
36     * @param annotation the annotation added or removed.
37     */
38    public AnnotationSetEvent(AnnotationSet source,
39                              int type,
40                              Document sourceDocument,
41                              Annotation annotation) {
42      super(source, type);
43      this.sourceDocument = sourceDocument;
44      this.annotation = annotation;
45    }
46  
47    /**
48     * Gets the document that has had an annotation added or removed.
49     * @return a {@link gate.Document}
50     */
51    public gate.Document getSourceDocument() {
52      return sourceDocument;
53    }
54  
55    /**
56     * Gets the annotation that has been added or removed
57     * @return a {@link gate.Annotation}
58     */
59    public gate.Annotation getAnnotation() {
60      return annotation;
61    }
62  
63    private gate.Document sourceDocument;
64    private gate.Annotation annotation;
65  }