1 20 21 25 26 package org.ozoneDB.xml.dom; 27 28 import org.w3c.dom.*; 29 30 31 47 public class ParamEntity extends NodeImpl implements ParamEntityProxy { 48 49 final static long serialVersionUID = 1; 50 51 52 public short getNodeType() { 53 return PARAM_ENTITY_NODE; 54 } 55 56 57 public String getPublicId() { 58 return _publicId; 59 } 60 61 62 public void setPublicId( String publicId ) { 63 _publicId = publicId; 64 } 65 66 67 public String getSystemId() { 68 return _systemId; 69 } 70 71 72 public void setSystemId( String systemId ) { 73 _systemId = systemId; 74 } 75 76 77 85 public boolean isInternal() { 86 return _internalValue != null; 87 } 88 89 90 95 public short getState() { 96 return _state; 97 } 98 99 100 107 public void setState( short newState ) { 108 if (_state == STATE_DECLARED && newState == STATE_PARSING || _state == STATE_NOT_FOUND && newState 109 == STATE_DECLARED) { 110 _state = newState; 111 } else if ((_state == STATE_DECLARED || _state == STATE_PARSING) && (newState == STATE_PARSED || newState 112 == STATE_NOT_FOUND)) { 113 _state = newState; 114 } else { 115 throw new IllegalStateException ( "Cannot switch from state " + _state + " to state " + newState + "." ); 116 } 117 } 118 119 120 public final String getInternal() { 121 return _internalValue; 122 } 123 124 125 public final void setInternal( String internalValue ) { 126 _internalValue = internalValue; 127 } 128 129 130 public synchronized boolean equals( Object other ) { 131 ParamEntityProxy otherX; 132 133 if (super.equals( other )) { 136 otherX = (ParamEntityProxy)other; 137 if (this.isInternal()) { 140 return otherX.isInternal() && this.getInternal().equals( otherX.getInternal() ); 141 } 142 return 145 (this.getPublicId() == null && otherX.getPublicId() == null || this.getPublicId() != null 146 && this.getPublicId().equals( otherX.getPublicId() )) && (this.getSystemId() == null 147 && otherX.getSystemId() == null || this.getSystemId() != null && this.getSystemId().equals( 148 otherX.getSystemId() )); 149 } 150 return false; 151 } 152 153 154 public final Object clone() { 155 ParamEntityProxy clone = null; 156 try { 157 clone = (ParamEntityProxy)database().createObject( ParamEntity.class.getName() ); 158 clone.init( _ownerDocument, getNodeName(), null, true ); 159 cloneInto( clone, true ); 160 } catch (Exception except) { 161 } 162 return clone; 163 } 164 165 166 public final Node cloneNode( boolean deep ) { 167 ParamEntityProxy clone = null; 168 try { 169 clone = (ParamEntityProxy)database().createObject( ParamEntity.class.getName() ); 170 (clone).init( _ownerDocument, getNodeName(), null, true ); 171 cloneInto( clone, deep ); 172 } catch (Exception except) { 173 } 174 return clone; 175 } 176 177 178 public String toString() { 179 String name; 180 String value; 181 182 name = getNodeName(); 183 if (name.length() > 32) { 184 name = name.substring( 0, 32 ) + ".."; 185 } 186 if (isInternal()) { 187 value = getInternal(); 188 if (value.length() > 64) { 189 value = value.substring( 0, 64 ) + ".."; 190 } 191 name = name + "] [" + value; 192 } else { 193 if (getSystemId() != null) { 194 name = name + "] SYSTEM [" + getSystemId(); 195 } 196 if (getPublicId() != null) { 197 name = name + "] PUBLIC [" + getPublicId(); 198 } 199 } 200 return "PEntity decl: [" + name + "]"; 201 } 202 203 204 public synchronized void cloneInto( NodeProxy into, boolean deep ) { 205 super.cloneInto( into, deep ); 206 ((ParamEntityProxy)into).setSystemId( this.getSystemId() ); 207 ((ParamEntityProxy)into).setPublicId( this.getPublicId() ); 208 ((ParamEntityProxy)into).setInternal( this.getInternal() ); 209 ((ParamEntityProxy)into).setState( this.getState() ); 210 } 211 212 213 222 public ParamEntity( DocumentImpl owner, String name, String systemId, String publicId ) { 223 super( owner, name, null, true ); 224 if (systemId == null) { 225 throw new NullPointerException ( "Argument 'systemId' cannot be null." ); 226 } 227 _systemId = systemId; 228 _publicId = publicId; 229 _state = STATE_DECLARED; 230 } 231 232 233 240 public ParamEntity( DocumentImpl owner, String name, String internalValue ) { 241 super( owner, name, null, true ); 242 init( owner, name, internalValue ); 243 } 244 245 246 private ParamEntity( DocumentImpl owner, String name ) { 247 super( owner, name, null, true ); 248 } 249 250 251 public ParamEntity() { 252 super(); 253 } 254 255 256 public void init( DocumentProxy owner, String name ) { 257 super.init( owner, name, null, true ); 258 } 259 260 261 public void init( DocumentProxy owner, String name, String value ) { 262 super.init( owner, name, null, true ); 263 if (value == null) { 264 throw new NullPointerException ( "Argument 'internalValue' cannot be null." ); 265 } 266 _systemId = null; 267 _publicId = null; 268 _state = STATE_DECLARED; 269 _internalValue = value; 270 } 271 272 273 public void init( DocumentProxy owner, String name, String systemId, String publicId ) { 274 } 275 276 279 private String _systemId; 280 281 282 285 private String _publicId; 286 287 288 292 private short _state; 293 294 295 298 private String _internalValue; 299 300 301 306 public final static short STATE_DECLARED = 0; 307 308 309 313 public final static short STATE_PARSING = 1; 314 315 316 320 public final static short STATE_PARSED = 2; 321 322 323 326 public final static short STATE_NOT_FOUND = 3; 327 328 } 329 | Popular Tags |