1 20 21 package org.apache.directory.ldapstudio.browser.core.model.ldif.parser; 22 23 24 public class LdifToken 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 COMMENT = 1; 36 37 public static final int SEP = 2; 38 39 public static final int VERSION_SPEC = 4; 40 41 public static final int NUMBER = 5; 42 43 public static final int OID = 6; 44 45 public static final int DN_SPEC = 11; 46 47 public static final int DN = 12; 48 49 public static final int ATTRIBUTE = 21; 50 51 public static final int VALUE_TYPE_SAFE = 22; 52 53 public static final int VALUE_TYPE_BASE64 = 23; 54 55 public static final int VALUE_TYPE_URL = 24; 56 57 public static final int VALUE = 27; 58 59 public static final int CHANGETYPE_SPEC = 30; 60 61 public static final int CHANGETYPE_ADD = 31; 62 63 public static final int CHANGETYPE_DELETE = 32; 64 65 public static final int CHANGETYPE_MODIFY = 33; 66 67 public static final int CHANGETYPE_MODDN = 34; 68 69 public static final int MODTYPE_ADD_SPEC = 41; 70 71 public static final int MODTYPE_DELETE_SPEC = 42; 72 73 public static final int MODTYPE_REPLACE_SPEC = 43; 74 75 public static final int MODTYPE_SEP = 45; 77 public static final int CONTROL_SPEC = 51; 79 public static final int CONTROL_LDAPOID = 52; 81 public static final int CONTROL_CRITICALITY_TRUE = 53; 83 public static final int CONTROL_CRITICALITY_FALSE = 54; 85 public static final int MODDN_NEWRDN_SPEC = 61; 86 87 public static final int MODDN_DELOLDRDN_SPEC = 63; 88 89 public static final int MODDN_NEWSUPERIOR_SPEC = 65; 90 91 private int offset; 92 93 private int type; 94 95 private String value; 96 97 98 public LdifToken( int type, String value, int offset ) 99 { 100 this.type = type; 101 this.value = value; 102 this.offset = offset; 103 } 104 105 106 111 public int getOffset() 112 { 113 return this.offset; 114 } 115 116 117 122 public int getLength() 123 { 124 return this.value.length(); 125 } 126 127 128 public int getType() 129 { 130 return this.type; 131 } 132 133 134 public String getValue() 135 { 136 return this.value; 137 } 138 139 140 public String toString() 141 { 142 return "(type=" + this.type + ") " + "(offset=" + this.offset + ") " + "(length=" + this.getLength() + ") '" 143 + this.value + "'"; 144 } 145 146 147 public int compareTo( Object o ) 148 { 149 if ( o instanceof LdifToken ) 150 { 151 LdifToken token = ( LdifToken ) o; 152 return this.offset - token.offset; 153 } 154 else 155 { 156 throw new ClassCastException ( "Not instanceof LdifToken: " + o.getClass().getName() ); 157 } 158 } 159 160 } 161 | Popular Tags |