Revision: 15273
          http://gate.svn.sourceforge.net/gate/?rev=15273&view=rev
Author:   valyt
Date:     2012-01-31 10:05:48 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
Accepting patch #3480077 (notContains predicate).

Modified Paths:
--------------
    gate/trunk/src/gate/jape/constraint/ConstraintFactory.java

Added Paths:
-----------
    gate/trunk/src/gate/jape/constraint/NotContainsPredicate.java

Modified: gate/trunk/src/gate/jape/constraint/ConstraintFactory.java
===================================================================
--- gate/trunk/src/gate/jape/constraint/ConstraintFactory.java  2012-01-31 
08:12:57 UTC (rev 15272)
+++ gate/trunk/src/gate/jape/constraint/ConstraintFactory.java  2012-01-31 
10:05:48 UTC (rev 15273)
@@ -53,6 +53,7 @@
     addOperator(ConstraintPredicate.REGEXP_MATCH, RegExpMatchPredicate.class);
     addOperator(ConstraintPredicate.NOT_REGEXP_MATCH, 
NotRegExpMatchPredicate.class);
     addOperator(ContainsPredicate.OPERATOR, ContainsPredicate.class);
+    addOperator(NotContainsPredicate.OPERATOR, NotContainsPredicate.class);
     addOperator(WithinPredicate.OPERATOR, WithinPredicate.class);
     addOperator(NotWithinPredicate.OPERATOR, NotWithinPredicate.class);
   }

Added: gate/trunk/src/gate/jape/constraint/NotContainsPredicate.java
===================================================================
--- gate/trunk/src/gate/jape/constraint/NotContainsPredicate.java               
                (rev 0)
+++ gate/trunk/src/gate/jape/constraint/NotContainsPredicate.java       
2012-01-31 10:05:48 UTC (rev 15273)
@@ -0,0 +1,49 @@
+/*
+ *  NotWithinPredicate.java
+ *
+ *  Copyright (c) 1995-2010, The University of Sheffield. See the file
+ *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
+ *
+ *  This file is part of GATE (see http://gate.ac.uk/), and is free
+ *  software, licenced under the GNU Library General Public License,
+ *  Version 2, June 1991 (in the distribution as file licence.html,
+ *  and also available at http://gate.ac.uk/gate/licence.html).
+ *
+ *  Julien Nioche, 26 Jan 2012
+ */
+package gate.jape.constraint;
+
+import gate.Annotation;
+import gate.AnnotationSet;
+import gate.jape.JapeException;
+
+import java.util.Collection;
+
+/**
+ * Returns false if there is an annotation of the type set in value that is
+ * entirely spanned by the given annotation
+ */
+public class NotContainsPredicate extends ContainsPredicate {
+
+  public static final String OPERATOR = "notContains";
+
+  public String getOperator() {
+    return OPERATOR;
+  }
+
+  /**
+   * Sets up environment for concrete class to do the specific matching check
+   */
+  public boolean doMatch(Object annotValue, AnnotationSet context)
+      throws JapeException {
+
+    Annotation annot = (Annotation)annotValue;
+    AnnotationSet containedSet = doMatch(annot, context);
+
+    Collection<Annotation> filteredSet = filterMatches(containedSet);
+
+    // this is where it differs from ContainsPredicate
+    return filteredSet.isEmpty();
+  }
+
+}
\ No newline at end of file


Property changes on: 
gate/trunk/src/gate/jape/constraint/NotContainsPredicate.java
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to