1 20 21 package org.apache.directory.ldapstudio.browser.core.model.filter.parser; 22 23 24 public class LdapFilterToken implements Comparable  25 { 26 27 public static final int NEW = Integer.MIN_VALUE; 28 29 public static final int ERROR = -2; 30 31 public static final int EOF = -1; 32 33 public static final int UNKNOWN = 0; 34 35 public static final int WHITESPACE = 1; 36 37 public static final int LPAR = 11; 38 39 public static final int RPAR = 12; 40 41 public static final int AND = 21; 42 43 public static final int OR = 22; 44 45 public static final int NOT = 23; 46 47 public static final int ATTRIBUTE = 31; 48 49 public static final int EQUAL = 41; 50 51 public static final int APROX = 42; 52 53 public static final int GREATER = 43; 54 55 public static final int LESS = 44; 56 57 public static final int PRESENT = 45; 58 59 public static final int VALUE = 51; 60 61 public static final int ASTERISK = 52; 62 63 private int offset; 64 65 private int type; 66 67 private String value; 68 69 70 public LdapFilterToken( int type, String value, int offset ) 71 { 72 this.type = type; 73 this.value = value; 74 this.offset = offset; 75 } 76 77 78 83 public int getOffset() 84 { 85 return this.offset; 86 } 87 88 89 94 public int getLength() 95 { 96 return this.value.length(); 97 } 98 99 100 public int getType() 101 { 102 return this.type; 103 } 104 105 106 public String getValue() 107 { 108 return this.value; 109 } 110 111 112 public String toString() 113 { 114 return "(" + this.offset + ") " + "(" + this.type + ") " + this.value; 115 } 116 117 118 public int compareTo( Object o ) 119 { 120 if ( o instanceof LdapFilterToken ) 121 { 122 LdapFilterToken token = ( LdapFilterToken ) o; 123 return this.offset - token.offset; 124 } 125 else 126 { 127 throw new ClassCastException ( "Not instanceof LapFilterToken: " + o.getClass().getName() ); 128 } 129 } 130 131 } 132 | Popular Tags |