01 /*
02 * Constraint Predicate implementation
03 *
04 * Copyright (c) 1995-2010, The University of Sheffield. See the file
05 * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
06 *
07 * This file is part of GATE (see http://gate.ac.uk/), and is free
08 * software, licenced under the GNU Library General Public License,
09 * Version 2, June 1991 (in the distribution as file licence.html,
10 * and also available at http://gate.ac.uk/gate/licence.html).
11 *
12 * Eric Sword, 09/03/08
13 *
14 * $Id$
15 */
16 package gate.jape.constraint;
17
18 import gate.Annotation;
19 import gate.AnnotationSet;
20
21
22 /**
23 * Returns true if there is an annotation of the type set in value that is entirely
24 * spanned by the given annotation
25 */
26 public class ContainsPredicate extends EmbeddedConstraintPredicate {
27
28 public static final String OPERATOR = "contains";
29
30 public String getOperator() {
31 return OPERATOR;
32 }
33
34 /**
35 * Get all the annots of the right type that are within the span of
36 * this annot.
37 */
38 public AnnotationSet doMatch(Annotation annot, AnnotationSet as) {
39 return as.getContained(annot.getStartNode().getOffset(),
40 annot.getEndNode().getOffset()).get(annotType);
41 }
42
43 }
|