diff options
author | nitind | 2007-12-03 18:45:59 +0000 |
---|---|---|
committer | nitind | 2007-12-03 18:45:59 +0000 |
commit | 2fdba8db3247f8d5a3c5bc951c991d16d6b35c55 (patch) | |
tree | c01ef37f56463db11d5684f4db6f3cc584ab702e /bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/CharacterDataImpl.java | |
parent | 81ba8ba7628bb67b322311a2238afa3f53170444 (diff) | |
download | webtools.sourceediting-200712031745.tar.gz webtools.sourceediting-200712031745.tar.xz webtools.sourceediting-200712031745.zip |
This commit was manufactured by cvs2svn to create tag 'v200712031745'.v200712031745
Diffstat (limited to 'bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/CharacterDataImpl.java')
-rw-r--r-- | bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/CharacterDataImpl.java | 352 |
1 files changed, 0 insertions, 352 deletions
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/CharacterDataImpl.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/CharacterDataImpl.java deleted file mode 100644 index 6bf9c65467..0000000000 --- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/CharacterDataImpl.java +++ /dev/null @@ -1,352 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.xml.core.internal.document; - - - -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.w3c.dom.CharacterData; -import org.w3c.dom.DOMException; -import org.w3c.dom.Node; - - -/** - * CharacterDataImpl class - */ -public abstract class CharacterDataImpl extends NodeImpl implements CharacterData { - - private String data = null; - - /** - * CharacterDataImpl constructor - */ - protected CharacterDataImpl() { - super(); - } - - /** - * CharacterDataImpl constructor - * - * @param that - * CharacterDataImpl - */ - protected CharacterDataImpl(CharacterDataImpl that) { - super(that); - - if (that != null) { - this.data = that.getData(); - } - } - - /** - * appendData method - * - * @param arg - * java.lang.String - */ - public void appendData(String arg) throws DOMException { - if (arg == null) - return; - - String data = getData(); - if (data == null) - data = arg; - else - data += arg; - setData(data); - } - - /** - * deleteData method - * - * @param offset - * int - * @param count - * int - */ - public void deleteData(int offset, int count) throws DOMException { - if (count == 0) - return; - if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); - } - - if (count < 0 || offset < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - - String data = getData(); - if (data == null) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - int length = data.length(); - if (offset > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - if (offset == 0) { - if (count > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - if (count == length) - data = new String(); - else - data = data.substring(count); - } else { - int end = offset + count; - if (end > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - if (end == length) - data = data.substring(0, offset); - else - data = data.substring(0, offset) + data.substring(end); - } - setData(data); - } - - /** - */ - protected final String getCharacterData() { - return this.data; - } - - /** - * getData method - * - * @return java.lang.String - */ - public String getData() throws DOMException { - return getCharacterData(); - } - - /** - * getLength method - * - * @return int - */ - public int getLength() { - String data = getData(); - if (data == null) - return 0; - return data.length(); - } - - /** - * getNodeValue method - * - * @return java.lang.String - */ - public String getNodeValue() { - return getData(); - } - - /** - * insertData method - * - * @param offset - * int - * @param arg - * java.lang.String - */ - public void insertData(int offset, String arg) throws DOMException { - if (arg == null) - return; - - if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); - } - - if (offset < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - - String data = getData(); - if (data == null) { - if (offset > 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - data = arg; - } else if (offset == 0) { - data = arg + data; - } else { - int length = data.length(); - if (offset > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - if (offset == length) - data += arg; - else - data = data.substring(0, offset) + arg + data.substring(offset); - } - setData(data); - } - - /** - * isJSPContent method - * - * @return boolean - */ - public boolean isJSPContent() { - Node parent = getParentNode(); - if (parent == null || parent.getNodeType() != Node.ELEMENT_NODE) - return false; - ElementImpl element = (ElementImpl) parent; - return element.isJSPContainer(); - } - - /** - * replaceData method - * - * @param offset - * int - * @param count - * int - * @param arg - * java.lang.String - */ - public void replaceData(int offset, int count, String arg) throws DOMException { - if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); - } - - if (arg == null) { - deleteData(offset, count); - return; - } - if (count == 0) { - insertData(offset, arg); - return; - } - if (offset < 0 || count < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - - String data = getData(); - if (data == null) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } else if (offset == 0) { - int length = data.length(); - if (count > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - if (count == length) - data = arg; - else - data = arg + data.substring(count); - } else { - int length = data.length(); - int end = offset + count; - if (end > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - if (end == length) - data = data.substring(0, offset) + arg; - else - data = data.substring(0, offset) + arg + data.substring(end); - } - setData(data); - } - - /** - */ - void resetStructuredDocumentRegions() { - this.data = getData(); - setStructuredDocumentRegion(null); - } - - /** - * setData method - * - * @param data - * java.lang.String - */ - public void setData(String data) throws DOMException { - if (!isDataEditable()) { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); - } - - this.data = data; - - notifyValueChanged(); - } - - /** - * setNodeValue method - * - * @param nodeValue - * java.lang.String - */ - public void setNodeValue(String nodeValue) throws DOMException { - setData(nodeValue); - } - - /** - */ - void setStructuredDocumentRegion(IStructuredDocumentRegion flatNode) { - super.setStructuredDocumentRegion(flatNode); - if (flatNode != null) - this.data = null; - } - - /** - * substringData method - * - * @return java.lang.String - * @param offset - * int - * @param count - * int - */ - public String substringData(int offset, int count) throws DOMException { - if (count == 0) - return new String(); - if (offset < 0 || count < 0) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - - String data = getData(); - if (data == null) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - int length = data.length(); - if (offset == 0 && count == length) - return data; - if (offset > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - int end = offset + count; - if (end > length) { - throw new DOMException(DOMException.INDEX_SIZE_ERR, new String()); - } - return data.substring(offset, end); - } - - /** - * toString method - * - * @return java.lang.String - */ - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append(getNodeName()); - buffer.append('('); - buffer.append(getData()); - buffer.append(')'); - IStructuredDocumentRegion flatNode = getStructuredDocumentRegion(); - if (flatNode != null) { - buffer.append('@'); - buffer.append(flatNode.toString()); - } - return buffer.toString(); - } -} |