AnnotationSetEvent.java
01 /*
02  *  Copyright (c) 1995-2010, The University of Sheffield. See the file
03  *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
04  *
05  *  This file is part of GATE (see http://gate.ac.uk/), and is free
06  *  software, licenced under the GNU Library General Public License,
07  *  Version 2, June 1991 (in the distribution as file licence.html,
08  *  and also available at http://gate.ac.uk/gate/licence.html).
09  *
10  *  Valentin Tablan 12/12/2000
11  *
12  *  $Id: AnnotationSetEvent.java 12006 2009-12-01 17:24:28Z thomas_heitz $
13  */
14 
15 package gate.event;
16 
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 {@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 {@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 }