01 /*
02 * Restriction.java
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 * Rosen Marinov, 10/Dec/2001
13 *
14 * $Id: Restriction.java 12006 2009-12-01 17:24:28Z thomas_heitz $
15 */
16
17 package gate.util;
18
19 public class Restriction implements java.io.Serializable{
20
21 /* Type of operator for cmarision in query*/
22 public static final int OPERATOR_EQUATION = 100;
23 public static final int OPERATOR_LESS = 101;
24 public static final int OPERATOR_BIGGER = 102;
25 public static final int OPERATOR_EQUATION_OR_BIGGER = 103;
26 public static final int OPERATOR_EQUATION_OR_LESS = 104;
27 public static final int OPERATOR_LIKE = 105;
28
29 private Object value;
30 private String key;
31 private int operator_;
32
33 /** Constructor.
34 *
35 * @param key string value of a feature key in document.
36 * @param value value of a feature with this key
37 * @param operator_ type of operator for comparison in query
38 *
39 */
40 public Restriction(String key, Object value, int operator_){
41 this.key = key;
42 this.value = value;
43 this.operator_ = operator_;
44 }
45
46 /**
47 * @return Object value of feature
48 */
49 public Object getValue(){
50 return value;
51 }
52
53 /** @return String string value og feature */
54 public String getStringValue(){
55 return value.toString();
56 }
57
58 /** @return String string value of the feature key */
59 public String getKey(){
60 return key;
61 }
62
63 /** @return int type of operator */
64 public int getOperator(){
65 return operator_;
66 }
67 }
|