| Restriction.java |
1 /*
2 * Restriction.java
3 *
4 * Copyright (c) 1998-2004, The University of Sheffield.
5 *
6 * This file is part of GATE (see http://gate.ac.uk/), and is free
7 * software, licenced under the GNU Library General Public License,
8 * Version 2, June 1991 (in the distribution as file licence.html,
9 * and also available at http://gate.ac.uk/gate/licence.html).
10 *
11 * Rosen Marinov, 10/Dec/2001
12 *
13 * $Id: Restriction.java,v 1.8 2004/07/21 17:10:09 akshay Exp $
14 */
15
16 package gate.util;
17
18 public class Restriction implements java.io.Serializable{
19
20 /* Type of operator for cmarision in query*/
21 public static final int OPERATOR_EQUATION = 100;
22 public static final int OPERATOR_LESS = 101;
23 public static final int OPERATOR_BIGGER = 102;
24 public static final int OPERATOR_EQUATION_OR_BIGGER = 103;
25 public static final int OPERATOR_EQUATION_OR_LESS = 104;
26 public static final int OPERATOR_LIKE = 105;
27
28 private Object value;
29 private String key;
30 private int operator_;
31
32 /** Constructor.
33 *
34 * @param key string value of a feature key in document.
35 * @param value value of a feature with this key
36 * @param operator_ type of operator for comparison in query
37 *
38 */
39 public Restriction(String key, Object value, int operator_){
40 this.key = key;
41 this.value = value;
42 this.operator_ = operator_;
43 }
44
45 /**
46 * @return Object value of feature
47 */
48 public Object getValue(){
49 return value;
50 }
51
52 /** @return String string value og feature */
53 public String getStringValue(){
54 return value.toString();
55 }
56
57 /** @return String string value of the feature key */
58 public String getKey(){
59 return key;
60 }
61
62 /** @return int type of operator */
63 public int getOperator(){
64 return operator_;
65 }
66 }