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 the given annotation is entirely spanned by an annotation
24 * of the type set in value.
25 */
26 public class WithinPredicate extends EmbeddedConstraintPredicate {
27
28 public static final String OPERATOR = "within";
29
30 public String getOperator() {
31 return OPERATOR;
32 }
33
34 /**
35 * Get all the annots of the right type that completely span the
36 * length of the test annot
37 */
38 public AnnotationSet doMatch(Annotation annot, AnnotationSet as) {
39 return as.getCovering(annotType, annot.getStartNode().getOffset(), annot
40 .getEndNode().getOffset());
41 }
42 }
|