Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 83042 Details for
Bug 209435
[GWT] Make EMF-Ecore compile with GWT-Compiler
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Updated to use the newest GWT-1.5 features
patch.txt (text/plain), 1.03 MB, created by
Thomas Schindl
on 2007-11-16 02:21:45 EST
(
hide
)
Description:
Updated to use the newest GWT-1.5 features
Filename:
MIME Type:
Creator:
Thomas Schindl
Created:
2007-11-16 02:21:45 EST
Size:
1.03 MB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.emf.ecore >Index: src/org/eclipse/emf/ecore/resource/impl/URIConverterImpl.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/resource/impl/URIConverterImpl.java >diff -N src/org/eclipse/emf/ecore/resource/impl/URIConverterImpl.java >--- src/org/eclipse/emf/ecore/resource/impl/URIConverterImpl.java 5 May 2006 16:58:57 -0000 1.8 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,664 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: URIConverterImpl.java,v 1.8 2006/05/05 16:58:57 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.resource.impl; >- >- >-import java.io.ByteArrayInputStream; >-import java.io.ByteArrayOutputStream; >-import java.io.File; >-import java.io.FileInputStream; >-import java.io.FileOutputStream; >-import java.io.IOException; >-import java.io.InputStream; >-import java.io.OutputStream; >-import java.net.URL; >-import java.net.URLConnection; >-import java.util.Map; >- >-import org.eclipse.core.resources.IContainer; >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.resources.IFolder; >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.IWorkspaceRoot; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.Path; >-import org.eclipse.emf.common.archive.ArchiveURLConnection; >-import org.eclipse.emf.common.util.URI; >-import org.eclipse.emf.ecore.plugin.EcorePlugin; >-import org.eclipse.emf.ecore.resource.Resource; >-import org.eclipse.emf.ecore.resource.URIConverter; >- >- >-/** >- * A highly functional and extensible URI converter implementation. >- * <p> >- * This implementation provides seamless transparent Eclipse integration >- * by supporting the <code>platform:/resource</code> mechanism both inside of Eclipse and outside of Eclipse. >- * Furthermore, although the implementation imports >- * both {@link org.eclipse.core.runtime} and {@link org.eclipse.core.resources}, >- * and hence requires the Eclipse libraries at development time, >- * the implementation does <b>not</b> require them at runtime. >- * Clients of this implementation must be cautious if they wish to maintain this platform neutral behaviour. >- * </p> >- */ >-public class URIConverterImpl implements URIConverter >-{ >- // ECLIPSE-DEPEND-BEGIN >- /** >- * An output stream that transfers its contents to an {@link IFile} upon closing. >- */ >- public static class PlatformResourceOutputStream extends ByteArrayOutputStream >- { >- protected IFile file; >- protected boolean force; >- protected boolean keepHistory; >- protected IProgressMonitor progressMonitor; >- protected boolean previouslyFlushed; >- >- public PlatformResourceOutputStream(IFile file, boolean force, boolean keepHistory, IProgressMonitor progressMonitor) >- { >- this.file = file; >- this.force = force; >- this.keepHistory = keepHistory; >- this.progressMonitor = progressMonitor; >- } >- >- protected void createContainer(IContainer container) throws IOException >- { >- if (!container.exists()) >- { >- if (container.getType() == IResource.FOLDER) >- { >- createContainer(container.getParent()); >- try >- { >- ((IFolder)container).create(force, keepHistory, progressMonitor); >- } >- catch (CoreException exception) >- { >- throw new ResourceImpl.IOWrappedException(exception); >- } >- } >- } >- } >- >- public void close() throws IOException >- { >- flush(); >- super.close(); >- } >- >- public void flush() throws IOException >- { >- super.flush(); >- >- if (previouslyFlushed) >- { >- if (count == 0) >- { >- return; >- } >- } >- else >- { >- createContainer(file.getParent()); >- } >- >- byte[] contents = toByteArray(); >- InputStream inputStream = new ByteArrayInputStream(contents, 0, contents.length); >- >- try >- { >- if (previouslyFlushed) >- { >- file.appendContents(inputStream, force, false, progressMonitor); >- } >- else if (!file.exists()) >- { >- file.create(inputStream, false, null); >- previouslyFlushed = true; >- } >- else >- { >- if (!file.isSynchronized(IResource.DEPTH_ONE)) >- { >- file.refreshLocal(IResource.DEPTH_ONE, progressMonitor); >- } >- file.setContents(inputStream, force, keepHistory, progressMonitor); >- previouslyFlushed = true; >- } >- reset(); >- } >- catch (CoreException exception) >- { >- throw new Resource.IOWrappedException(exception); >- } >- } >- } >- >- /** >- * Isolated Eclipse workbench utilities. >- */ >- public static class WorkbenchHelper >- { >- /** >- * Creates an output stream for the given {@link IFile} path. >- * <p> >- * This implementation uses a {@link URIConverterImpl.PlatformResourceOutputStream}. >- * </p> >- * @return an open output stream. >- * @exception IOException if there is a problem obtaining an open output stream. >- * @see IWorkspaceRoot#getFile(org.eclipse.core.runtime.IPath) >- * @see URIConverterImpl.PlatformResourceOutputStream >- * @see IFile#setContents(InputStream, boolean, boolean, IProgressMonitor) >- */ >- public static OutputStream createPlatformResourceOutputStream(String platformResourcePath) throws IOException >- { >- IFile file = workspaceRoot.getFile(new Path(platformResourcePath)); >- return new PlatformResourceOutputStream(file, false, true, null); >- } >- >- /** >- * Creates an input stream for the given {@link IFile} path. >- * <p> >- * This implementation uses {@link IFile#getContents IFile.getContents}. >- * </p> >- * @return an open input stream. >- * @see IWorkspaceRoot#getFile(org.eclipse.core.runtime.IPath) >- * @see IFile#getContents >- * @exception IOException if there is a problem obtaining an open input stream. >- */ >- public static InputStream createPlatformResourceInputStream(String platformResourcePath) throws IOException >- { >- IFile file = workspaceRoot.getFile(new Path(platformResourcePath)); >- try >- { >- if (!file.isSynchronized(IResource.DEPTH_ONE)) >- { >- file.refreshLocal(IResource.DEPTH_ONE, null); >- } >- return file.getContents(); >- } >- catch (CoreException exception) >- { >- throw new Resource.IOWrappedException(exception); >- } >- } >- } >- >- /** >- * The cached Eclipse workspace. >- */ >- protected static IWorkspaceRoot workspaceRoot = EcorePlugin.getWorkspaceRoot(); >- >- // ECLIPSE-DEPEND-END >- >- /** >- * A map that remaps URIs. >- */ >- public interface URIMap extends Map >- { >- /** >- * Returns the remapped URI, or the URI itself. >- * @param uri the URI to remap. >- * @return the remapped URI, or the URI itself. >- */ >- URI getURI(URI uri); >- } >- >- /** >- * The URI map. >- */ >- protected URIMap uriMap; >- >- /** >- * Creates an instance. >- */ >- public URIConverterImpl() >- { >- // This is a hacky way to test stand-alone platform:/resource support in what's really an headless environment. >- // >- // org.eclipse.core.resources.IProject [] projects = workspaceRoot.getProjects(); >- // for (int i = 0; i < projects.length; ++i) >- // { >- // String rootContainerName = projects[i].getName(); >- // URI rootContainerLocation = URI.createFileURI(projects[i].getLocation().toString() + "/"); >- // platformResourceMap.put(rootContainerName, rootContainerLocation); >- // } >- // >- // workspaceRoot = null; >- } >- >- /** >- * Returns whether the scheme is one that this implementation should treat as an archive. >- * This implementation returns <code>true</code> which the schem is <code>"archive"</code>. >- * @param scheme the scheme to consider. >- * @return whether the scheme is one that this implementation treats as an archive. >- */ >- protected boolean isArchiveScheme(String scheme) >- { >- return "archive".equals(scheme); >- } >- >- /** >- * Creates an output stream for the URI and returns it. >- * <p> >- * This implementation {@link #normalize normalizes} the URI and uses that as the basis for further processing. >- * It factors out the URI schemes <code>file</code> and <code>platform</code> (with leading <code>resource</code> segment) >- * for special processing by >- * {@link #createFileOutputStream createFileOutputStream} and >- * {@link #createPlatformResourceOutputStream createPlatformResourceOutputStream}, respectively. >- * The file-based URI is {@link URI#toFileString converted} to a file path, e.g., >- *<pre> >- * file:///C:/directory/file >- * -> >- * C:/directory/file >- *</pre> >- * and the platform-based URI is converted to a platform path by trimming the leading <code>platform:/resource</code>, e.g., >- *<pre> >- * platform:/resource/project/directory/file >- * -> >- * /project/directory/file >- *</pre> >- * All other cases are handled as standard URLs by {@link #createURLOutputStream createURLOutputStream}. >- * </p> >- * @return an open output stream. >- * @exception IOException if there is a problem obtaining an open output stream. >- */ >- public OutputStream createOutputStream(URI uri) throws IOException >- { >- URI converted = normalize(uri); >- if (converted.isFile()) >- { >- String filePath = converted.toFileString(); >- return createFileOutputStream(filePath); >- } >- else >- { >- String scheme = converted.scheme(); >- if (isArchiveScheme(scheme)) >- { >- return createArchiveOutputStream(converted); >- } >- else if ("platform".equals(scheme) && converted.segmentCount() > 1 && "resource".equals(converted.segment(0))) >- { >- StringBuffer platformResourcePath = new StringBuffer(); >- for (int i = 1, size = converted.segmentCount(); i < size; ++i) >- { >- platformResourcePath.append('/'); >- platformResourcePath.append(URI.decode(converted.segment(i))); >- } >- return createPlatformResourceOutputStream(platformResourcePath.toString()); >- } >- else >- { >- return createURLOutputStream(converted); >- } >- } >- } >- >- /** >- * Creates an output stream for the file path and returns it. >- * <p> >- * This implementation allocates a {@link FileOutputStream} and creates subdirectories as necessary. >- * </p> >- * @return an open output stream. >- * @exception IOException if there is a problem obtaining an open output stream. >- */ >- protected OutputStream createFileOutputStream(String filePath) throws IOException >- { >- File file = new File(filePath); >- String parent = file.getParent(); >- if (parent != null) >- { >- new File(parent).mkdirs(); >- } >- OutputStream outputStream = new FileOutputStream(file); >- return outputStream; >- } >- >- /** >- * Creates an output stream for the archive access. >- * </p> >- * @return an open output stream. >- * @exception IOException if there is a problem obtaining an open output stream. >- */ >- protected OutputStream createArchiveOutputStream(URI archiveURI) throws IOException >- { >- return createArchive(archiveURI).getOutputStream(); >- } >- >- /** >- * Creates an output stream for the platform resource path and returns it. >- * <p> >- * This implementation does one of two things, depending on the runtime environment. >- * If there is an Eclipse workspace, it delegates to >- * {@link WorkbenchHelper#createPlatformResourceOutputStream WorkbenchHelper.createPlatformResourceOutputStream}, >- * which gives the expected Eclipse behaviour. >- * Otherwise, the {@link EcorePlugin#resolvePlatformResourcePath resolved} URI >- * is delegated to {@link #createOutputStream createOutputStream} >- * for recursive processing. >- * @return an open output stream. >- * @exception IOException if there is a problem obtaining an open output stream or a valid interpretation of the path. >- * @see EcorePlugin#resolvePlatformResourcePath(String) >- */ >- protected OutputStream createPlatformResourceOutputStream(String platformResourcePath) throws IOException >- { >- // ECLIPSE-DEPEND-BEGIN >- if (workspaceRoot != null) >- { >- return WorkbenchHelper.createPlatformResourceOutputStream(platformResourcePath); >- } >- else >- // ECLIPSE-DEPEND-END >- { >- URI resolvedLocation = EcorePlugin.resolvePlatformResourcePath(platformResourcePath); >- if (resolvedLocation != null) >- { >- return createOutputStream(resolvedLocation); >- } >- >- throw new IOException("The path '" + platformResourcePath + "' is unmapped"); >- } >- } >- >- /** >- * Creates an output stream for the URI, assuming it's a URL, and returns it. >- * @return an open output stream. >- * @exception IOException if there is a problem obtaining an open output stream. >- */ >- protected OutputStream createURLOutputStream(URI uri) throws IOException >- { >- try >- { >- URL url = new URL(uri.toString()); >- URLConnection urlConnection = url.openConnection(); >- urlConnection.setDoOutput(true); >- return urlConnection.getOutputStream(); >- } >- catch (RuntimeException exception) >- { >- throw new Resource.IOWrappedException(exception); >- } >- } >- >- /** >- * Creates an input stream for the URI and returns it. >- * <p> >- * This implementation {@link #normalize normalizes} the URI and uses that as the basis for further processing. >- * It factors out the URI schemes <code>file</code> and <code>platform</code> (with leading <code>resource</code> segment) >- * for special processing by >- * {@link #createFileInputStream createFileInputStream} and >- * {@link #createPlatformResourceInputStream createPlatformResourceInputStream}, respectively. >- * The file-based URI is {@link URI#toFileString converted} to a file path, e.g., >- *<pre> >- * file:///C:/directory/file >- * -> >- * C:/directory/file >- *</pre> >- * and the platform-based URI is converted to a platform path by trimming the leading <code>platform:/resource</code>, e.g., >- *<pre> >- * platform:/resource/project/directory/file >- * -> >- * /project/directory/file >- *</pre> >- * All other cases are handled as standard URLs by {@link #createURLInputStream createURLInputStream}. >- * </p> >- * @return an open Input stream. >- * @exception IOException if there is a problem obtaining an open input stream. >- */ >- public InputStream createInputStream(URI uri) throws IOException >- { >- URI converted = normalize(uri); >- if (converted.isFile()) >- { >- String filePath = converted.toFileString(); >- return createFileInputStream(filePath); >- } >- else >- { >- String scheme = converted.scheme(); >- if (isArchiveScheme(scheme)) >- { >- return createArchiveInputStream(converted); >- } >- else if ("platform".equals(scheme) && converted.segmentCount() > 1 && "resource".equals(converted.segment(0))) >- { >- >- StringBuffer platformResourcePath = new StringBuffer(); >- for (int i = 1, size = converted.segmentCount(); i < size; ++i) >- { >- platformResourcePath.append('/'); >- platformResourcePath.append(URI.decode(converted.segment(i))); >- } >- return createPlatformResourceInputStream(platformResourcePath.toString()); >- } >- else >- { >- return createURLInputStream(converted); >- } >- } >- } >- >- /** >- * Creates an input stream for the file path and returns it. >- * <p> >- * This implementation allocates a {@link FileInputStream}. >- * </p> >- * @return an open input stream. >- * @exception IOException if there is a problem obtaining an open input stream. >- */ >- protected InputStream createFileInputStream(String filePath) throws IOException >- { >- File file = new File(filePath); >- InputStream inputStream = new FileInputStream(file); >- return inputStream; >- } >- >- /** >- * A specialized class for reading from an archive. >- */ >- protected class Archive extends ArchiveURLConnection >- { >- public Archive(URI uri) >- { >- super(uri.toString()); >- } >- >- protected boolean emulateArchiveScheme() >- { >- return false; >- } >- >- protected boolean useZipFile() >- { >- return true; >- } >- >- protected InputStream createInputStream(String nestedURL) throws IOException >- { >- return URIConverterImpl.this.createInputStream(URI.createURI(nestedURL)); >- } >- >- protected OutputStream createOutputStream(String nestedURL) throws IOException >- { >- return URIConverterImpl.this.createOutputStream(URI.createURI(nestedURL)); >- } >- } >- >- protected Archive createArchive(URI uri) >- { >- return new Archive(uri); >- } >- >- /** >- * Creates an input stream for the archive paths and returns it. >- * It uses {@link ArchiveReader} to implement read access. >- * </p> >- * @return an open input stream. >- * @exception IOException if there is a problem obtaining an open input stream. >- */ >- protected InputStream createArchiveInputStream(URI archiveURI) throws IOException >- { >- return createArchive(archiveURI).getInputStream(); >- } >- >- /** >- * Creates an input stream for the platform resource path and returns it. >- * <p> >- * This implementation does one of two things, depending on the runtime environment. >- * If there is an Eclipse workspace, it delegates to >- * {@link WorkbenchHelper#createPlatformResourceInputStream WorkbenchHelper.createPlatformResourceInputStream}, >- * which gives the expected Eclipse behaviour. >- * Otherwise, the {@link EcorePlugin#resolvePlatformResourcePath resolved} URI >- * is delegated to {@link #createInputStream createInputStream} >- * for recursive processing. >- * @return an open input stream. >- * @exception IOException if there is a problem obtaining an open input stream or a valid interpretation of the path. >- * @see EcorePlugin#resolvePlatformResourcePath(String) >- */ >- protected InputStream createPlatformResourceInputStream(String platformResourcePath) throws IOException >- { >- // ECLIPSE-DEPEND-BEGIN >- if (workspaceRoot != null) >- { >- return WorkbenchHelper.createPlatformResourceInputStream(platformResourcePath); >- } >- else >- // ECLIPSE-DEPEND-END >- { >- URI resolvedLocation = EcorePlugin.resolvePlatformResourcePath(platformResourcePath); >- if (resolvedLocation != null) >- { >- return createInputStream(resolvedLocation); >- } >- >- throw new IOException("The path '" + platformResourcePath + "' is unmapped"); >- } >- } >- >- /** >- * Creates an input stream for the URI, assuming it's a URL, and returns it. >- * @return an open input stream. >- * @exception IOException if there is a problem obtaining an open input stream. >- */ >- protected InputStream createURLInputStream(URI uri) throws IOException >- { >- try >- { >- URL url = new URL(uri.toString()); >- URLConnection urlConnection = url.openConnection(); >- return urlConnection.getInputStream(); >- } >- catch (RuntimeException exception) >- { >- throw new Resource.IOWrappedException(exception); >- } >- } >- >- /** >- * Returns the normalized form of the URI. >- * <p> >- * This implementation does precisely and only the {@link URIConverter#normalize typical} thing. >- * It calls itself recursively so that mapped chains are followed. >- * </p> >- * @param uri the URI to normalize. >- * @return the normalized form. >- * @see org.eclipse.emf.ecore.plugin.EcorePlugin#getPlatformResourceMap >- */ >- public URI normalize(URI uri) >- { >- String fragment = uri.fragment(); >- URI result = >- fragment == null ? >- getInternalURIMap().getURI(uri) : >- getInternalURIMap().getURI(uri.trimFragment()).appendFragment(fragment); >- String scheme = result.scheme(); >- if (scheme == null) >- { >- // ECLIPSE-DEPEND-BEGIN >- if (workspaceRoot != null) >- { >- if (result.hasAbsolutePath()) >- { >- result = URI.createPlatformResourceURI(result.trimFragment().toString()); >- if (fragment != null) >- { >- result = result.appendFragment(fragment); >- } >- } >- } >- else >- // ECLIPSE-DEPEND-END >- { >- if (result.hasAbsolutePath()) >- { >- result = URI.createURI("file:" + result); >- } >- else >- { >- result = URI.createFileURI(new File(result.trimFragment().toString()).getAbsolutePath()); >- if (fragment != null) >- { >- result = result.appendFragment(fragment); >- } >- } >- } >- } >- >- if (result.equals(uri)) >- { >- return uri; >- } >- else >- { >- return normalize(result); >- } >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public Map getURIMap() >- { >- return getInternalURIMap(); >- } >- >- /** >- * Returns the internal version of the URI map. >- * @return the internal version of the URI map. >- */ >- protected URIMap getInternalURIMap() >- { >- if (uriMap == null) >- { >- URIMappingRegistryImpl mappingRegistryImpl = >- new URIMappingRegistryImpl() >- { >- protected URI delegatedGetURI(URI uri) >- { >- return URIMappingRegistryImpl.INSTANCE.getURI(uri); >- } >- }; >- >- uriMap = (URIMap)mappingRegistryImpl.map(); >- } >- >- return uriMap; >- } >-} >Index: src/org/eclipse/emf/ecore/resource/impl/ResourceFactoryRegistryImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/resource/impl/ResourceFactoryRegistryImpl.java,v >retrieving revision 1.3 >diff -u -r1.3 ResourceFactoryRegistryImpl.java >--- src/org/eclipse/emf/ecore/resource/impl/ResourceFactoryRegistryImpl.java 12 Jun 2005 13:29:22 -0000 1.3 >+++ src/org/eclipse/emf/ecore/resource/impl/ResourceFactoryRegistryImpl.java 16 Nov 2007 07:20:52 -0000 >@@ -1,115 +1,23 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: ResourceFactoryRegistryImpl.java,v 1.3 2005/06/12 13:29:22 emerks Exp $ >- */ > package org.eclipse.emf.ecore.resource.impl; > >- >-import java.util.HashMap; > import java.util.Map; > > import org.eclipse.emf.common.util.URI; > import org.eclipse.emf.ecore.resource.Resource; >+import org.eclipse.emf.ecore.resource.Resource.Factory; >+ >+public class ResourceFactoryRegistryImpl implements Resource.Factory.Registry { >+ >+ public Map getExtensionToFactoryMap() { >+ throw new UnsupportedOperationException(); >+ } >+ >+ public Factory getFactory(URI uri) { >+ throw new UnsupportedOperationException(); >+ } > >+ public Map getProtocolToFactoryMap() { >+ throw new UnsupportedOperationException(); >+ } > >-/** >- * An extensible implementation of a resource factory registry. >- */ >-public class ResourceFactoryRegistryImpl implements Resource.Factory.Registry >-{ >- /** >- * The protocol map. >- */ >- protected Map protocolToFactoryMap = new HashMap(); >- >- /** >- * The extension map. >- */ >- protected Map extensionToFactoryMap = new HashMap(); >- >- /** >- * Creates an instance. >- */ >- public ResourceFactoryRegistryImpl() >- { >- } >- >- /** >- * Returns the resource factory appropriate for the given URI. >- * <p> >- * This implementation does the {@link org.eclipse.emf.ecore.resource.Resource.Factory.Registry#getFactory typical} thing. >- * It will delegate to {@link #delegatedGetFactory(URI)} >- * in the case that the typical behaviour doesn't produce a result; >- * clients are encouraged to override that method only. >- * </p> >- * @param uri the URI. >- * @return the resource factory appropriate for the given URI. >- * @see org.eclipse.emf.ecore.resource.ResourceSet#createResource(URI) >- */ >- public Resource.Factory getFactory(URI uri) >- { >- String protocol = uri.scheme(); >- Object resourceFactory = protocolToFactoryMap.get(protocol); >- if (resourceFactory == null) >- { >- String extension = uri.fileExtension(); >- resourceFactory = extensionToFactoryMap.get(extension); >- if (resourceFactory == null) >- { >- resourceFactory = extensionToFactoryMap.get("*"); >- if (resourceFactory == null) >- { >- resourceFactory = delegatedGetFactory(uri); >- } >- } >- } >- >- return >- resourceFactory instanceof Resource.Factory.Descriptor ? >- ((Resource.Factory.Descriptor)resourceFactory).createFactory() : >- (Resource.Factory)resourceFactory; >- } >- >- /** >- * Returns the resource factory appropriate for the given URI, when standard alternatives fail. >- * <p> >- * This implementation returns <code>null</code>; >- * clients are encouraged to override it. >- * </p> >- * @param uri the URI. >- * @return the resource factory appropriate for the given URI. >- * @see #getFactory(URI) >- */ >- protected Resource.Factory delegatedGetFactory(URI uri) >- { >- return null; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public Map getExtensionToFactoryMap() >- { >- return extensionToFactoryMap; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public Map getProtocolToFactoryMap() >- { >- return protocolToFactoryMap; >- } > } >Index: src/org/eclipse/emf/ecore/resource/impl/ResourceFactoryImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/resource/impl/ResourceFactoryImpl.java,v >retrieving revision 1.3 >diff -u -r1.3 ResourceFactoryImpl.java >--- src/org/eclipse/emf/ecore/resource/impl/ResourceFactoryImpl.java 8 Jun 2005 06:20:10 -0000 1.3 >+++ src/org/eclipse/emf/ecore/resource/impl/ResourceFactoryImpl.java 16 Nov 2007 07:20:52 -0000 >@@ -1,45 +1,13 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: ResourceFactoryImpl.java,v 1.3 2005/06/08 06:20:10 nickb Exp $ >- */ > package org.eclipse.emf.ecore.resource.impl; > >- > import org.eclipse.emf.common.util.URI; > import org.eclipse.emf.ecore.resource.Resource; > >+public class ResourceFactoryImpl implements Resource.Factory { >+ >+ public Resource createResource(URI uri) { >+ // TODO Auto-generated method stub >+ return null; >+ } > >-/** >- * A trivial implementation of a resource factory. >- */ >-public class ResourceFactoryImpl implements Resource.Factory >-{ >- /** >- * Creates an instance. >- */ >- public ResourceFactoryImpl() >- { >- } >- >- /** >- * Returns a newly allocated default resource {@link org.eclipse.emf.ecore.resource.impl.ResourceImpl#ResourceImpl(URI) implementation}. >- * @param uri the URI. >- * @return a new resource for the URI. >- */ >- public Resource createResource(URI uri) >- { >- return new ResourceImpl(uri); >- } > } >Index: src/org/eclipse/emf/ecore/resource/impl/ResourceImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/resource/impl/ResourceImpl.java,v >retrieving revision 1.18 >diff -u -r1.18 ResourceImpl.java >--- src/org/eclipse/emf/ecore/resource/impl/ResourceImpl.java 18 Sep 2006 15:47:04 -0000 1.18 >+++ src/org/eclipse/emf/ecore/resource/impl/ResourceImpl.java 16 Nov 2007 07:20:52 -0000 >@@ -1,1390 +1,11 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: ResourceImpl.java,v 1.18 2006/09/18 15:47:04 emerks Exp $ >- */ > package org.eclipse.emf.ecore.resource.impl; > >- >-import java.io.IOException; >-import java.io.InputStream; >-import java.io.OutputStream; >-import java.util.ArrayList; >-import java.util.HashMap; >-import java.util.Iterator; >-import java.util.List; >-import java.util.ListIterator; >-import java.util.Map; >-import java.util.zip.ZipEntry; >-import java.util.zip.ZipInputStream; >-import java.util.zip.ZipOutputStream; >- >-import org.eclipse.emf.common.notify.Adapter; >-import org.eclipse.emf.common.notify.Notification; >-import org.eclipse.emf.common.notify.NotificationChain; >-import org.eclipse.emf.common.notify.impl.AdapterImpl; >-import org.eclipse.emf.common.notify.impl.NotificationChainImpl; >-import org.eclipse.emf.common.notify.impl.NotificationImpl; >-import org.eclipse.emf.common.notify.impl.NotifierImpl; >-import org.eclipse.emf.common.notify.impl.NotifyingListImpl; >-import org.eclipse.emf.common.util.AbstractTreeIterator; >-import org.eclipse.emf.common.util.EList; >-import org.eclipse.emf.common.util.TreeIterator; > import org.eclipse.emf.common.util.URI; >-import org.eclipse.emf.common.util.WrappedException; >-import org.eclipse.emf.ecore.EObject; >-import org.eclipse.emf.ecore.InternalEObject; >-import org.eclipse.emf.ecore.resource.Resource; >-import org.eclipse.emf.ecore.resource.ResourceSet; >-import org.eclipse.emf.ecore.resource.URIConverter; >-import org.eclipse.emf.ecore.util.EcoreUtil; >-import org.eclipse.emf.ecore.util.InternalEList; >-import org.eclipse.emf.ecore.util.EcoreUtil.ContentTreeIterator; >-import org.eclipse.emf.ecore.util.EcoreUtil.ProperContentIterator; >- >- >-/** >- * A highly extensible resource implementation. >- * <p> >- * The following configuration and control mechanisms are provided: >- * <ul> >- * <li><b>Serialization</b></li> >- * <ul> >- * <li>{@link #doSave(OutputStream, Map)}</li> >- * <li>{@link #doLoad(InputStream, Map)}</li> >- * <li>{@link #doUnload}</li> >- * </ul> >- * <li><b>Root URI Fragment</b></li> >- * <ul> >- * <li>{@link #getURIFragmentRootSegment(EObject)}</li> >- * <li>{@link #getEObjectForURIFragmentRootSegment(String)}</li> >- * </ul> >- * <li><b>Containment Changes</b></li> >- * <ul> >- * <li>{@link #attached(EObject)}</li> >- * <li>{@link #detached(EObject)}</li> >- * <li>{@link #unloaded(InternalEObject)}</li> >- * </ul> >- * <li><b>ZIP</b></li> >- * <ul> >- * <li>{@link #useZip}</li> >- * <li>{@link #newContentZipEntry}</li> >- * <li>{@link #isContentZipEntry(ZipEntry)}</li> >- * </ul> >- * <li><b>URI Conversion</b></li> >- * <ul> >- * <li>{@link #getURIConverter}</li> >- * </ul> >- * <li><b>Modification</b></li> >- * <ul> >- * <li>{@link #createModificationTrackingAdapter()}</li> >- * </ul> >- * </ul> >- * </p> >- */ >-public class ResourceImpl extends NotifierImpl implements Resource, Resource.Internal >-{ >- /** >- * The default URI converter when there is no resource set. >- */ >- private static URIConverter defaultURIConverter; >- >- /** >- * Returns the default URI converter that's used when there is no resource set. >- * @return the default URI converter. >- * @see #getURIConverter >- */ >- protected static URIConverter getDefaultURIConverter() >- { >- if (defaultURIConverter == null) >- { >- defaultURIConverter = new URIConverterImpl(); >- } >- return defaultURIConverter; >- } >- >- /** >- * Merges 2 maps, without changing any of them. If map2 and map1 >- * have the same key for an entry, map1's value will be the one in >- * the merged map. >- */ >- protected static Map mergeMaps(Map map1, Map map2) >- { >- if (map1 == null || map1.isEmpty()) >- { >- return map2; >- } >- else if (map2 == null || map2.isEmpty()) >- { >- return map1; >- } >- else >- { >- Map mergedMap = new HashMap(map2); >- mergedMap.putAll(map1); >- return mergedMap; >- } >- } >- >- /** >- * The storage for the default save options. >- */ >- protected Map defaultSaveOptions; >- >- /** >- * The storage for the default load options. >- */ >- protected Map defaultLoadOptions; >- >- /** >- * The containing resource set. >- * @see #getResourceSet >- */ >- protected ResourceSet resourceSet; >- >- /** >- * The URI. >- * @see #getURI >- */ >- protected URI uri; >- >- /** >- * The contents. >- * @see #getContents >- */ >- protected ContentsEList contents; >- >- /** >- * The errors. >- * @see #getErrors >- */ >- protected EList errors; >- >- /** >- * The warnings. >- * @see #getErrors >- */ >- protected EList warnings; >- >- /** >- * The modified flag. >- * @see #isModified >- */ >- protected boolean isModified; >- >- /** >- * The loaded flag. >- * @see #isLoaded >- */ >- protected boolean isLoaded; >- >- /** >- * The loading flag. >- * @see #isLoading >- */ >- protected boolean isLoading; >- >- /** >- * The modification tracking adapter. >- * @see #isTrackingModification >- * @see #attached(EObject) >- * @see #detached(EObject) >- */ >- protected Adapter modificationTrackingAdapter; >- >- /** >- * A map to retrieve the EObject based on the value of its ID feature. >- * @see #setIntrinsicIDToEObjectMap(Map) >- */ >- protected Map intrinsicIDToEObjectMap; >- >- /** >- * Creates a empty instance. >- */ >- public ResourceImpl() >- { >- } >- >- /** >- * Creates an instance with the given URI. >- * @param uri the URI. >- */ >- public ResourceImpl(URI uri) >- { >- this(); >- this.uri = uri; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public ResourceSet getResourceSet() >- { >- return resourceSet; >- } >- >- /** >- * Sets the new containing resource set, and removes the resource from a previous containing resource set, if necessary. >- * @param resourceSet the new containing resource set. >- * @param notifications the accumulating notifications. >- * @return notification of the change. >- */ >- public NotificationChain basicSetResourceSet(ResourceSet resourceSet, NotificationChain notifications) >- { >- ResourceSet oldResourceSet = this.resourceSet; >- if (oldResourceSet != null) >- { >- notifications = ((InternalEList)oldResourceSet.getResources()).basicRemove(this, notifications); >- } >- >- this.resourceSet = resourceSet; >- >- if (eNotificationRequired()) >- { >- if (notifications == null) >- { >- notifications = new NotificationChainImpl(2); >- } >- notifications.add >- (new NotificationImpl(Notification.SET, oldResourceSet, resourceSet) >- { >- public Object getNotifier() >- { >- return ResourceImpl.this; >- } >- public int getFeatureID(Class expectedClass) >- { >- return RESOURCE__RESOURCE_SET; >- } >- }); >- } >- >- return notifications; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public URI getURI() >- { >- return uri; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public void setURI(URI uri) >- { >- URI oldURI = this.uri; >- this.uri = uri; >- if (eNotificationRequired()) >- { >- Notification notification = >- new NotificationImpl(Notification.SET, oldURI, uri) >- { >- public Object getNotifier() >- { >- return ResourceImpl.this; >- } >- public int getFeatureID(Class expectedClass) >- { >- return RESOURCE__URI; >- } >- }; >- eNotify(notification); >- } >- } >- >- /** >- * A notifying list implementation for supporting {@link Resource#getContents}. >- */ >- protected class ContentsEList extends NotifyingListImpl implements InternalEList >- { >- public Object getNotifier() >- { >- return ResourceImpl.this; >- } >- >- public int getFeatureID() >- { >- return RESOURCE__CONTENTS; >- } >- >- protected boolean isNotificationRequired() >- { >- return ResourceImpl.this.eNotificationRequired(); >- } >- >- protected boolean useEquals() >- { >- return false; >- } >- >- protected boolean hasInverse() >- { >- return true; >- } >- >- protected boolean isUnique() >- { >- return true; >- } >- >- public NotificationChain inverseAdd(Object object, NotificationChain notifications) >- { >- InternalEObject eObject = (InternalEObject)object; >- notifications = eObject.eSetResource(ResourceImpl.this, notifications); >- ResourceImpl.this.attached(eObject); >- return notifications; >- } >- >- public NotificationChain inverseRemove(Object object, NotificationChain notifications) >- { >- InternalEObject eObject = (InternalEObject)object; >- if (ResourceImpl.this.isLoaded) >- { >- ResourceImpl.this.detached(eObject); >- } >- return eObject.eSetResource(null, notifications); >- } >- >- public Iterator basicIterator() >- { >- return super.basicIterator(); >- } >- >- public ListIterator basicListIterator() >- { >- return super.basicListIterator(); >- } >- >- public ListIterator basicListIterator(int index) >- { >- return super.basicListIterator(index); >- } >- >- public List basicList() >- { >- return super.basicList(); >- } >- >- protected Object [] newData(int capacity) >- { >- return new EObject [capacity]; >- } >- >- protected void didAdd(int index, Object object) >- { >- super.didAdd(index, object); >- if (index == size - 1) >- { >- loaded(); >- } >- modified(); >- } >- >- protected void didRemove(int index, Object object) >- { >- super.didRemove(index, object); >- modified(); >- } >- >- protected void didSet(int index, Object newObject, Object oldObject) >- { >- super.didSet(index, newObject, oldObject); >- modified(); >- } >- >- protected void didClear(int oldSize, Object [] oldData) >- { >- if (oldSize == 0) >- { >- loaded(); >- } >- else >- { >- super.didClear(oldSize, oldData); >- } >- } >- >- protected void loaded() >- { >- if (!ResourceImpl.this.isLoaded()) >- { >- Notification notification = ResourceImpl.this.setLoaded(true); >- if (notification != null) >- { >- ResourceImpl.this.eNotify(notification); >- } >- } >- } >- >- protected void modified() >- { >- if (isTrackingModification()) >- { >- setModified(true); >- } >- } >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public EList getContents() >- { >- if (contents == null) >- { >- contents = new ContentsEList(); >- } >- return contents; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public TreeIterator getAllContents() >- { >- return >- new AbstractTreeIterator(this, false) >- { >- public Iterator getChildren(Object object) >- { >- return object == ResourceImpl.this ? ResourceImpl.this.getContents().iterator() : ((EObject)object).eContents().iterator(); >- } >- }; >- } >- >- protected TreeIterator getAllProperContents(EObject eObject) >- { >- return EcoreUtil.getAllProperContents(eObject, false); >- } >- >- protected TreeIterator getAllProperContents(List contents) >- { >- return >- new ContentTreeIterator(contents, false) >- { >- public Iterator getChildren(Object object) >- { >- return object == this.object ? ((List)object).iterator() : new ProperContentIterator(((EObject)object)); >- } >- }; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public EList getErrors() >- { >- if (errors == null) >- { >- errors = >- new NotifyingListImpl() >- { >- protected boolean isNotificationRequired() >- { >- return ResourceImpl.this.eNotificationRequired(); >- } >- >- public Object getNotifier() >- { >- return ResourceImpl.this; >- } >- >- public int getFeatureID() >- { >- return RESOURCE__ERRORS; >- } >- }; >- } >- return errors; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public EList getWarnings() >- { >- if (warnings == null) >- { >- warnings = >- new NotifyingListImpl() >- { >- protected boolean isNotificationRequired() >- { >- return ResourceImpl.this.eNotificationRequired(); >- } >- >- public Object getNotifier() >- { >- return ResourceImpl.this; >- } >- >- public int getFeatureID() >- { >- return RESOURCE__WARNINGS; >- } >- }; >- } >- return warnings; >- } >- >- /** >- * Returns whether contents will be compressed. >- * This implementation returns <code>false</code>. >- * When this returns <code>true</code>, >- * {@link #save(OutputStream, Map)} and {@link #load(InputStream, Map)} >- * will zip compress and decompress contents. >- * @return whether contents will be compressed. >- * @see #newContentZipEntry >- * @see #isContentZipEntry(ZipEntry) >- */ >- protected boolean useZip() >- { >- return false; >- } >- >- >- /** >- * Returns the URI fragment root segment for reaching the given direct content object. >- * This default implementation returns the position of the object, if there is more than one object, >- * otherwise, the empty string. >- * As a result, the URI fragment for a single root object will be <code>"/"</code>. >- * @return the URI fragment root segment for reaching the given direct content object. >- */ >- protected String getURIFragmentRootSegment(EObject eObject) >- { >- List contents = getContents(); >- return contents.size() > 1 ? >- Integer.toString(contents.indexOf(eObject)) : >- ""; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public String getURIFragment(EObject eObject) >- { >- String id = EcoreUtil.getID(eObject); >- if (id != null) >- { >- return id; >- } >- else >- { >- InternalEObject internalEObject = (InternalEObject)eObject; >- if (internalEObject.eDirectResource() == this) >- { >- return "/" + getURIFragmentRootSegment(eObject); >- } >- else >- { >- List uriFragmentPath = new ArrayList(); >- for (InternalEObject container = internalEObject.eInternalContainer(); container != null; container = internalEObject.eInternalContainer()) >- { >- uriFragmentPath.add(container.eURIFragmentSegment(internalEObject.eContainingFeature(), internalEObject)); >- internalEObject = container; >- if (container.eDirectResource() == this) >- { >- break; >- } >- } >- >- StringBuffer result = new StringBuffer("/"); >- result.append(getURIFragmentRootSegment(internalEObject)); >- >- for (int i = uriFragmentPath.size() - 1; i >= 0; --i) >- { >- result.append('/'); >- result.append(uriFragmentPath.get(i)); >- } >- return result.toString(); >- } >- } >- } >- >- /** >- * Returns the object associated with the URI fragment root segment. >- * This default implementation uses the position of the object; >- * an empty string is the same as <code>"0"</code>. >- * @return the object associated with the URI fragment root segment. >- */ >- protected EObject getEObjectForURIFragmentRootSegment(String uriFragmentRootSegment) >- { >- int position = 0; >- if (uriFragmentRootSegment.length() > 0) >- { >- try >- { >- position = Integer.parseInt(uriFragmentRootSegment); >- } >- catch (NumberFormatException exception) >- { >- throw new WrappedException(exception); >- } >- } >- >- List contents = getContents(); >- if (position < contents.size()) >- { >- return (EObject)contents.get(position); >- } >- else >- { >- return null; >- } >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public EObject getEObject(String uriFragment) >- { >- int length = uriFragment.length(); >- if (length > 0) >- { >- if (uriFragment.charAt(0) == '/') >- { >- ArrayList uriFragmentPath = new ArrayList(4); >- int start = 1; >- for (int i = 1; i < length; ++i) >- { >- if (uriFragment.charAt(i) == '/') >- { >- uriFragmentPath.add(start == i ? "" : uriFragment.substring(start, i)); >- start = i + 1; >- } >- } >- uriFragmentPath.add(uriFragment.substring(start)); >- return getEObject(uriFragmentPath); >- } >- else if (uriFragment.charAt(length - 1) == '?') >- { >- int index = uriFragment.lastIndexOf('?', length - 2); >- if (index > 0) >- { >- uriFragment = uriFragment.substring(0, index); >- } >- } >- } >- >- return getEObjectByID(uriFragment); >- } >- >- /** >- * Returns the object based on the fragment path as a list of Strings. >- */ >- protected EObject getEObject(List uriFragmentPath) >- { >- int size = uriFragmentPath.size(); >- EObject eObject = getEObjectForURIFragmentRootSegment(size == 0 ? "" : (String)uriFragmentPath.get(0)); >- for (int i = 1; i < size && eObject != null; ++i) >- { >- eObject = ((InternalEObject)eObject).eObjectForURIFragmentSegment((String)uriFragmentPath.get(i)); >- } >- >- return eObject; >- } >- >- /** >- * Returns the map used to cache the EObject that is identified by the {@link #getEObjectByID(String) value} >- * of its ID feature. >- * @return the map used to cache the EObject that is identified by the value of its ID feature. >- * @see #setIntrinsicIDToEObjectMap >- */ >- public Map getIntrinsicIDToEObjectMap() >- { >- return intrinsicIDToEObjectMap; >- } >- >- /** >- * Sets the map used to cache the EObject identified by the value of its ID feature. >- * This cache is only activated if the map is not <code>null</code>. >- * The map will be lazily loaded by the {@link #getEObjectByID(String) getEObjectByID} method. >- * It is up to the client to clear the cache when it becomes invalid, >- * e.g., when the ID of a previously mapped EObject is changed. >- * @param intrinsicIDToEObjectMap the new map or <code>null</code>. >- * @see #getIntrinsicIDToEObjectMap >- */ >- public void setIntrinsicIDToEObjectMap(Map intrinsicIDToEObjectMap) >- { >- this.intrinsicIDToEObjectMap = intrinsicIDToEObjectMap; >- } >- >- >- /** >- * Returns the object based on the fragment as an ID. >- */ >- protected EObject getEObjectByID(String id) >- { >- Map map = getIntrinsicIDToEObjectMap(); >- if (map != null) >- { >- EObject eObject = (EObject)map.get(id); >- if (eObject != null) >- { >- return eObject; >- } >- } >- >- EObject result = null; >- for (TreeIterator i = getAllProperContents(getContents()); i.hasNext(); ) >- { >- EObject eObject = (EObject)i.next(); >- String eObjectId = EcoreUtil.getID(eObject); >- if (eObjectId != null) >- { >- if (map != null) >- { >- map.put(eObjectId, eObject); >- } >- >- if (eObjectId.equals(id)) >- { >- result = eObject; >- if (map == null) >- { >- break; >- } >- } >- } >- } >- >- return result; >- } >- >- public void attached(EObject eObject) >- { >- if (isAttachedDetachedHelperRequired()) >- { >- attachedHelper(eObject); >- for (TreeIterator tree = getAllProperContents(eObject); tree.hasNext(); ) >- { >- attachedHelper((EObject)tree.next()); >- } >- } >- } >- >- protected boolean isAttachedDetachedHelperRequired() >- { >- return isTrackingModification() || getIntrinsicIDToEObjectMap() != null; >- } >- >- protected void attachedHelper(EObject eObject) >- { >- if (isTrackingModification()) >- { >- eObject.eAdapters().add(modificationTrackingAdapter); >- } >- >- Map map = getIntrinsicIDToEObjectMap(); >- if (map != null) >- { >- String id = EcoreUtil.getID(eObject); >- if (id != null) >- { >- map.put(id, eObject); >- } >- } >- } >- >- >- /** >- * Adds modification tracking adapters to the object and it's content tree. >- * @param eObject the object. >- * @see #attached(EObject) >- * @deprecated since 2.1.0. This method is not invoked anymore. See >- * {@link #attachedHelper(EObject)}. >- */ >- final protected void addModificationTrackingAdapters(EObject eObject) >- { >- } >- >- public void detached(EObject eObject) >- { >- if (isAttachedDetachedHelperRequired()) >- { >- detachedHelper(eObject); >- for (TreeIterator tree = getAllProperContents(eObject); tree.hasNext(); ) >- { >- detachedHelper((EObject)tree.next()); >- } >- } >- } >- >- protected void detachedHelper(EObject eObject) >- { >- Map map = getIntrinsicIDToEObjectMap(); >- if (map != null) >- { >- String id = EcoreUtil.getID(eObject); >- if (id != null) >- { >- map.remove(id); >- } >- } >- >- if (isTrackingModification()) >- { >- eObject.eAdapters().remove(modificationTrackingAdapter); >- } >- } >- >- /** >- * Removes modification tracking adapters to the object and it's content tree. >- * @param eObject the object. >- * @see #detached(EObject) >- * @deprecated since 2.1.0. This method is not invoked anymore. See >- * {@link #attachedHelper(EObject)}. >- */ >- final protected void removeModificationTrackingAdapters(EObject eObject) >- { >- } >- >- >- /** >- * Returns the URI converter. >- * This typically gets the {@link ResourceSet#getURIConverter converter} >- * from the {@link #getResourceSet containing} resource set, >- * but it calls {@link #getDefaultURIConverter} when there is no containing resource set. >- * @return the URI converter. >- */ >- protected URIConverter getURIConverter() >- { >- return >- getResourceSet() == null ? >- getDefaultURIConverter() : >- getResourceSet().getURIConverter(); >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public void save(Map options) throws IOException >- { >- URIConverter uriConverter = getURIConverter(); >- OutputStream outputStream = uriConverter.createOutputStream(getURI()); >- try >- { >- save(outputStream, options); >- } >- finally >- { >- outputStream.close(); >- } >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public void load(Map options) throws IOException >- { >- if (!isLoaded) >- { >- URIConverter uriConverter = getURIConverter(); >- InputStream inputStream = uriConverter.createInputStream(getURI()); >- try >- { >- load(inputStream, options); >- } >- finally >- { >- inputStream.close(); >- } >- } >- } >- >- /** >- * Returns a new zip entry for {@link #save(OutputStream, Map) saving} the resource contents. >- * It is called by {@link #save(OutputStream, Map)} when writing {@link #useZip zipped} contents. >- * This implementation creates an entry called <code>ResourceContents</code>. >- * @return a new zip entry. >- * @see #isContentZipEntry(ZipEntry) >- */ >- protected ZipEntry newContentZipEntry() >- { >- return new ZipEntry("ResourceContents"); >- } >- >- /** >- * Saves the resource to the output stream using the specified options. >- * <p> >- * This implementation is <code>final</code>; >- * clients should override {@link #doSave doSave}. >- * </p> >- * @param options the save options. >- * @see #save(Map) >- * @see #doSave(OutputStream, Map) >- * @see #load(InputStream, Map) >- */ >- public final void save(OutputStream outputStream, Map options) throws IOException >- { >- if (errors != null) >- { >- errors.clear(); >- } >- >- if (warnings != null) >- { >- warnings.clear(); >- } >- >- options = mergeMaps(options, defaultSaveOptions); >- URIConverter.Cipher cipher = options != null ? >- (URIConverter.Cipher)options.get(Resource.OPTION_CIPHER) : >- null; >- >- if (cipher != null) >- { >- try >- { >- outputStream = cipher.encrypt(outputStream); >- } >- catch (Exception e) >- { >- throw new IOWrappedException(e); >- } >- } >- >- ZipOutputStream zipOutputStream = null; >- if (useZip() || (options != null && Boolean.TRUE.equals(options.get(Resource.OPTION_ZIP)))) >- { >- zipOutputStream = >- new ZipOutputStream(outputStream) >- { >- public void finish() throws IOException >- { >- super.finish(); >- def.end(); >- } >- >- public void flush() >- { >- } >- >- public void close() throws IOException >- { >- try >- { >- super.flush(); >- } >- catch (IOException exception) >- { >- } >- super.close(); >- } >- }; >- zipOutputStream.putNextEntry(newContentZipEntry()); >- outputStream = zipOutputStream; >- } >- >- doSave(outputStream, options); >- >- if (cipher != null) >- { >- try >- { >- cipher.finish(outputStream); >- } >- catch (Exception e) >- { >- throw new IOWrappedException(e); >- } >- } >- >- setModified(false); >- >- if (zipOutputStream != null) >- { >- zipOutputStream.finish(); >- } >- } >- >- /** >- * Called to save the resource. >- * This implementation throws an exception; >- * clients must override it. >- * @param outputStream the stream >- * @param options the save options. >- * @exception UnsupportedOperationException. >- */ >- protected void doSave(OutputStream outputStream, Map options) throws IOException >- { >- throw new UnsupportedOperationException(); >- } >- >- /** >- * Returns whether the given entry is the content entry for this resource. >- * It is called by {@link #load(InputStream, Map)} when reading {@link #useZip zipped} contents. >- * This implementation return <code>true</code>; >- * i.e., the first entry will be read. >- * @return whether the given entry is the content entry for this resource. >- * @see #newContentZipEntry >- */ >- protected boolean isContentZipEntry(ZipEntry zipEntry) >- { >- return true; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public final void load(InputStream inputStream, Map options) throws IOException >- { >- if (!isLoaded) >- { >- Notification notification = setLoaded(true); >- isLoading = true; >- >- if (errors != null) >- { >- errors.clear(); >- } >- >- if (warnings != null) >- { >- warnings.clear(); >- } >- >- try >- { >- if (useZip() || (options != null && Boolean.TRUE.equals(options.get(Resource.OPTION_ZIP)))) >- { >- ZipInputStream zipInputStream = new ZipInputStream(inputStream); >- while (zipInputStream.available() != 0) >- { >- ZipEntry zipEntry = zipInputStream.getNextEntry(); >- if (isContentZipEntry(zipEntry)) >- { >- inputStream = zipInputStream; >- break; >- } >- } >- } >- >- options = mergeMaps(options, defaultLoadOptions); >- URIConverter.Cipher cipher = options != null ? >- (URIConverter.Cipher)options.get(Resource.OPTION_CIPHER) : >- null; >- >- if (cipher != null) >- { >- try >- { >- inputStream = cipher.decrypt(inputStream); >- } >- catch (Exception e) >- { >- throw new IOWrappedException(e); >- } >- } >- >- doLoad(inputStream, options); >- >- if (cipher != null) >- { >- try >- { >- cipher.finish(inputStream); >- } >- catch (Exception e) >- { >- throw new IOWrappedException(e); >- } >- } >- } >- finally >- { >- isLoading = false; >- >- if (notification != null) >- { >- eNotify(notification); >- } >- >- setModified(false); >- } >- } >- } >- >- /** >- * Called to load the resource. >- * This implementation throws an exception; >- * clients must override it. >- * @param inputStream the stream >- * @param options the load options. >- * @exception UnsupportedOperationException. >- */ >- protected void doLoad(InputStream inputStream, Map options) throws IOException >- { >- throw new UnsupportedOperationException(); >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public boolean isLoaded() >- { >- return isLoaded; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public boolean isLoading() >- { >- return isLoading; >- } >- >- /** >- * Called when the object is unloaded. >- * This implementation >- * {@link InternalEObject#eSetProxyURI sets} the object to be a proxy >- * and clears the {@link #eAdapters adapters}. >- */ >- protected void unloaded(InternalEObject internalEObject) >- { >- internalEObject.eSetProxyURI(uri.appendFragment(getURIFragment(internalEObject))); >- internalEObject.eAdapters().clear(); >- } >- >- /** >- * Sets the load state as indicated, and returns a notification, if {@link org.eclipse.emf.common.notify.impl.BasicNotifierImpl#eNotificationRequired required}. >- * Clients are <b>not</b> expected to call this directly; it is managed by the implementation. >- * @param isLoaded whether the resource is loaded. >- * @return a notification. >- */ >- protected Notification setLoaded(boolean isLoaded) >- { >- boolean oldIsLoaded = this.isLoaded; >- this.isLoaded = isLoaded; >- >- if (eNotificationRequired()) >- { >- Notification notification = >- new NotificationImpl(Notification.SET, oldIsLoaded, isLoaded) >- { >- public Object getNotifier() >- { >- return ResourceImpl.this; >- } >- public int getFeatureID(Class expectedClass) >- { >- return RESOURCE__IS_LOADED; >- } >- }; >- return notification; >- } >- else >- { >- return null; >- } >- } >- >- /** >- * Does all the work of unloading the resource. >- * It calls {@link #unloaded unloaded} for each object it the content {@link #getAllContents tree}, >- * and clears the {@link #getContents contents}, {@link #getErrors errors}, and {@link #getWarnings warnings}. >- */ >- protected void doUnload() >- { >- Iterator allContents = getAllProperContents(new ArrayList(getContents())); >- >- // This guard is needed to ensure that clear doesn't make the resource become loaded. >- // >- if (!getContents().isEmpty()) >- { >- getContents().clear(); >- } >- getErrors().clear(); >- getWarnings().clear(); >- >- while (allContents.hasNext()) >- { >- unloaded((InternalEObject)allContents.next()); >- } >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public final void unload() >- { >- if (isLoaded) >- { >- Notification notification = setLoaded(false); >- doUnload(); >- if (notification != null) >- { >- eNotify(notification); >- } >- } >- } >- >- /** >- * An adapter implementation for tracking resource modification. >- */ >- protected class ModificationTrackingAdapter extends AdapterImpl >- { >- public void notifyChanged(Notification notification) >- { >- switch (notification.getEventType()) >- { >- case Notification.SET: >- case Notification.UNSET: >- case Notification.MOVE: >- { >- if (!notification.isTouch()) >- { >- setModified(true); >- } >- break; >- } >- case Notification.ADD: >- case Notification.REMOVE: >- case Notification.ADD_MANY: >- case Notification.REMOVE_MANY: >- { >- setModified(true); >- break; >- } >- } >- } >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public boolean isTrackingModification() >- { >- return modificationTrackingAdapter != null; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public void setTrackingModification(boolean isTrackingModification) >- { >- boolean oldIsTrackingModification = modificationTrackingAdapter != null; >- >- if (oldIsTrackingModification != isTrackingModification) >- { >- if (isTrackingModification) >- { >- modificationTrackingAdapter = createModificationTrackingAdapter(); >- >- for (TreeIterator i = getAllProperContents(getContents()); i.hasNext(); ) >- { >- EObject eObject = (EObject)i.next(); >- eObject.eAdapters().add(modificationTrackingAdapter); >- } >- } >- else >- { >- Adapter oldModificationTrackingAdapter = modificationTrackingAdapter; >- modificationTrackingAdapter = null; >- >- for (TreeIterator i = getAllProperContents(getContents()); i.hasNext(); ) >- { >- EObject eObject = (EObject)i.next(); >- eObject.eAdapters().remove(oldModificationTrackingAdapter); >- } >- } >- } >- >- if (eNotificationRequired()) >- { >- Notification notification = >- new NotificationImpl(Notification.SET, oldIsTrackingModification, isTrackingModification) >- { >- public Object getNotifier() >- { >- return ResourceImpl.this; >- } >- public int getFeatureID(Class expectedClass) >- { >- return RESOURCE__IS_TRACKING_MODIFICATION; >- } >- }; >- eNotify(notification); >- } >- } >- >- >- /** >- * Creates a modification tracking adapter. >- * This implementation creates a {@link ResourceImpl.ModificationTrackingAdapter}. >- * Clients may override this to any adapter. >- * @see #modificationTrackingAdapter >- * @see #isTrackingModification >- */ >- protected Adapter createModificationTrackingAdapter() >- { >- return new ModificationTrackingAdapter(); >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public boolean isModified() >- { >- return isModified; >- } > >- /* >- * Javadoc copied from interface. >- */ >- public void setModified(boolean isModified) >- { >- boolean oldIsModified = this.isModified; >- this.isModified = isModified; >- if (eNotificationRequired()) >- { >- Notification notification = >- new NotificationImpl(Notification.SET, oldIsModified, isModified) >- { >- public Object getNotifier() >- { >- return ResourceImpl.this; >- } >- public int getFeatureID(Class expectedClass) >- { >- return RESOURCE__IS_MODIFIED; >- } >- }; >- eNotify(notification); >- } >- } >+public class ResourceImpl { > >- /** >- * If an implementation uses IDs and stores the IDs as part of the resource >- * rather than as objects, this method should return a string representation of >- * the ID to object mapping, which might be implemented as a Java Map. >- * @return a string representation of the ID to object mapping >- */ >- public String toKeyString() >- { >- StringBuffer result = new StringBuffer("Key type: "); >- result.append(getClass().toString()); >- return result.toString(); >- } >+ public ResourceImpl(URI uri) { >+ throw new UnsupportedOperationException(); >+ } > >- public String toString() >- { >- return >- getClass().getName() + '@' + Integer.toHexString(hashCode()) + >- " uri='" + uri + "'"; >- } > } >Index: src/org/eclipse/emf/ecore/resource/impl/URIMappingRegistryImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/resource/impl/URIMappingRegistryImpl.java,v >retrieving revision 1.2 >diff -u -r1.2 URIMappingRegistryImpl.java >--- src/org/eclipse/emf/ecore/resource/impl/URIMappingRegistryImpl.java 8 Jun 2005 06:20:10 -0000 1.2 >+++ src/org/eclipse/emf/ecore/resource/impl/URIMappingRegistryImpl.java 16 Nov 2007 07:20:52 -0000 >@@ -1,256 +1,7 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: URIMappingRegistryImpl.java,v 1.2 2005/06/08 06:20:10 nickb Exp $ >- */ > package org.eclipse.emf.ecore.resource.impl; > >- >-import java.util.List; >-import java.util.Map; >- >-import org.eclipse.emf.common.util.BasicEList; > import org.eclipse.emf.common.util.BasicEMap; >-import org.eclipse.emf.common.util.URI; >- >- >-/** >- * An extensible implementation of a URI mapping registry. >- */ >-public class URIMappingRegistryImpl extends BasicEMap >-{ >- /** >- * The implementation of the global mapping registry. >- * @see org.eclipse.emf.ecore.resource.URIConverter#URI_MAP >- */ >- public static final URIMappingRegistryImpl INSTANCE = new URIMappingRegistryImpl(); >- >- /** >- * A list of lists of prefix URIs; >- * it is indexed by segment count to yield a list of prefixes of that length. >- */ >- protected BasicEList prefixMaps = new BasicEList(); >- >- /** >- * Creates an instance. >- */ >- public URIMappingRegistryImpl() >- { >- } >- >- /** >- * Creates an {@link MappingEntryImpl}. >- */ >- protected Entry newEntry(int hash, Object key, Object value) >- { >- validateKey(key); >- validateValue(value); >- return new MappingEntryImpl(hash, key, value); >- } >- >- /** >- * An extended implementation that maintains a bit >- * indicating if the entry represents a folder to folder mapping. >- */ >- protected class MappingEntryImpl extends EntryImpl >- { >- /** >- * The indicator whether this entry represents a folder to folder mapping. >- */ >- public boolean isPrefixMapEntry; >- >- /** >- * Creates an instance. >- */ >- public MappingEntryImpl(int hash, Object key, Object value) >- { >- super(hash, key, value); >- determineEntryType(); >- } >- >- /** >- * Computes whether this entry represents a folder to folder mapping. >- */ >- public void determineEntryType() >- { >- isPrefixMapEntry = ((URI)key).isPrefix() && ((URI)value).isPrefix(); >- } >- } >- >- /** >- * Returns the remapped URI, or the URI itself. >- * This implementation uses the map to find an exact match. >- * Failing that, it matches the {@link #prefixMaps} prefixes in order. >- * And failing that, it delegates to {@link #delegatedGetURI(URI) delegatedGetURI}. >- * @param uri the URI to remap. >- * @return the remapped URI, or the URI itself. >- */ >- public URI getURI(URI uri) >- { >- URI result = (URI)get(uri); >- if (result == null) >- { >- if (prefixMaps != null) >- { >- for (int i = Math.min(prefixMaps.size() - 1, uri.segmentCount()); i >= 0; --i) >- { >- List prefixes = (List)prefixMaps.get(i); >- for (int j = prefixes.size() - 1; j >= 0; --j) >- { >- Entry entry = (Entry)prefixes.get(j); >- result = uri.replacePrefix((URI)entry.getKey(), (URI)entry.getValue()); >- >- if (result != null) >- { >- return result; >- } >- } >- } >- } >- >- result = delegatedGetURI(uri); >- } >- >- return result; >- } >- >- /** >- * Returns the mapped URI for the given URI, when standard alternatives fail. >- * <p> >- * This implementation returns <code>uri</code>. >- * </p> >- * @param uri the URI. >- * @return the mapped URI. >- * @see #getURI(URI) >- */ >- protected URI delegatedGetURI(URI uri) >- { >- return uri; >- } >- >- /** >- * A map that is a {@link URIConverterImpl.URIMap}. >- */ >- protected class URIMapImpl extends DelegatingMap implements URIConverterImpl.URIMap >- { >- /** >- * Creates an isntance. >- */ >- public URIMapImpl() >- { >- } >- >- /** >- * Returns the remapped URI, or the URI itself. >- * This implementation delegates to the containing {@link URIMappingRegistryImpl}. >- * @param uri the URI to remap. >- * @return the remapped URI, or the URI itself. >- */ >- public URI getURI(URI uri) >- { >- return URIMappingRegistryImpl.this.getURI(uri); >- } >- } >- >- /** >- * Returns a map view that implements {@link URIConverterImpl.URIMap}. >- */ >- public Map map() >- { >- if (view == null) >- { >- view = new View(); >- } >- if (view.map == null) >- { >- view.map = new URIMapImpl(); >- } >- >- return view.map; >- } >- >- /** >- * Validates that the key is a URI. >- */ >- protected void validateKey(Object key) >- { >- if (!(key instanceof URI)) >- { >- throw new IllegalArgumentException(); >- } >- } >- >- /** >- * Validates that the value is a URI. >- */ >- protected void validateValue(Object value) >- { >- if (!(value instanceof URI)) >- { >- throw new IllegalArgumentException(); >- } >- } >- >- /** >- * Checks for folder mappings to populate the {@link #prefixMaps prefix maps}. >- */ >- protected void didAdd(Entry entry) >- { >- if (((MappingEntryImpl)entry).isPrefixMapEntry) >- { >- int length = ((URI)entry.getKey()).segmentCount(); >- if (prefixMaps == null) >- { >- prefixMaps = new BasicEList(); >- } >- >- for (int i = prefixMaps.size() - 1; i <= length; ++i) >- { >- prefixMaps.add(new BasicEList()); >- } >- >- ((List)prefixMaps.get(length)).add(entry); >- } >- } >- >- /** >- * Checks for folder mappings to update the {@link #prefixMaps prefix maps}. >- */ >- protected void didModify(Entry entry, Object oldValue) >- { >- didRemove(entry); >- ((MappingEntryImpl)entry).determineEntryType(); >- didAdd(entry); >- } >- >- /** >- * Checks for folder mappings to cleanup the {@link #prefixMaps prefix maps}. >- */ >- protected void didRemove(Entry entry) >- { >- if (((MappingEntryImpl)entry).isPrefixMapEntry) >- { >- int length = ((URI)entry.getKey()).segmentCount(); >- ((List)prefixMaps.get(length)).remove(entry); >- } >- } > >- /** >- * Discards all the {@link #prefixMaps prefix maps}. >- */ >- protected void didClear(BasicEList [] oldEntryData) >- { >- prefixMaps = null; >- } >+public class URIMappingRegistryImpl extends BasicEMap { >+ public static final URIMappingRegistryImpl INSTANCE = new URIMappingRegistryImpl(); > } >Index: src/org/eclipse/emf/ecore/resource/impl/CryptoCipherImpl.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/resource/impl/CryptoCipherImpl.java >diff -N src/org/eclipse/emf/ecore/resource/impl/CryptoCipherImpl.java >--- src/org/eclipse/emf/ecore/resource/impl/CryptoCipherImpl.java 29 Mar 2006 19:02:21 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,91 +0,0 @@ >-package org.eclipse.emf.ecore.resource.impl; >- >-import java.io.InputStream; >-import java.io.OutputStream; >- >-import javax.crypto.Cipher; >-import javax.crypto.CipherInputStream; >-import javax.crypto.CipherOutputStream; >-import javax.crypto.SecretKey; >-import javax.crypto.SecretKeyFactory; >-import javax.crypto.spec.DESKeySpec; >- >-import org.eclipse.emf.ecore.resource.URIConverter; >- >-/** >- * <p>EMF default implementation for the {@link URIConverter.Cipher} interface. >- * This is an example of how this class can be used:<p> >- * <pre>Map options = new HashMap(); >- options.put(Resource.OPTION_CIPHER, >- new CryptoCipherImpl("a very long key indeed")); >- resource.save(options); >- resource.load(options);</pre> >- * >- */ >-public class CryptoCipherImpl implements URIConverter.Cipher >-{ >- public static class LocalCipherOutputStream extends CipherOutputStream >- { >- protected Cipher cipher; >- >- public LocalCipherOutputStream(OutputStream os, Cipher cipher) >- { >- super(os, cipher); >- this.cipher = cipher; >- } >- >- public void finish() throws Exception >- { >- write(cipher.doFinal()); >- flush(); >- } >- } >- >- protected static final String ENCRYPTION_SCHEME = "DES"; >- protected static final String UNICODE_FORMAT = "UTF-8"; >- >- protected String key; >- >- public CryptoCipherImpl() >- { >- this(null); >- } >- >- public CryptoCipherImpl(String key) >- { >- this.key = key; >- } >- >- public OutputStream encrypt(OutputStream outputStream) throws Exception >- { >- Cipher cipher = Cipher.getInstance(ENCRYPTION_SCHEME); >- cipher.init(Cipher.ENCRYPT_MODE, getKey()); >- return new CipherOutputStream(outputStream, cipher); >- } >- >- public void finish(OutputStream outputStream) throws Exception >- { >- if (outputStream instanceof LocalCipherOutputStream) >- { >- ((LocalCipherOutputStream)outputStream).finish(); >- } >- } >- >- public InputStream decrypt(InputStream inputStream) throws Exception >- { >- Cipher cipher = Cipher.getInstance(ENCRYPTION_SCHEME); >- cipher.init(Cipher.DECRYPT_MODE, getKey()); >- return new CipherInputStream(inputStream, cipher); >- } >- >- public void finish(InputStream inputStream) throws Exception >- { >- } >- >- protected SecretKey getKey() throws Exception >- { >- SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ENCRYPTION_SCHEME); >- DESKeySpec keySpec = new DESKeySpec(key.getBytes(UNICODE_FORMAT)); >- return keyFactory.generateSecret(keySpec); >- } >-} >Index: src/org/eclipse/emf/ecore/resource/impl/ResourceSetImpl.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/resource/impl/ResourceSetImpl.java >diff -N src/org/eclipse/emf/ecore/resource/impl/ResourceSetImpl.java >--- src/org/eclipse/emf/ecore/resource/impl/ResourceSetImpl.java 1 May 2006 16:22:30 -0000 1.8 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,582 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2006 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: ResourceSetImpl.java,v 1.8 2006/05/01 16:22:30 marcelop Exp $ >- */ >-package org.eclipse.emf.ecore.resource.impl; >- >- >-import java.io.IOException; >-import java.util.Collections; >-import java.util.HashMap; >-import java.util.Iterator; >-import java.util.List; >-import java.util.ListIterator; >-import java.util.Map; >- >-import org.eclipse.emf.common.notify.AdapterFactory; >-import org.eclipse.emf.common.notify.NotificationChain; >-import org.eclipse.emf.common.notify.impl.NotifierImpl; >-import org.eclipse.emf.common.notify.impl.NotifyingListImpl; >-import org.eclipse.emf.common.util.BasicEList; >-import org.eclipse.emf.common.util.EList; >-import org.eclipse.emf.common.util.TreeIterator; >-import org.eclipse.emf.common.util.URI; >-import org.eclipse.emf.common.util.WrappedException; >-import org.eclipse.emf.ecore.EObject; >-import org.eclipse.emf.ecore.EPackage; >-import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; >-import org.eclipse.emf.ecore.resource.Resource; >-import org.eclipse.emf.ecore.resource.ResourceSet; >-import org.eclipse.emf.ecore.resource.URIConverter; >-import org.eclipse.emf.ecore.util.EcoreUtil; >-import org.eclipse.emf.ecore.util.InternalEList; >- >- >-/** >- * An extensible resource set implementation. >- * <p> >- * The following configuration and control mechanisms are provided: >- * <ul> >- * <li><b>Resolve</b></li> >- * <ul> >- * <li>{@link #delegatedGetResource(URI, boolean)}</li> >- * <li>{@link #getEObject(URI, boolean)}</li> >- * </ul> >- * <li><b>Demand</b></li> >- * <ul> >- * <li>{@link #demandCreateResource(URI)}</li> >- * <li>{@link #demandLoad(Resource)}</li> >- * <li>{@link #demandLoadHelper(Resource)}</li> >- * </ul> >- * </ul> >- * </p> >- */ >-public class ResourceSetImpl extends NotifierImpl implements ResourceSet >-{ >- /** >- * The contained resources. >- * @see #getResources >- */ >- protected EList resources; >- >- /** >- * The registered adapter factories. >- * @see #getAdapterFactories >- */ >- protected EList adapterFactories; >- >- /** >- * The load options. >- * @see #getLoadOptions >- */ >- protected Map loadOptions; >- >- /** >- * The local resource factory registry. >- * @see #getResourceFactoryRegistry >- */ >- protected Resource.Factory.Registry resourceFactoryRegistry; >- >- /** >- * The URI converter. >- * @see #getURIConverter >- */ >- protected URIConverter uriConverter; >- >- /** >- * The local package registry. >- * @see #getPackageRegistry >- */ >- protected EPackage.Registry packageRegistry; >- >- /** >- * A map to cache the resource associated with a specific URI. >- * @see #setURIResourceMap(Map) >- */ >- protected Map uriResourceMap; >- >- /** >- * Creates an empty instance. >- */ >- public ResourceSetImpl() >- { >- } >- >- /** >- * Returns the map used to cache the resource {@link #getResource(URI, boolean) associated} with a specific URI. >- * @return the map used to cache the resource associated with a specific URI. >- * @see #setURIResourceMap >- */ >- public Map getURIResourceMap() >- { >- return uriResourceMap; >- } >- >- /** >- * Sets the map used to cache the resource associated with a specific URI. >- * This cache is only activated if the map is not <code>null</code>. >- * The map will be lazily loaded by the {@link #getResource(URI, boolean) getResource} method. >- * It is up to the client to clear the cache when it becomes invalid, >- * e.g., when the URI of a previously mapped resource is changed. >- * @param uriResourceMap the new map or <code>null</code>. >- * @see #getURIResourceMap >- */ >- public void setURIResourceMap(Map uriResourceMap) >- { >- this.uriResourceMap = uriResourceMap; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public EList getResources() >- { >- if (resources == null) >- { >- resources = new ResourcesEList(); >- } >- return resources; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public TreeIterator getAllContents() >- { >- TreeIterator result = EcoreUtil.getAllContents(Collections.singleton(this)); >- result.next(); >- return result; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public EList getAdapterFactories() >- { >- if (adapterFactories == null) >- { >- adapterFactories = >- new BasicEList() >- { >- protected boolean useEquals() >- { >- return false; >- } >- >- protected boolean isUnique() >- { >- return true; >- } >- >- protected Object [] newData(int capacity) >- { >- return new AdapterFactory [capacity]; >- } >- }; >- } >- return adapterFactories; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public Map getLoadOptions() >- { >- if (loadOptions == null) >- { >- loadOptions = new HashMap(); >- } >- >- return loadOptions; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public EObject getEObject(URI uri, boolean loadOnDemand) >- { >- Resource resource = getResource(uri.trimFragment(), loadOnDemand); >- if (resource != null) >- { >- return resource.getEObject(uri.fragment()); >- } >- else >- { >- return null; >- } >- } >- >- /** >- * Creates a new resource appropriate for the URI. >- * It is called by {@link #getResource(URI, boolean) getResource(URI, boolean)} >- * when a URI that doesn't exist as a resource is demand loaded. >- * This implementation simply calls {@link #createResource(URI) createResource(URI)}. >- * Clients may extend this as appropriate. >- * @param uri the URI of the resource to create. >- * @return a new resource. >- * @see #getResource(URI, boolean) >- */ >- protected Resource demandCreateResource(URI uri) >- { >- return createResource(uri); >- } >- >- /** >- * Loads the given resource. >- * It is called by {@link #demandLoadHelper(Resource) demandLoadHelper(Resource)} >- * to perform a demand load. >- * This implementation simply calls <code>resource.</code>{@link Resource#load(Map) load}({@link #getLoadOptions() getLoadOptions}()). >- * Clients may extend this as appropriate. >- * @param resource a resource that isn't loaded. >- * @exception IOException if there are serious problems loading the resource. >- * @see #getResource(URI, boolean) >- * @see #demandLoadHelper(Resource) >- */ >- protected void demandLoad(Resource resource) throws IOException >- { >- resource.load(getLoadOptions()); >- } >- >- /** >- * Demand loads the given resource using {@link #demandLoad(Resource)} >- * and {@link WrappedException wraps} any {@link IOException} as a runtime exception. >- * It is called by {@link #getResource(URI, boolean) getResource(URI, boolean)} >- * to perform a demand load. >- * @param resource a resource that isn't loaded. >- * @see #demandLoad(Resource) >- */ >- protected void demandLoadHelper(Resource resource) >- { >- try >- { >- demandLoad(resource); >- } >- catch (IOException exception) >- { >- handleDemandLoadException(resource, exception); >- } >- } >- >- /** >- * Handles the exception thrown during demand load >- * by recording it as an error diagnostic >- * and throwing a wrapping runtime exception. >- * @param resource the resource that threw an exception while loading. >- * @param resource the exception thrown from the resource while loading. >- * @see #demandLoadHelper(Resource) >- */ >- protected void handleDemandLoadException(Resource resource, IOException exception) throws RuntimeException >- { >- final String location = resource.getURI() == null ? null : resource.getURI().toString(); >- class DiagnosticWrappedException extends WrappedException implements Resource.Diagnostic >- { >- public DiagnosticWrappedException(Exception exception) >- { >- super(exception); >- } >- >- public String getLocation() >- { >- return location; >- } >- >- public int getColumn() >- { >- return 0; >- } >- >- public int getLine() >- { >- return 0; >- } >- }; >- >- Exception cause = exception instanceof Resource.IOWrappedException ? (Exception)exception.getCause() : exception; >- WrappedException wrappedException = new DiagnosticWrappedException(cause); >- >- if (resource.getErrors().isEmpty()) >- { >- resource.getErrors().add(exception instanceof Resource.Diagnostic ? (Exception)exception : (Exception)wrappedException); >- } >- >- throw wrappedException; >- } >- >- /** >- * Returns a resolved resource available outside of the resource set. >- * It is called by {@link #getResource(URI, boolean) getResource(URI, boolean)} >- * after it has determined that the URI cannot be resolved >- * based on the existing contents of the resource set. >- * This implementation looks up the URI in the {#getPackageRegistry() local} package registry. >- * Clients may extend this as appropriate. >- * @param uri the URI >- * @param loadOnDemand whether demand loading is required. >- */ >- protected Resource delegatedGetResource(URI uri, boolean loadOnDemand) >- { >- EPackage ePackage = getPackageRegistry().getEPackage(uri.toString()); >- return ePackage == null ? null : ePackage.eResource(); >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public Resource getResource(URI uri, boolean loadOnDemand) >- { >- Map map = getURIResourceMap(); >- if (map != null) >- { >- Resource resource = (Resource)map.get(uri); >- if (resource != null) >- { >- if (loadOnDemand && !resource.isLoaded()) >- { >- demandLoadHelper(resource); >- } >- return resource; >- } >- } >- >- URIConverter theURIConverter = getURIConverter(); >- URI normalizedURI = theURIConverter.normalize(uri); >- for (Iterator i = getResources().iterator(); i.hasNext(); ) >- { >- Resource resource = (Resource)i.next(); >- if (theURIConverter.normalize(resource.getURI()).equals(normalizedURI)) >- { >- if (loadOnDemand && !resource.isLoaded()) >- { >- demandLoadHelper(resource); >- } >- >- if (map != null) >- { >- map.put(uri, resource); >- } >- return resource; >- } >- } >- >- Resource delegatedResource = delegatedGetResource(uri, loadOnDemand); >- if (delegatedResource != null) >- { >- if (map != null) >- { >- map.put(uri, delegatedResource); >- } >- return delegatedResource; >- } >- >- if (loadOnDemand) >- { >- Resource resource = demandCreateResource(uri); >- if (resource == null) >- { >- throw new RuntimeException("Cannot create a resource for '" + uri + "'; a registered resource factory is needed"); >- } >- >- demandLoadHelper(resource); >- >- if (map != null) >- { >- map.put(uri, resource); >- } >- return resource; >- } >- >- return null; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public Resource createResource(URI uri) >- { >- Resource.Factory resourceFactory = getResourceFactoryRegistry().getFactory(uri); >- if (resourceFactory != null) >- { >- Resource result = resourceFactory.createResource(uri); >- getResources().add(result); >- return result; >- } >- else >- { >- return null; >- } >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public Resource.Factory.Registry getResourceFactoryRegistry() >- { >- if (resourceFactoryRegistry == null) >- { >- resourceFactoryRegistry = >- new ResourceFactoryRegistryImpl() >- { >- public Resource.Factory delegatedGetFactory(URI uri) >- { >- return Resource.Factory.Registry.INSTANCE.getFactory(uri); >- } >- }; >- } >- return resourceFactoryRegistry; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public void setResourceFactoryRegistry(Resource.Factory.Registry resourceFactoryRegistry) >- { >- this.resourceFactoryRegistry = resourceFactoryRegistry; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public URIConverter getURIConverter() >- { >- if (uriConverter == null) >- { >- uriConverter = new URIConverterImpl(); >- } >- return uriConverter; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public void setURIConverter(URIConverter uriConverter) >- { >- this.uriConverter = uriConverter; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public EPackage.Registry getPackageRegistry() >- { >- if (packageRegistry == null) >- { >- packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); >- } >- return packageRegistry; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public void setPackageRegistry(EPackage.Registry packageRegistry) >- { >- this.packageRegistry = packageRegistry; >- } >- >- >- /** >- * A notifying list implementation for supporting {@link ResourceSet#getResources}. >- */ >- protected class ResourcesEList extends NotifyingListImpl implements InternalEList >- { >- protected boolean isNotificationRequired() >- { >- return ResourceSetImpl.this.eNotificationRequired(); >- } >- >- protected Object [] newData(int capacity) >- { >- return new Resource [capacity]; >- } >- >- public Object getNotifier() >- { >- return ResourceSetImpl.this; >- } >- >- public int getFeatureID() >- { >- return RESOURCE_SET__RESOURCES; >- } >- >- protected boolean useEquals() >- { >- return false; >- } >- >- protected boolean hasInverse() >- { >- return true; >- } >- >- protected boolean isUnique() >- { >- return true; >- } >- >- protected NotificationChain inverseAdd(Object object, NotificationChain notifications) >- { >- Resource.Internal resource = (Resource.Internal)object; >- return resource.basicSetResourceSet(ResourceSetImpl.this, notifications); >- } >- >- protected NotificationChain inverseRemove(Object object, NotificationChain notifications) >- { >- Resource.Internal resource = (Resource.Internal)object; >- Map map = getURIResourceMap(); >- if (map != null) >- { >- for (Iterator i = map.values().iterator(); i.hasNext();) >- { >- if (resource == i.next()) >- { >- i.remove(); >- } >- } >- } >- return resource.basicSetResourceSet(null, notifications); >- } >- >- public Iterator basicIterator() >- { >- return super.basicIterator(); >- } >- >- public ListIterator basicListIterator() >- { >- return super.basicListIterator(); >- } >- >- public ListIterator basicListIterator(int index) >- { >- return super.basicListIterator(index); >- } >- >- public List basicList() >- { >- return super.basicList(); >- } >- } >- >- /** >- * Returns a standard label with the list of resources. >- * @return the string form. >- */ >- public String toString() >- { >- return >- getClass().getName() + '@' + Integer.toHexString(hashCode()) + >- " resources=" + (resources == null ? "[]" : resources.toString()); >- } >-} >Index: src/org/eclipse/emf/ecore/xml/type/XMLTypeFactory.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/xml/type/XMLTypeFactory.java,v >retrieving revision 1.4 >diff -u -r1.4 XMLTypeFactory.java >--- src/org/eclipse/emf/ecore/xml/type/XMLTypeFactory.java 10 Dec 2005 13:33:52 -0000 1.4 >+++ src/org/eclipse/emf/ecore/xml/type/XMLTypeFactory.java 16 Nov 2007 07:20:54 -0000 >@@ -16,8 +16,8 @@ > */ > package org.eclipse.emf.ecore.xml.type; > >-import java.math.BigDecimal; >-import java.math.BigInteger; >+//import java.math.BigDecimal; >+//import java.math.BigInteger; > > import java.util.List; > >@@ -248,25 +248,25 @@ > */ > String convertDateTime(Object instanceValue); > >- /** >- * Returns an instance of data type '<em>Decimal</em>' corresponding the given literal. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param literal a literal of the data type. >- * @return a new instance value of the data type. >- * @generated >- */ >- BigDecimal createDecimal(String literal); >- >- /** >- * Returns a literal representation of an instance of data type '<em>Decimal</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param instanceValue an instance value of the data type. >- * @return a literal representation of the instance value. >- * @generated >- */ >- String convertDecimal(BigDecimal instanceValue); >+// /** >+// * Returns an instance of data type '<em>Decimal</em>' corresponding the given literal. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param literal a literal of the data type. >+// * @return a new instance value of the data type. >+// * @generated >+// */ >+// BigDecimal createDecimal(String literal); >+// >+// /** >+// * Returns a literal representation of an instance of data type '<em>Decimal</em>'. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param instanceValue an instance value of the data type. >+// * @return a literal representation of the instance value. >+// * @generated >+// */ >+// String convertDecimal(BigDecimal instanceValue); > > /** > * Returns an instance of data type '<em>Double</em>' corresponding the given literal. >@@ -648,25 +648,25 @@ > */ > String convertInt(int instanceValue); > >- /** >- * Returns an instance of data type '<em>Integer</em>' corresponding the given literal. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param literal a literal of the data type. >- * @return a new instance value of the data type. >- * @generated >- */ >- BigInteger createInteger(String literal); >- >- /** >- * Returns a literal representation of an instance of data type '<em>Integer</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param instanceValue an instance value of the data type. >- * @return a literal representation of the instance value. >- * @generated >- */ >- String convertInteger(BigInteger instanceValue); >+// /** >+// * Returns an instance of data type '<em>Integer</em>' corresponding the given literal. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param literal a literal of the data type. >+// * @return a new instance value of the data type. >+// * @generated >+// */ >+// BigInteger createInteger(String literal); >+// >+// /** >+// * Returns a literal representation of an instance of data type '<em>Integer</em>'. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param instanceValue an instance value of the data type. >+// * @return a literal representation of the instance value. >+// * @generated >+// */ >+// String convertInteger(BigInteger instanceValue); > > /** > * Returns an instance of data type '<em>Int Object</em>' corresponding the given literal. >@@ -788,25 +788,25 @@ > */ > String convertNCName(String instanceValue); > >- /** >- * Returns an instance of data type '<em>Negative Integer</em>' corresponding the given literal. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param literal a literal of the data type. >- * @return a new instance value of the data type. >- * @generated >- */ >- BigInteger createNegativeInteger(String literal); >- >- /** >- * Returns a literal representation of an instance of data type '<em>Negative Integer</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param instanceValue an instance value of the data type. >- * @return a literal representation of the instance value. >- * @generated >- */ >- String convertNegativeInteger(BigInteger instanceValue); >+// /** >+// * Returns an instance of data type '<em>Negative Integer</em>' corresponding the given literal. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param literal a literal of the data type. >+// * @return a new instance value of the data type. >+// * @generated >+// */ >+// BigInteger createNegativeInteger(String literal); >+// >+// /** >+// * Returns a literal representation of an instance of data type '<em>Negative Integer</em>'. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param instanceValue an instance value of the data type. >+// * @return a literal representation of the instance value. >+// * @generated >+// */ >+// String convertNegativeInteger(BigInteger instanceValue); > > /** > * Returns an instance of data type '<em>NMTOKEN</em>' corresponding the given literal. >@@ -868,45 +868,45 @@ > */ > String convertNMTOKENSBase(List instanceValue); > >- /** >- * Returns an instance of data type '<em>Non Negative Integer</em>' corresponding the given literal. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param literal a literal of the data type. >- * @return a new instance value of the data type. >- * @generated >- */ >- BigInteger createNonNegativeInteger(String literal); >- >- /** >- * Returns a literal representation of an instance of data type '<em>Non Negative Integer</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param instanceValue an instance value of the data type. >- * @return a literal representation of the instance value. >- * @generated >- */ >- String convertNonNegativeInteger(BigInteger instanceValue); >- >- /** >- * Returns an instance of data type '<em>Non Positive Integer</em>' corresponding the given literal. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param literal a literal of the data type. >- * @return a new instance value of the data type. >- * @generated >- */ >- BigInteger createNonPositiveInteger(String literal); >- >- /** >- * Returns a literal representation of an instance of data type '<em>Non Positive Integer</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param instanceValue an instance value of the data type. >- * @return a literal representation of the instance value. >- * @generated >- */ >- String convertNonPositiveInteger(BigInteger instanceValue); >+// /** >+// * Returns an instance of data type '<em>Non Negative Integer</em>' corresponding the given literal. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param literal a literal of the data type. >+// * @return a new instance value of the data type. >+// * @generated >+// */ >+// BigInteger createNonNegativeInteger(String literal); >+// >+// /** >+// * Returns a literal representation of an instance of data type '<em>Non Negative Integer</em>'. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param instanceValue an instance value of the data type. >+// * @return a literal representation of the instance value. >+// * @generated >+// */ >+// String convertNonNegativeInteger(BigInteger instanceValue); >+// >+// /** >+// * Returns an instance of data type '<em>Non Positive Integer</em>' corresponding the given literal. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param literal a literal of the data type. >+// * @return a new instance value of the data type. >+// * @generated >+// */ >+// BigInteger createNonPositiveInteger(String literal); >+// >+// /** >+// * Returns a literal representation of an instance of data type '<em>Non Positive Integer</em>'. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param instanceValue an instance value of the data type. >+// * @return a literal representation of the instance value. >+// * @generated >+// */ >+// String convertNonPositiveInteger(BigInteger instanceValue); > > /** > * Returns an instance of data type '<em>Normalized String</em>' corresponding the given literal. >@@ -948,25 +948,25 @@ > */ > String convertNOTATION(Object instanceValue); > >- /** >- * Returns an instance of data type '<em>Positive Integer</em>' corresponding the given literal. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param literal a literal of the data type. >- * @return a new instance value of the data type. >- * @generated >- */ >- BigInteger createPositiveInteger(String literal); >- >- /** >- * Returns a literal representation of an instance of data type '<em>Positive Integer</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param instanceValue an instance value of the data type. >- * @return a literal representation of the instance value. >- * @generated >- */ >- String convertPositiveInteger(BigInteger instanceValue); >+// /** >+// * Returns an instance of data type '<em>Positive Integer</em>' corresponding the given literal. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param literal a literal of the data type. >+// * @return a new instance value of the data type. >+// * @generated >+// */ >+// BigInteger createPositiveInteger(String literal); >+// >+// /** >+// * Returns a literal representation of an instance of data type '<em>Positive Integer</em>'. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param instanceValue an instance value of the data type. >+// * @return a literal representation of the instance value. >+// * @generated >+// */ >+// String convertPositiveInteger(BigInteger instanceValue); > > /** > * Returns an instance of data type '<em>QName</em>' corresponding the given literal. >@@ -1168,25 +1168,25 @@ > */ > String convertUnsignedIntObject(Long instanceValue); > >- /** >- * Returns an instance of data type '<em>Unsigned Long</em>' corresponding the given literal. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param literal a literal of the data type. >- * @return a new instance value of the data type. >- * @generated >- */ >- BigInteger createUnsignedLong(String literal); >- >- /** >- * Returns a literal representation of an instance of data type '<em>Unsigned Long</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param instanceValue an instance value of the data type. >- * @return a literal representation of the instance value. >- * @generated >- */ >- String convertUnsignedLong(BigInteger instanceValue); >+// /** >+// * Returns an instance of data type '<em>Unsigned Long</em>' corresponding the given literal. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param literal a literal of the data type. >+// * @return a new instance value of the data type. >+// * @generated >+// */ >+// BigInteger createUnsignedLong(String literal); >+// >+// /** >+// * Returns a literal representation of an instance of data type '<em>Unsigned Long</em>'. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @param instanceValue an instance value of the data type. >+// * @return a literal representation of the instance value. >+// * @generated >+// */ >+// String convertUnsignedLong(BigInteger instanceValue); > > /** > * Returns an instance of data type '<em>Unsigned Short</em>' corresponding the given literal. >Index: src/org/eclipse/emf/ecore/xml/type/InvalidDatatypeValueException.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/type/InvalidDatatypeValueException.java >diff -N src/org/eclipse/emf/ecore/xml/type/InvalidDatatypeValueException.java >--- src/org/eclipse/emf/ecore/xml/type/InvalidDatatypeValueException.java 8 Jun 2005 06:20:10 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,28 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: InvalidDatatypeValueException.java,v 1.2 2005/06/08 06:20:10 nickb Exp $ >- */ >-package org.eclipse.emf.ecore.xml.type; >- >-/** >- * Datatype exception for invalid values. >- */ >-public class InvalidDatatypeValueException extends RuntimeException >-{ >- public InvalidDatatypeValueException(String reason) >- { >- super(reason); >- } >-} >\ No newline at end of file >Index: src/org/eclipse/emf/ecore/xml/type/internal/XMLCalendar.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/type/internal/XMLCalendar.java >diff -N src/org/eclipse/emf/ecore/xml/type/internal/XMLCalendar.java >--- src/org/eclipse/emf/ecore/xml/type/internal/XMLCalendar.java 23 Feb 2007 22:26:38 -0000 1.7.2.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,1426 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2004-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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLCalendar.java,v 1.7.2.1 2007/02/23 22:26:38 emerks Exp $ >- * >- * --------------------------------------------------------------------- >- * >- * The Apache Software License, Version 1.1 >- * >- * >- * Copyright (c) 1999-2004 The Apache Software Foundation. All rights >- * reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in >- * the documentation and/or other materials provided with the >- * distribution. >- * >- * 3. The end-user documentation included with the redistribution, >- * if any, must include the following acknowledgment: >- * "This product includes software developed by the >- * Apache Software Foundation (http://www.apache.org/)." >- * Alternately, this acknowledgment may appear in the software itself, >- * if and wherever such third-party acknowledgments normally appear. >- * >- * 4. The names "Xerces" and "Apache Software Foundation" must >- * not be used to endorse or promote products derived from this >- * software without prior written permission. For written >- * permission, please contact apache@apache.org. >- * >- * 5. Products derived from this software may not be called "Apache", >- * nor may "Apache" appear in their name, without prior written >- * permission of the Apache Software Foundation. >- * >- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED >- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES >- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR >- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF >- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, >- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT >- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >- * SUCH DAMAGE. >- * ==================================================================== >- * >- * This software consists of voluntary contributions made by many >- * individuals on behalf of the Apache Software Foundation and was >- * originally based on software copyright (c) 1999-2003, International >- * Business Machines, Inc., http://www.apache.org. For more >- * information on the Apache Software Foundation, please see >- * <http://www.apache.org/>. >- */ >- >-package org.eclipse.emf.ecore.xml.type.internal; >- >- >-import java.text.DateFormat; >-import java.text.ParseException; >-import java.text.SimpleDateFormat; >-import java.util.Date; >-import java.util.TimeZone; >- >-import org.eclipse.emf.common.util.WrappedException; >-import org.eclipse.emf.ecore.xml.type.InvalidDatatypeValueException; >-import org.eclipse.emf.ecore.xml.type.internal.DataValue.TypeValidator; >- >-/** >- * Representation for the <a href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/">W3C XML Schema 1.0</a> >- * dateTime, time, date, gYearMonth, gYear, gMonthDay, gDay, gMonth datatypes. >- * >- * NOTE: this class is for internal use only. >- * Later this class will be replaced by JAXP 1.3 javax.xml.datatype.XMLGregorianCalendar class. >- * This class is based on Apache Xerces2 2.6.2 parser implementation of date/time validation. >- */ >-public final class XMLCalendar >-{ >- public final static short DATETIME = 0; >- >- public final static short TIME = 1; >- >- public final static short DATE = 2; >- >- public final static short GYEARMONTH = 3; >- >- public final static short GYEAR = 4; >- >- public final static short GMONTHDAY = 5; >- >- public final static short GDAY = 6; >- >- public final static short GMONTH = 7; >- >- public final static int EQUALS = 0; >- public final static int LESS_THAN = -1; >- public final static int GREATER_THAN = 1; >- public final static int INDETERMINATE = 2; >- >- >- //define shared variables for date/time >- >- //define constants >- protected final static int CY = 0, M = 1, D = 2, h = 3, m = 4, s = 5, ms = 6, msp = 7, utc = 8, hh = 0, mm = 1; >- >- //size for all objects must have the same fields: >- //CCYY, MM, DD, h, m, s, ms + timeZone >- protected final static int TOTAL_SIZE = 9; >- >- //size without time zone: ---09 >- private final static int DAY_SIZE = 5; >- >- //size without time zone: --MM-DD >- private final static int MONTHDAY_SIZE = 7; >- >- //define constants to be used in assigning default values for >- //all date/time excluding duration >- protected final static int YEAR = 2000; >- >- protected final static int MONTH = 01; >- >- protected final static int DAY = 15; >- >- private int[] dateValue; >- >- final short dataType; >- >- private Date date; >- >- protected static final DateFormat [] EDATE_FORMATS = >- { >- new SafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"), >- new SafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"), >- new SafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'S"), >- new SafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'S'Z'"), >- new SafeSimpleDateFormat("yyyy-MM-dd'Z'"), >- new SafeSimpleDateFormat("yyyy-MM-dd") >- }; >- >- { >- EDATE_FORMATS[0].setTimeZone(TimeZone.getTimeZone("GMT")); >- EDATE_FORMATS[3].setTimeZone(TimeZone.getTimeZone("GMT")); >- } >- >- public XMLCalendar(String value, short datatype) >- { >- if (value == null || value.length() == 0) >- { >- throw new InvalidDatatypeValueException("Incomplete value"); >- } >- >- this.dataType = datatype; >- switch (dataType) >- { >- case DATETIME: >- { >- this.dateValue = parseDateTime(value); >- break; >- } >- case TIME: >- { >- this.dateValue = parseTime(value); >- break; >- } >- case DATE: >- { >- this.dateValue = parseDate(value); >- break; >- } >- case GYEAR: >- { >- this.dateValue = parseYear(value); >- break; >- } >- case GYEARMONTH: >- { >- this.dateValue = parseYearMonth(value); >- break; >- } >- case GMONTHDAY: >- { >- this.dateValue = parseMonthDay(value); >- break; >- } >- case GMONTH: >- { >- this.dateValue = parseMonth(value); >- break; >- } >- case GDAY: >- { >- this.dateValue = parseDay(value); >- break; >- } >- default: >- throw new IllegalArgumentException("Illegal datatype value"); >- } >- } >- >- public XMLCalendar(Date date, short dataType) >- { >- this.date = date; >- this.dataType = dataType; >- } >- >- public boolean equals(Object obj) >- { >- if (!(obj instanceof XMLCalendar)) >- { >- return false; >- } >- >- XMLCalendar xmlCalendarObj = (XMLCalendar)obj; >- if (dataType != xmlCalendarObj.dataType) >- { >- return false; >- } >- >- return compare(this, (XMLCalendar)obj) == EQUALS; >- } >- >- public int hashCode() >- { >- int hashCode = dataType; >- int [] dateValue = getDateValue(); >- for (int i=0;i<TOTAL_SIZE;i++) >- { >- hashCode^=dateValue[i]; >- } >- return hashCode; >- } >- >- public String toString() >- { >- switch (dataType) >- { >- case DATETIME: return dateTimeToString(); >- case TIME: return timeToString(); >- case DATE: return dateToString(); >- case GYEAR: return yearToString(); >- case GYEARMONTH: return yearMonthToString(); >- case GMONTHDAY: return monthDayToString(); >- case GMONTH: return monthToString(); >- case GDAY: return dayToString(); >- } >- return null; >- } >- >- // the parameters are in compiled form (from getActualValue) >- public static int compare(XMLCalendar value1, XMLCalendar value2) >- { >- return (value1.dataType != value2.dataType) ? INDETERMINATE : compareDates(value1.getDateValue(), value2.getDateValue(), true); >- }//compare() >- >- protected int[] getDateValue() >- { >- if (dateValue == null) >- { >- dateValue = parseDateTime(XMLCalendar.EDATE_FORMATS[0].format(date)); >- } >- return dateValue; >- } >- >- public Date getDate() >- { >- if (date == null) >- { >- try >- { >- if (dataType == XMLCalendar.DATETIME) >- { >- try >- { >- date = XMLCalendar.EDATE_FORMATS[0].parse(dateTimeToString()); >- } >- catch (Exception e) >- { >- try >- { >- date = XMLCalendar.EDATE_FORMATS[1].parse(dateTimeToString()); >- } >- catch (Exception e2) >- { >- try >- { >- date = XMLCalendar.EDATE_FORMATS[2].parse(dateTimeToString()); >- } >- catch (Exception e3) >- { >- date = XMLCalendar.EDATE_FORMATS[3].parse(dateTimeToString()); >- } >- } >- } >- } >- else if (dataType == XMLCalendar.DATE) >- { >- try >- { >- date = XMLCalendar.EDATE_FORMATS[4].parse(dateToString()); >- } >- catch (Exception e) >- { >- date = XMLCalendar.EDATE_FORMATS[5].parse(dateToString()); >- } >- } >- } >- catch (Exception e) >- { >- throw new WrappedException(e); >- } >- } >- return date; >- } >- >- /** >- * Compare algorithm described in dateDime (3.2.7). >- * Duration datatype overwrites this method >- * >- * @param date1 normalized date representation of the first value >- * @param date2 normalized date representation of the second value >- * @param strict >- * @return less, greater, less_equal, greater_equal, equal >- */ >- private static int compareDates(int[] date1, int[] date2, boolean strict) >- { >- if (date1[utc] == date2[utc]) >- { >- return compareOrder(date1, date2); >- } >- short c1, c2; >- >- int[] tempDate = new int [TOTAL_SIZE]; >- int[] timeZone = new int [2]; >- >- if (date1[utc] == 'Z') >- { >- >- //compare date1<=date1<=(date2 with time zone -14) >- // >- cloneDate(date2, tempDate); //clones date1 value to global temporary storage: fTempDate >- timeZone[hh] = 14; >- timeZone[mm] = 0; >- tempDate[utc] = '+'; >- normalize(tempDate, timeZone); >- c1 = compareOrder(date1, tempDate); >- if (c1 == TypeValidator.LESS_THAN) >- return c1; >- >- //compare date1>=(date2 with time zone +14) >- // >- cloneDate(date2, tempDate); //clones date1 value to global temporary storage: tempDate >- timeZone[hh] = 14; >- timeZone[mm] = 0; >- tempDate[utc] = '-'; >- normalize(tempDate, timeZone); >- c2 = compareOrder(date1, tempDate); >- if (c2 == TypeValidator.GREATER_THAN) >- return c2; >- >- return TypeValidator.INDETERMINATE; >- } >- else if (date2[utc] == 'Z') >- { >- >- //compare (date1 with time zone -14)<=date2 >- // >- cloneDate(date1, tempDate); //clones date1 value to global temporary storage: tempDate >- timeZone[hh] = 14; >- timeZone[mm] = 0; >- tempDate[utc] = '-'; >- >- normalize(tempDate, timeZone); >- c1 = compareOrder(tempDate, date2); >- >- if (c1 == TypeValidator.LESS_THAN) >- return c1; >- >- //compare (date1 with time zone +14)<=date2 >- // >- cloneDate(date1, tempDate); //clones date1 value to global temporary storage: tempDate >- timeZone[hh] = 14; >- timeZone[mm] = 0; >- tempDate[utc] = '+'; >- normalize(tempDate, timeZone); >- c2 = compareOrder(tempDate, date2); >- >- if (c2 == TypeValidator.GREATER_THAN) >- return c2; >- >- return TypeValidator.INDETERMINATE; >- } >- return TypeValidator.INDETERMINATE; >- >- } >- >- /** >- * Given normalized values, determines order-relation >- * between give date/time objects. >- * >- * @param date1 date/time object >- * @param date2 date/time object >- * @return 0 if date1 and date2 are equal, a value less than 0 if date1 is less than date2, a value greater than 0 if date1 is greater than date2 >- */ >- protected static short compareOrder(int[] date1, int[] date2) >- { >- >- for (int i = 0; i < ms; i++) >- { >- if (date1[i] < date2[i]) >- { >- return -1; >- } >- else if (date1[i] > date2[i]) >- { >- return 1; >- } >- } >- >- double milliSeconds1 = date1[ms]; >- for (int i = 0; i < date1[msp]; ++i) >- { >- milliSeconds1 /= 10.0; >- } >- double milliSeconds2 = date2[ms]; >- for (int i = 0; i < date2[msp]; ++i) >- { >- milliSeconds2 /= 10.0; >- } >- return milliSeconds1 < milliSeconds2 ? (short)-1 : milliSeconds1 > milliSeconds2 ? (short)1 : 0; >- } >- >- /** >- * Parses time hh:mm:ss.sss and time zone if any >- */ >- protected static void getTime(String buffer, int start, int end, int[] data, int[] timeZone) >- { >- >- int stop = start + 2; >- >- //get hours (hh) >- data[h] = parseInt(buffer, start, stop); >- >- //get minutes (mm) >- >- if (buffer.charAt(stop++) != ':') >- { >- throw new InvalidDatatypeValueException("Error in parsing time zone"); >- } >- start = stop; >- stop = stop + 2; >- data[m] = parseInt(buffer, start, stop); >- >- //get seconds (ss) >- if (buffer.charAt(stop++) != ':') >- { >- throw new InvalidDatatypeValueException("Error in parsing time zone"); >- } >- start = stop; >- stop = stop + 2; >- data[s] = parseInt(buffer, start, stop); >- >- if (stop == end) >- return; >- >- //get miliseconds (ms) >- start = stop; >- int milisec = buffer.charAt(start) == '.' ? start : -1; >- >- //find UTC sign if any >- int sign = findUTCSign(buffer, start, end); >- >- //parse miliseconds >- if (milisec != -1) >- { >- // The end of millisecond part is between . and >- // either the end of the UTC sign >- start = sign < 0 ? end : sign; >- data[ms] = parseInt(buffer, milisec + 1, start); >- data[msp] = start - milisec - 1; >- } >- >- //parse UTC time zone (hh:mm) >- if (sign > 0) >- { >- if (start != sign) >- throw new InvalidDatatypeValueException("Error in parsing time zone"); >- getTimeZone(buffer, data, sign, end, timeZone); >- } >- else if (start != end) >- { >- throw new InvalidDatatypeValueException("Error in parsing time zone"); >- } >- } >- >- /** >- * Parses date CCYY-MM-DD >- * >- * @param start >- * @param end >- * @param date >- */ >- protected static int getDate(String buffer, int start, int end, int[] date) >- { >- >- start = getYearMonth(buffer, start, end, date); >- >- if (buffer.charAt(start++) != '-') >- { >- throw new InvalidDatatypeValueException("CCYY-MM must be followed by '-' sign"); >- } >- int stop = start + 2; >- date[D] = parseInt(buffer, start, stop); >- return stop; >- } >- >- /** >- * Parses date CCYY-MM >- * >- * @param start >- * @param end >- * @param date >- */ >- protected static int getYearMonth(String buffer, int start, int end, int[] date) >- { >- >- if (buffer.charAt(0) == '-') >- { >- // REVISIT: date starts with preceding '-' sign >- // do we have to do anything with it? >- // >- start++; >- } >- int i = indexOf(buffer, start, end, '-'); >- if (i == -1) >- throw new InvalidDatatypeValueException("Year separator is missing or misplaced"); >- int length = i - start; >- if (length < 4) >- { >- throw new InvalidDatatypeValueException("Year must have 'CCYY' format"); >- } >- else if (length > 4 && buffer.charAt(start) == '0') >- { >- throw new InvalidDatatypeValueException( >- "Leading zeros are required if the year value would otherwise have fewer than four digits; otherwise they are forbidden"); >- } >- date[CY] = parseIntYear(buffer, i); >- if (buffer.charAt(i) != '-') >- { >- throw new InvalidDatatypeValueException("CCYY must be followed by '-' sign"); >- } >- start = ++i; >- i = start + 2; >- date[M] = parseInt(buffer, start, i); >- return i; //fStart points right after the MONTH >- } >- >- /** >- * Shared code from Date and YearMonth datatypes. >- * Finds if time zone sign is present >- * >- * @param end >- * @param date >- */ >- protected static void parseTimeZone(String buffer, int start, int end, int[] date, int[] timeZone) >- { >- >- //fStart points right after the date >- >- if (start < end) >- { >- int sign = findUTCSign(buffer, start, end); >- if (sign < 0) >- { >- throw new InvalidDatatypeValueException("Error in month parsing"); >- } >- else >- { >- getTimeZone(buffer, date, sign, end, timeZone); >- } >- } >- } >- >- /** >- * Parses time zone: 'Z' or {+,-} followed by hh:mm >- * >- * @param data >- * @param sign >- */ >- protected static void getTimeZone(String buffer, int[] data, int sign, int end, int[] timeZone) >- { >- data[utc] = buffer.charAt(sign); >- >- if (buffer.charAt(sign) == 'Z') >- { >- if (end > (++sign)) >- { >- throw new InvalidDatatypeValueException("Error in parsing time zone"); >- } >- return; >- } >- if (sign <= (end - 6)) >- { >- >- //parse [hh] >- int stop = ++sign + 2; >- timeZone[hh] = parseInt(buffer, sign, stop); >- if (buffer.charAt(stop++) != ':') >- { >- throw new InvalidDatatypeValueException("Error in parsing time zone"); >- } >- >- //parse [ss] >- timeZone[mm] = parseInt(buffer, stop, stop + 2); >- >- if (stop + 2 != end) >- { >- throw new InvalidDatatypeValueException("Error in parsing time zone"); >- } >- >- } >- else >- { >- throw new InvalidDatatypeValueException("Error in parsing time zone"); >- } >- } >- >- /** >- * Computes index of given char within StringBuffer >- * >- * @param start >- * @param end >- * @param ch character to look for in StringBuffer >- * @return index of ch within StringBuffer >- */ >- protected static int indexOf(String buffer, int start, int end, char ch) >- { >- for (int i = start; i < end; i++) >- { >- if (buffer.charAt(i) == ch) >- { >- return i; >- } >- } >- return -1; >- } >- >- /** >- * Validates given date/time object accoring to W3C PR Schema >- * [D.1 ISO 8601 Conventions] >- * >- * @param data >- */ >- protected static void validateDateTime(int[] data, int[] timeZone) >- { >- >- //REVISIT: should we throw an exception for not valid dates >- // or reporting an error message should be sufficient? >- if (data[CY] == 0) >- { >- throw new InvalidDatatypeValueException("The year \"0000\" is an illegal year value"); >- >- } >- >- if (data[M] < 1 || data[M] > 12) >- { >- throw new InvalidDatatypeValueException("The month must have values 1 to 12"); >- >- } >- >- //validate days >- if (data[D] > maxDayInMonthFor(data[CY], data[M]) || data[D] < 1) >- { >- throw new InvalidDatatypeValueException("The day must have values 1 to 31"); >- } >- >- //validate hours >- if (data[h] > 23 || data[h] < 0) >- { >- if (data[h] == 24 && data[m] == 0 && data[s] == 0 && data[ms] == 0) >- { >- data[h] = 0; >- if (++data[D] > maxDayInMonthFor(data[CY], data[M])) >- { >- data[D] = 1; >- if (++data[M] > 12) >- { >- data[M] = 1; >- if (++data[CY] == 0) >- data[CY] = 1; >- } >- } >- } >- else >- { >- throw new InvalidDatatypeValueException("Hour must have values 0-23, unless 24:00:00"); >- } >- } >- >- //validate >- if (data[m] > 59 || data[m] < 0) >- { >- throw new InvalidDatatypeValueException("Minute must have values 0-59"); >- } >- >- //validate >- if (data[s] > 60 || data[s] < 0) >- { >- throw new InvalidDatatypeValueException("Second must have values 0-60"); >- >- } >- >- //validate >- if (timeZone[hh] > 14 || timeZone[hh] < -14) >- { >- throw new InvalidDatatypeValueException("Time zone should have range -14..+14"); >- } >- >- //validate >- if (timeZone[mm] > 59 || timeZone[mm] < -59) >- { >- throw new InvalidDatatypeValueException("Minute must have values 0-59"); >- } >- } >- >- /** >- * Return index of UTC char: 'Z', '+', '-' >- * >- * @param start >- * @param end >- * @return index of the UTC character that was found >- */ >- private static int findUTCSign(String buffer, int start, int end) >- { >- int c; >- for (int i = start; i < end; i++) >- { >- c = buffer.charAt(i); >- if (c == 'Z' || c == '+' || c == '-') >- { >- return i; >- } >- >- } >- return -1; >- } >- >- /** >- * Given start and end position, parses string value >- * >- * @param buffer string to parse >- * @param start Start position >- * @param end end position >- * @return return integer representation of characters >- */ >- protected static int parseInt(String buffer, int start, int end) throws NumberFormatException >- { >- //REVISIT: more testing on this parsing needs to be done. >- int radix = 10; >- int result = 0; >- int digit = 0; >- int limit = -Integer.MAX_VALUE; >- int multmin = limit / radix; >- int i = start; >- do >- { >- digit = TypeValidator.getDigit(buffer.charAt(i)); >- if (digit < 0) >- throw new NumberFormatException("'" + buffer.toString() + "' has wrong format"); >- if (result < multmin) >- throw new NumberFormatException("'" + buffer.toString() + "' has wrong format"); >- result *= radix; >- if (result < limit + digit) >- throw new NumberFormatException("'" + buffer.toString() + "' has wrong format"); >- result -= digit; >- >- } >- while (++i < end); >- return -result; >- } >- >- // parse Year differently to support negative value. >- protected static int parseIntYear(String buffer, int end) >- { >- int radix = 10; >- int result = 0; >- boolean negative = false; >- int i = 0; >- int limit; >- int multmin; >- int digit = 0; >- >- if (buffer.charAt(0) == '-') >- { >- negative = true; >- limit = Integer.MIN_VALUE; >- i++; >- >- } >- else >- { >- limit = -Integer.MAX_VALUE; >- } >- multmin = limit / radix; >- while (i < end) >- { >- digit = TypeValidator.getDigit(buffer.charAt(i++)); >- if (digit < 0) >- throw new NumberFormatException("'" + buffer.toString() + "' has wrong format"); >- if (result < multmin) >- throw new NumberFormatException("'" + buffer.toString() + "' has wrong format"); >- result *= radix; >- if (result < limit + digit) >- throw new NumberFormatException("'" + buffer.toString() + "' has wrong format"); >- result -= digit; >- } >- >- if (negative) >- { >- if (i > 1) >- return result; >- else >- throw new NumberFormatException("'" + buffer.toString() + "' has wrong format"); >- } >- return -result; >- >- } >- >- /** >- * If timezone present - normalize dateTime [E Adding durations to dateTimes] >- * >- * @param date CCYY-MM-DDThh:mm:ss+03 >- * @return CCYY-MM-DDThh:mm:ssZ >- */ >- protected static void normalize(int[] date, int[] timeZone) >- { >- >- // REVISIT: we have common code in addDuration() for durations >- // should consider reorganizing it. >- // >- >- //add minutes (from time zone) >- int negate = 1; >- if (date[utc] == '+') >- { >- negate = -1; >- } >- int temp = date[m] + negate * timeZone[mm]; >- int carry = fQuotient(temp, 60); >- date[m] = mod(temp, 60, carry); >- >- //add hours >- temp = date[h] + negate * timeZone[hh] + carry; >- carry = fQuotient(temp, 24); >- date[h] = mod(temp, 24, carry); >- >- date[D] = date[D] + carry; >- >- while (true) >- { >- temp = maxDayInMonthFor(date[CY], date[M]); >- if (date[D] < 1) >- { >- date[D] = date[D] + maxDayInMonthFor(date[CY], date[M] - 1); >- carry = -1; >- } >- else if (date[D] > temp) >- { >- date[D] = date[D] - temp; >- carry = 1; >- } >- else >- { >- break; >- } >- temp = date[M] + carry; >- date[M] = modulo(temp, 1, 13); >- date[CY] = date[CY] + fQuotient(temp, 1, 13); >- } >- >- // Drop trailing zeros. >- while (date[msp] != 0) >- { >- int milliSeconds = date[ms]; >- if (milliSeconds % 10 != 0) >- { >- break; >- } >- date[ms] = date[ms] / 10; >- --date[msp]; >- } >- date[utc] = 'Z'; >- } >- >- /** >- * Resets object representation of date/time >- * >- * @param data date/time object >- */ >- protected static void resetDateObj(int[] data) >- { >- for (int i = 0; i < TOTAL_SIZE; i++) >- { >- data[i] = 0; >- } >- } >- >- /** >- * Given {year,month} computes maximum >- * number of days for given month >- * >- * @param year >- * @param month >- * @return integer containg the number of days in a given month >- */ >- protected static int maxDayInMonthFor(int year, int month) >- { >- //validate days >- if (month == 4 || month == 6 || month == 9 || month == 11) >- { >- return 30; >- } >- else if (month == 2) >- { >- if (isLeapYear(year)) >- { >- return 29; >- } >- else >- { >- return 28; >- } >- } >- else >- { >- return 31; >- } >- } >- >- private static boolean isLeapYear(int year) >- { >- >- //REVISIT: should we take care about Julian calendar? >- return ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))); >- } >- >- // >- // help function described in W3C PR Schema [E Adding durations to dateTimes] >- // >- protected static int mod(int a, int b, int quotient) >- { >- //modulo(a, b) = a - fQuotient(a,b)*b >- return (a - quotient * b); >- } >- >- // >- // help function described in W3C PR Schema [E Adding durations to dateTimes] >- // >- protected static int fQuotient(int a, int b) >- { >- >- //fQuotient(a, b) = the greatest integer less than or equal to a/b >- return (int)Math.floor((float)a / b); >- } >- >- // >- // help function described in W3C PR Schema [E Adding durations to dateTimes] >- // >- protected static int modulo(int temp, int low, int high) >- { >- //modulo(a - low, high - low) + low >- int a = temp - low; >- int b = high - low; >- return (mod(a, b, fQuotient(a, b)) + low); >- } >- >- // >- // help function described in W3C PR Schema [E Adding durations to dateTimes] >- // >- protected static int fQuotient(int temp, int low, int high) >- { >- //fQuotient(a - low, high - low) >- return fQuotient(temp - low, high - low); >- } >- >- private String dateTimeToString() >- { >- int[] dateValue = getDateValue(); >- StringBuffer message = new StringBuffer(25); >- append(message, dateValue[CY], 4); >- message.append('-'); >- append(message, dateValue[M], 2); >- message.append('-'); >- append(message, dateValue[D], 2); >- message.append('T'); >- append(message, dateValue[h], 2); >- message.append(':'); >- append(message, dateValue[m], 2); >- message.append(':'); >- append(message, dateValue[s], 2); >- if (dateValue[ms] > 0) >- { >- message.append('.'); >- String value = Integer.toString(dateValue[ms]); >- for (int i = value.length(), limit = dateValue[msp]; i < limit; ++i) >- { >- message.append('0'); >- } >- message.append(value); >- } >- append(message, (char)dateValue[utc], 0); >- return message.toString(); >- } >- >- private String dateToString() >- { >- StringBuffer message = new StringBuffer(25); >- int[] dateValue = getDateValue(); >- append(message, dateValue[CY], 4); >- message.append('-'); >- append(message, dateValue[M], 2); >- message.append('-'); >- append(message, dateValue[D], 2); >- append(message, (char)dateValue[utc], 0); >- return message.toString(); >- } >- >- private String dayToString() >- { >- StringBuffer message = new StringBuffer(6); >- message.append('-'); >- message.append('-'); >- message.append('-'); >- append(message, dateValue[D], 2); >- append(message, (char)dateValue[utc], 0); >- return message.toString(); >- } >- >- private String monthDayToString() >- { >- StringBuffer message = new StringBuffer(8); >- message.append('-'); >- message.append('-'); >- append(message, dateValue[M], 2); >- message.append('-'); >- append(message, dateValue[D], 2); >- append(message, (char)dateValue[utc], 0); >- return message.toString(); >- } >- >- private String monthToString() >- { >- StringBuffer message = new StringBuffer(5); >- message.append('-'); >- message.append('-'); >- append(message, dateValue[M], 2); >- append(message, (char)dateValue[utc], 0); >- return message.toString(); >- } >- >- private String timeToString() >- { >- StringBuffer message = new StringBuffer(16); >- append(message, dateValue[h], 2); >- message.append(':'); >- append(message, dateValue[m], 2); >- message.append(':'); >- append(message, dateValue[s], 2); >- if (dateValue[ms] > 0) >- { >- message.append('.'); >- String value = Integer.toString(dateValue[ms]); >- for (int i = value.length(), limit = dateValue[msp]; i < limit; ++i) >- { >- message.append('0'); >- } >- message.append(value); >- } >- append(message, (char)dateValue[utc], 0); >- return message.toString(); >- } >- >- private String yearToString() >- { >- StringBuffer message = new StringBuffer(5); >- append(message, dateValue[CY], 4); >- append(message, (char)dateValue[utc], 0); >- return message.toString(); >- } >- >- private String yearMonthToString() >- { >- StringBuffer message = new StringBuffer(25); >- append(message, dateValue[CY], 4); >- message.append('-'); >- append(message, dateValue[M], 2); >- append(message, (char)dateValue[utc], 0); >- return message.toString(); >- } >- >- private static void append(StringBuffer message, int value, int nch) >- { >- if (value < 0) >- { >- message.append('-'); >- value = -value; >- } >- if (nch == 4) >- { >- if (value < 10) >- message.append("000"); >- else if (value < 100) >- message.append("00"); >- else if (value < 1000) >- message.append("0"); >- message.append(value); >- } >- else if (nch == 2) >- { >- if (value < 10) >- message.append('0'); >- message.append(value); >- } >- else >- { >- if (value != 0) >- message.append((char)value); >- } >- } >- >- // >- //Private help functions >- // >- >- private static void cloneDate(int[] finalValue, int[] tempDate) >- { >- System.arraycopy(finalValue, 0, tempDate, 0, TOTAL_SIZE); >- } >- >- private int[] parseDateTime(String str) throws InvalidDatatypeValueException >- { >- int len = str.length(); >- int[] date = new int [TOTAL_SIZE]; >- int[] timeZone = new int [2]; >- >- int end = indexOf(str, 0, len, 'T'); >- >- // both time and date >- getDate(str, 0, end, date); >- getTime(str, end + 1, len, date, timeZone); >- >- //validate and normalize >- validateDateTime(date, timeZone); >- >- if (date[utc] != 0 && date[utc] != 'Z') >- { >- normalize(date, timeZone); >- } >- return date; >- } >- >- private int[] parseDate(String str) throws InvalidDatatypeValueException >- { >- int len = str.length(); >- int[] date = new int [TOTAL_SIZE]; >- int[] timeZone = new int [2]; >- >- int end = getDate(str, 0, len, date); >- parseTimeZone(str, end, len, date, timeZone); >- >- //validate and normalize >- validateDateTime(date, timeZone); >- >- if (date[utc] != 0 && date[utc] != 'Z') >- { >- normalize(date, timeZone); >- } >- return date; >- } >- >- private int[] parseDay(String str) throws InvalidDatatypeValueException >- { >- int len = str.length(); >- int[] date = new int [TOTAL_SIZE]; >- int[] timeZone = new int [2]; >- >- if (str.charAt(0) != '-' || str.charAt(1) != '-' || str.charAt(2) != '-') >- { >- throw new InvalidDatatypeValueException("Error in day parsing"); >- } >- >- //initialize values >- date[CY] = YEAR; >- date[M] = MONTH; >- >- date[D] = parseInt(str, 3, 5); >- >- if (DAY_SIZE < len) >- { >- int sign = findUTCSign(str, DAY_SIZE, len); >- if (sign < 0) >- { >- throw new InvalidDatatypeValueException("Error in day parsing"); >- } >- else >- { >- getTimeZone(str, date, sign, len, timeZone); >- } >- } >- >- //validate and normalize >- validateDateTime(date, timeZone); >- >- if (date[utc] != 0 && date[utc] != 'Z') >- { >- normalize(date, timeZone); >- } >- return date; >- } >- >- private int[] parseMonthDay(String str) throws InvalidDatatypeValueException >- { >- int len = str.length(); >- int[] date = new int [TOTAL_SIZE]; >- int[] timeZone = new int [2]; >- >- //initialize >- date[CY] = YEAR; >- >- if (str.charAt(0) != '-' || str.charAt(1) != '-') >- { >- throw new InvalidDatatypeValueException("Invalid format for gMonthDay: " + str); >- } >- date[M] = parseInt(str, 2, 4); >- int start = 4; >- >- if (str.charAt(start++) != '-') >- { >- throw new InvalidDatatypeValueException("Invalid format for gMonthDay: " + str); >- } >- >- date[D] = parseInt(str, start, start + 2); >- >- if (MONTHDAY_SIZE < len) >- { >- int sign = findUTCSign(str, MONTHDAY_SIZE, len); >- if (sign < 0) >- { >- throw new InvalidDatatypeValueException("Error in month parsing:" + str); >- } >- else >- { >- getTimeZone(str, date, sign, len, timeZone); >- } >- } >- //validate and normalize >- >- validateDateTime(date, timeZone); >- >- if (date[utc] != 0 && date[utc] != 'Z') >- { >- normalize(date, timeZone); >- } >- return date; >- } >- >- private int[] parseMonth(String str) throws InvalidDatatypeValueException >- { >- int len = str.length(); >- int[] date = new int [TOTAL_SIZE]; >- int[] timeZone = new int [2]; >- >- //set constants >- date[CY] = YEAR; >- date[D] = DAY; >- if (str.charAt(0) != '-' || str.charAt(1) != '-') >- { >- throw new InvalidDatatypeValueException("Invalid format for gMonth: " + str); >- } >- int stop = 4; >- date[M] = parseInt(str, 2, stop); >- >- // REVISIT: allow both --MM and --MM-- now. >- // need to remove the following 4 lines to disallow --MM-- >- // when the errata is offically in the rec. >- if (str.length() >= stop + 2 && str.charAt(stop) == '-' && str.charAt(stop + 1) == '-') >- { >- stop += 2; >- } >- if (stop < len) >- { >- int sign = findUTCSign(str, stop, len); >- if (sign < 0) >- { >- throw new InvalidDatatypeValueException("Error in month parsing: " + str); >- } >- else >- { >- getTimeZone(str, date, sign, len, timeZone); >- } >- } >- //validate and normalize >- validateDateTime(date, timeZone); >- >- if (date[utc] != 0 && date[utc] != 'Z') >- { >- normalize(date, timeZone); >- } >- return date; >- } >- >- private int[] parseYear(String str) throws InvalidDatatypeValueException >- { >- int len = str.length(); >- int[] date = new int [TOTAL_SIZE]; >- int[] timeZone = new int [2]; >- >- // check for preceding '-' sign >- int start = 0; >- if (str.charAt(0) == '-') >- { >- start = 1; >- } >- int sign = findUTCSign(str, start, len); >- if (sign == -1) >- { >- date[CY] = parseIntYear(str, len); >- } >- else >- { >- date[CY] = parseIntYear(str, sign); >- getTimeZone(str, date, sign, len, timeZone); >- } >- >- //initialize values >- date[M] = MONTH; >- date[D] = 1; >- >- //validate and normalize >- validateDateTime(date, timeZone); >- >- if (date[utc] != 0 && date[utc] != 'Z') >- { >- normalize(date, timeZone); >- } >- return date; >- } >- >- private int[] parseYearMonth(String str) throws InvalidDatatypeValueException >- { >- int len = str.length(); >- int[] date = new int [TOTAL_SIZE]; >- int[] timeZone = new int [2]; >- >- // get date >- int end = getYearMonth(str, 0, len, date); >- date[D] = DAY; >- parseTimeZone(str, end, len, date, timeZone); >- >- //validate and normalize >- validateDateTime(date, timeZone); >- >- if (date[utc] != 0 && date[utc] != 'Z') >- { >- normalize(date, timeZone); >- } >- return date; >- } >- >- private int[] parseTime(String str) throws InvalidDatatypeValueException >- { >- int len = str.length(); >- int[] date = new int [TOTAL_SIZE]; >- int[] timeZone = new int [2]; >- >- // time >- // initialize to default values >- date[CY] = YEAR; >- date[M] = MONTH; >- date[D] = DAY; >- getTime(str, 0, len, date, timeZone); >- >- //validate and normalize >- >- validateDateTime(date, timeZone); >- >- if (date[utc] != 0) >- { >- normalize(date, timeZone); >- } >- return date; >- } >- >- >- private static class SafeSimpleDateFormat extends SimpleDateFormat >- { >- public SafeSimpleDateFormat(String pattern) >- { >- super(pattern); >- } >- >- public synchronized Date parse(String source) throws ParseException >- { >- return super.parse(source); >- } >- } >- >-} >Index: src/org/eclipse/emf/ecore/xml/type/internal/QName.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/type/internal/QName.java >diff -N src/org/eclipse/emf/ecore/xml/type/internal/QName.java >--- src/org/eclipse/emf/ecore/xml/type/internal/QName.java 8 Jun 2005 06:20:10 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,172 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: QName.java,v 1.3 2005/06/08 06:20:10 nickb Exp $ >- */ >- >-package org.eclipse.emf.ecore.xml.type.internal; >- >-import org.eclipse.emf.ecore.xml.type.InvalidDatatypeValueException; >-import org.eclipse.emf.ecore.xml.type.internal.DataValue.XMLChar; >- >-/** >- * A structure that holds the components of an XML Namespaces qualified >- * name. >- * Two QNames are equal iff they both have same namespaceURI and same localPart. >- * Note: prefix is not used in QName.equals(Object). >- * If not specified, the prefix is set to empty string (""). >- * If not specified, the namespace uri is set to empty string (""); >- * <p> >- * NOTE: this class is for internal use only. >- */ >-public final class QName >-{ >- >- private String prefix; >- >- private String localPart; >- >- private String namespaceURI; >- >- /** >- * Constructs a QName. >- * @param qname a <a href="http://www.w3.org/TR/REC-xml-names/#dt-qname">qualified name</a> >- * Throws Exception if value is not legal qualified name >- */ >- public QName (String qname) >- { >- String rawname = qname; >- int index = rawname.indexOf(":"); >- >- String prefix = ""; >- String localName = rawname; >- if (index != -1) >- { >- prefix = rawname.substring(0, index); >- localName = rawname.substring(index + 1); >- } >- // both prefix (if any) a localpart must be valid NCName >- if (prefix.length() > 0 && !XMLChar.isValidNCName(prefix)) >- throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1: invalid QName: "+qname); >- >- if(!XMLChar.isValidNCName(localName)) >- throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1: invalid QName: "+qname); >- >- setPrefix(prefix); >- setLocalPart(localName); >- setNamespaceURI(null); >- } >- >- /** Constructs a QName with the specified values. */ >- public QName(String namespaceURI, String localPart, String prefix) >- { >- setNamespaceURI(namespaceURI); >- setPrefix(prefix); >- setLocalPart(localPart); >- if (this.prefix.length() > 0 && !XMLChar.isValidNCName(this.prefix)) >- throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1: invalid QName: "+prefix); >- >- if(!XMLChar.isValidNCName(this.localPart)) >- throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1: invalid QName: "+localPart); >- } >- >- /** Returns true if the two objects are equal. */ >- public boolean equals(Object object) >- { >- if (object instanceof QName) >- { >- QName qname = (QName)object; >- return namespaceURI.equals(qname.getNamespaceURI()) && localPart.equals(qname.getLocalPart()); >- } >- return false; >- } >- >- public int hashCode() >- { >- return namespaceURI.hashCode() + localPart.hashCode(); >- } >- >- /** Returns a string representation of this object. */ >- public String toString() >- { >- return (prefix.length() >0) ? prefix + ":" + localPart : localPart; >- } >- >- /** >- * @return Returns the localpart. >- */ >- public String getLocalPart() >- { >- return localPart; >- } >- >- /** >- * @param localpart The localpart to set. >- */ >- public void setLocalPart(String localpart) >- { >- if (localpart == null || localpart.length() == 0) >- { >- throw new IllegalArgumentException("QName localPart must have value."); >- } >- this.localPart = localpart; >- } >- >- /** >- * @return Returns the namespaceURI. >- */ >- public String getNamespaceURI() >- { >- return namespaceURI; >- } >- >- /** >- * @param namespaceUri The namespaceURI to set. >- */ >- public void setNamespaceURI(String namespaceUri) >- { >- if (namespaceUri == null) >- { >- this.namespaceURI = ""; >- } >- else >- { >- this.namespaceURI = namespaceUri; >- } >- >- } >- >- /** >- * @return Returns the prefix. >- */ >- public String getPrefix() >- { >- return prefix; >- } >- >- /** >- * @param prefix The prefix to set. >- */ >- public void setPrefix(String prefix) >- { >- if (prefix == null) >- { >- this.prefix = ""; >- } >- else >- { >- this.prefix = prefix; >- } >- } >-} >Index: src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java >diff -N src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java >--- src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java 14 Aug 2007 18:18:44 -0000 1.8.4.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,7957 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2004-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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: RegEx.java,v 1.8.4.1 2007/08/14 18:18:44 emerks Exp $ >- * >- * --------------------------------------------------------------------- >- * >- * The Apache Software License, Version 1.1 >- * >- * >- * Copyright (c) 1999-2004 The Apache Software Foundation. All rights >- * reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in >- * the documentation and/or other materials provided with the >- * distribution. >- * >- * 3. The end-user documentation included with the redistribution, >- * if any, must include the following acknowledgment: >- * "This product includes software developed by the >- * Apache Software Foundation (http://www.apache.org/)." >- * Alternately, this acknowledgment may appear in the software itself, >- * if and wherever such third-party acknowledgments normally appear. >- * >- * 4. The names "Xerces" and "Apache Software Foundation" must >- * not be used to endorse or promote products derived from this >- * software without prior written permission. For written >- * permission, please contact apache@apache.org. >- * >- * 5. Products derived from this software may not be called "Apache", >- * nor may "Apache" appear in their name, without prior written >- * permission of the Apache Software Foundation. >- * >- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED >- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES >- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR >- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF >- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, >- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT >- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >- * SUCH DAMAGE. >- * ==================================================================== >- * >- * This software consists of voluntary contributions made by many >- * individuals on behalf of the Apache Software Foundation and was >- * originally based on software copyright (c) 1999-2003, International >- * Business Machines, Inc., http://www.apache.org. For more >- * information on the Apache Software Foundation, please see >- * <http://www.apache.org/>. >- */ >- >-package org.eclipse.emf.ecore.xml.type.internal; >- >- >-import java.text.CharacterIterator; >-import java.util.Hashtable; >-import java.util.Locale; >-import java.util.ResourceBundle; >-import java.util.Vector; >- >-import org.eclipse.emf.ecore.plugin.EcorePlugin; >- >-/** >- * NOTE: this class is for internal use only. >- */ >-public final class RegEx >-{ >- static class BMPattern >- { >- char[] pattern; >- >- int[] shiftTable; >- >- boolean ignoreCase; >- >- public BMPattern(String pat, boolean ignoreCase) >- { >- this(pat, 256, ignoreCase); >- } >- >- public BMPattern(String pat, int tableSize, boolean ignoreCase) >- { >- this.pattern = pat.toCharArray(); >- this.shiftTable = new int [tableSize]; >- this.ignoreCase = ignoreCase; >- int length = pattern.length; >- for (int i = 0; i < this.shiftTable.length; i++) >- this.shiftTable[i] = length; >- for (int i = 0; i < length; i++) >- { >- char ch = this.pattern[i]; >- int diff = length - i - 1; >- int index = ch % this.shiftTable.length; >- if (diff < this.shiftTable[index]) >- this.shiftTable[index] = diff; >- if (this.ignoreCase) >- { >- ch = Character.toUpperCase(ch); >- index = ch % this.shiftTable.length; >- if (diff < this.shiftTable[index]) >- this.shiftTable[index] = diff; >- ch = Character.toLowerCase(ch); >- index = ch % this.shiftTable.length; >- if (diff < this.shiftTable[index]) >- this.shiftTable[index] = diff; >- } >- } >- } >- >- /** >- * >- * @return -1 if <var>iterator</var> does not contain this pattern. >- */ >- public int matches(CharacterIterator iterator, int start, int limit) >- { >- if (this.ignoreCase) >- return this.matchesIgnoreCase(iterator, start, limit); >- int plength = this.pattern.length; >- if (plength == 0) >- return start; >- int index = start + plength; >- while (index <= limit) >- { >- int pindex = plength; >- int nindex = index + 1; >- char ch; >- do >- { >- if ((ch = iterator.setIndex(--index)) != this.pattern[--pindex]) >- break; >- if (pindex == 0) >- return index; >- } >- while (pindex > 0); >- index += this.shiftTable[ch % this.shiftTable.length] + 1; >- if (index < nindex) >- index = nindex; >- } >- return -1; >- } >- >- /** >- * >- * @return -1 if <var>str</var> does not contain this pattern. >- */ >- public int matches(String str, int start, int limit) >- { >- if (this.ignoreCase) >- return this.matchesIgnoreCase(str, start, limit); >- int plength = this.pattern.length; >- if (plength == 0) >- return start; >- int index = start + plength; >- while (index <= limit) >- { >- //System.err.println("Starts at "+index); >- int pindex = plength; >- int nindex = index + 1; >- char ch; >- do >- { >- if ((ch = str.charAt(--index)) != this.pattern[--pindex]) >- break; >- if (pindex == 0) >- return index; >- } >- while (pindex > 0); >- index += this.shiftTable[ch % this.shiftTable.length] + 1; >- if (index < nindex) >- index = nindex; >- } >- return -1; >- } >- >- /** >- * >- * @return -1 if <var>chars</char> does not contain this pattern. >- */ >- public int matches(char[] chars, int start, int limit) >- { >- if (this.ignoreCase) >- return this.matchesIgnoreCase(chars, start, limit); >- int plength = this.pattern.length; >- if (plength == 0) >- return start; >- int index = start + plength; >- while (index <= limit) >- { >- //System.err.println("Starts at "+index); >- int pindex = plength; >- int nindex = index + 1; >- char ch; >- do >- { >- if ((ch = chars[--index]) != this.pattern[--pindex]) >- break; >- if (pindex == 0) >- return index; >- } >- while (pindex > 0); >- index += this.shiftTable[ch % this.shiftTable.length] + 1; >- if (index < nindex) >- index = nindex; >- } >- return -1; >- } >- >- int matchesIgnoreCase(CharacterIterator iterator, int start, int limit) >- { >- int plength = this.pattern.length; >- if (plength == 0) >- return start; >- int index = start + plength; >- while (index <= limit) >- { >- int pindex = plength; >- int nindex = index + 1; >- char ch; >- do >- { >- char ch1 = ch = iterator.setIndex(--index); >- char ch2 = this.pattern[--pindex]; >- if (ch1 != ch2) >- { >- ch1 = Character.toUpperCase(ch1); >- ch2 = Character.toUpperCase(ch2); >- if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2)) >- break; >- } >- if (pindex == 0) >- return index; >- } >- while (pindex > 0); >- index += this.shiftTable[ch % this.shiftTable.length] + 1; >- if (index < nindex) >- index = nindex; >- } >- return -1; >- } >- >- int matchesIgnoreCase(String text, int start, int limit) >- { >- int plength = this.pattern.length; >- if (plength == 0) >- return start; >- int index = start + plength; >- while (index <= limit) >- { >- int pindex = plength; >- int nindex = index + 1; >- char ch; >- do >- { >- char ch1 = ch = text.charAt(--index); >- char ch2 = this.pattern[--pindex]; >- if (ch1 != ch2) >- { >- ch1 = Character.toUpperCase(ch1); >- ch2 = Character.toUpperCase(ch2); >- if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2)) >- break; >- } >- if (pindex == 0) >- return index; >- } >- while (pindex > 0); >- index += this.shiftTable[ch % this.shiftTable.length] + 1; >- if (index < nindex) >- index = nindex; >- } >- return -1; >- } >- >- int matchesIgnoreCase(char[] chars, int start, int limit) >- { >- int plength = this.pattern.length; >- if (plength == 0) >- return start; >- int index = start + plength; >- while (index <= limit) >- { >- int pindex = plength; >- int nindex = index + 1; >- char ch; >- do >- { >- char ch1 = ch = chars[--index]; >- char ch2 = this.pattern[--pindex]; >- if (ch1 != ch2) >- { >- ch1 = Character.toUpperCase(ch1); >- ch2 = Character.toUpperCase(ch2); >- if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2)) >- break; >- } >- if (pindex == 0) >- return index; >- } >- while (pindex > 0); >- index += this.shiftTable[ch % this.shiftTable.length] + 1; >- if (index < nindex) >- index = nindex; >- } >- return -1; >- } >- /* >- public static void main(String[] argv) { >- try { >- int[] shiftTable = new int[256]; >- initializeBoyerMoore(argv[0], shiftTable, true); >- int o = -1; >- CharacterIterator ite = new java.text.StringCharacterIterator(argv[1]); >- long start = System.currentTimeMillis(); >- //for (int i = 0; i < 10000; i ++) >- o = searchIgnoreCasesWithBoyerMoore(ite, 0, argv[0], shiftTable); >- start = System.currentTimeMillis()-start; >- System.out.println("Result: "+o+", Elapsed: "+start); >- } catch (Exception ex) { >- ex.printStackTrace(); >- } >- }*/ >- } >- >- public static class Match implements Cloneable { >- int[] beginpos = null; >- int[] endpos = null; >- int nofgroups = 0; >- >- CharacterIterator ciSource = null; >- String strSource = null; >- char[] charSource = null; >- >- /** >- * Creates an instance. >- */ >- public Match() { >- } >- >- /** >- * >- */ >- public synchronized Object clone() { >- Match ma = new Match(); >- if (this.nofgroups > 0) { >- ma.setNumberOfGroups(this.nofgroups); >- if (this.ciSource != null) ma.setSource(this.ciSource); >- if (this.strSource != null) ma.setSource(this.strSource); >- for (int i = 0; i < this.nofgroups; i ++) { >- ma.setBeginning(i, this.getBeginning(i)); >- ma.setEnd(i, this.getEnd(i)); >- } >- } >- return ma; >- } >- >- /** >- * >- */ >- protected void setNumberOfGroups(int n) { >- int oldn = this.nofgroups; >- this.nofgroups = n; >- if (oldn <= 0 >- || oldn < n || n*2 < oldn) { >- this.beginpos = new int[n]; >- this.endpos = new int[n]; >- } >- for (int i = 0; i < n; i ++) { >- this.beginpos[i] = -1; >- this.endpos[i] = -1; >- } >- } >- >- /** >- * >- */ >- protected void setSource(CharacterIterator ci) { >- this.ciSource = ci; >- this.strSource = null; >- this.charSource = null; >- } >- /** >- * >- */ >- protected void setSource(String str) { >- this.ciSource = null; >- this.strSource = str; >- this.charSource = null; >- } >- /** >- * >- */ >- protected void setSource(char[] chars) { >- this.ciSource = null; >- this.strSource = null; >- this.charSource = chars; >- } >- >- /** >- * >- */ >- protected void setBeginning(int index, int v) { >- this.beginpos[index] = v; >- } >- >- /** >- * >- */ >- protected void setEnd(int index, int v) { >- this.endpos[index] = v; >- } >- >- /** >- * Return the number of regular expression groups. >- * This method returns 1 when the regular expression has no capturing-parenthesis. >- */ >- public int getNumberOfGroups() { >- if (this.nofgroups <= 0) >- throw new IllegalStateException("A result is not set."); >- return this.nofgroups; >- } >- >- /** >- * Return a start position in the target text matched to specified regular expression group. >- * >- * @param index Less than <code>getNumberOfGroups()</code>. >- */ >- public int getBeginning(int index) { >- if (this.beginpos == null) >- throw new IllegalStateException("A result is not set."); >- if (index < 0 || this.nofgroups <= index) >- throw new IllegalArgumentException("The parameter must be less than " >- +this.nofgroups+": "+index); >- return this.beginpos[index]; >- } >- >- /** >- * Return an end position in the target text matched to specified regular expression group. >- * >- * @param index Less than <code>getNumberOfGroups()</code>. >- */ >- public int getEnd(int index) { >- if (this.endpos == null) >- throw new IllegalStateException("A result is not set."); >- if (index < 0 || this.nofgroups <= index) >- throw new IllegalArgumentException("The parameter must be less than " >- +this.nofgroups+": "+index); >- return this.endpos[index]; >- } >- >- /** >- * Return an substring of the target text matched to specified regular expression group. >- * >- * @param index Less than <code>getNumberOfGroups()</code>. >- */ >- public String getCapturedText(int index) { >- if (this.beginpos == null) >- throw new IllegalStateException("match() has never been called."); >- if (index < 0 || this.nofgroups <= index) >- throw new IllegalArgumentException("The parameter must be less than " >- +this.nofgroups+": "+index); >- String ret; >- int begin = this.beginpos[index], end = this.endpos[index]; >- if (begin < 0 || end < 0) return null; >- if (this.ciSource != null) { >- ret = REUtil.substring(this.ciSource, begin, end); >- } else if (this.strSource != null) { >- ret = this.strSource.substring(begin, end); >- } else { >- ret = new String(this.charSource, begin, end-begin); >- } >- return ret; >- } >- } >- >- public final static class REUtil { >- private REUtil() { >- } >- >- static final int composeFromSurrogates(int high, int low) { >- return 0x10000 + ((high-0xd800)<<10) + low-0xdc00; >- } >- >- static final boolean isLowSurrogate(int ch) { >- return (ch & 0xfc00) == 0xdc00; >- } >- >- static final boolean isHighSurrogate(int ch) { >- return (ch & 0xfc00) == 0xd800; >- } >- >- static final String decomposeToSurrogates(int ch) { >- char[] chs = new char[2]; >- ch -= 0x10000; >- chs[0] = (char)((ch>>10)+0xd800); >- chs[1] = (char)((ch&0x3ff)+0xdc00); >- return new String(chs); >- } >- >- static final String substring(CharacterIterator iterator, int begin, int end) { >- char[] src = new char[end-begin]; >- for (int i = 0; i < src.length; i ++) >- src[i] = iterator.setIndex(i+begin); >- return new String(src); >- } >- >- // ================================================================ >- >- static final int getOptionValue(int ch) { >- int ret = 0; >- switch (ch) { >- case 'i': >- ret = RegularExpression.IGNORE_CASE; >- break; >- case 'm': >- ret = RegularExpression.MULTIPLE_LINES; >- break; >- case 's': >- ret = RegularExpression.SINGLE_LINE; >- break; >- case 'x': >- ret = RegularExpression.EXTENDED_COMMENT; >- break; >- case 'u': >- ret = RegularExpression.USE_UNICODE_CATEGORY; >- break; >- case 'w': >- ret = RegularExpression.UNICODE_WORD_BOUNDARY; >- break; >- case 'F': >- ret = RegularExpression.PROHIBIT_FIXED_STRING_OPTIMIZATION; >- break; >- case 'H': >- ret = RegularExpression.PROHIBIT_HEAD_CHARACTER_OPTIMIZATION; >- break; >- case 'X': >- ret = RegularExpression.XMLSCHEMA_MODE; >- break; >- case ',': >- ret = RegularExpression.SPECIAL_COMMA; >- break; >- default: >- } >- return ret; >- } >- >- static final int parseOptions(String opts) throws ParseException { >- if (opts == null) return 0; >- int options = 0; >- for (int i = 0; i < opts.length(); i ++) { >- int v = getOptionValue(opts.charAt(i)); >- if (v == 0) >- throw new ParseException("Unknown Option: "+opts.substring(i), -1); >- options |= v; >- } >- return options; >- } >- >- static final String createOptionString(int options) { >- StringBuffer sb = new StringBuffer(9); >- if ((options & RegularExpression.PROHIBIT_FIXED_STRING_OPTIMIZATION) != 0) >- sb.append('F'); >- if ((options & RegularExpression.PROHIBIT_HEAD_CHARACTER_OPTIMIZATION) != 0) >- sb.append('H'); >- if ((options & RegularExpression.XMLSCHEMA_MODE) != 0) >- sb.append('X'); >- if ((options & RegularExpression.IGNORE_CASE) != 0) >- sb.append('i'); >- if ((options & RegularExpression.MULTIPLE_LINES) != 0) >- sb.append('m'); >- if ((options & RegularExpression.SINGLE_LINE) != 0) >- sb.append('s'); >- if ((options & RegularExpression.USE_UNICODE_CATEGORY) != 0) >- sb.append('u'); >- if ((options & RegularExpression.UNICODE_WORD_BOUNDARY) != 0) >- sb.append('w'); >- if ((options & RegularExpression.EXTENDED_COMMENT) != 0) >- sb.append('x'); >- if ((options & RegularExpression.SPECIAL_COMMA) != 0) >- sb.append(','); >- return sb.toString().intern(); >- } >- >- // ================================================================ >- >- static String stripExtendedComment(String regex) { >- int len = regex.length(); >- StringBuffer buffer = new StringBuffer(len); >- int offset = 0; >- while (offset < len) { >- int ch = regex.charAt(offset++); >- // Skips a white space. >- if (ch == '\t' || ch == '\n' || ch == '\f' || ch == '\r' || ch == ' ') >- continue; >- >- if (ch == '#') { // Skips chracters between '#' and a line end. >- while (offset < len) { >- ch = regex.charAt(offset++); >- if (ch == '\r' || ch == '\n') >- break; >- } >- continue; >- } >- >- int next; // Strips an escaped white space. >- if (ch == '\\' && offset < len) { >- if ((next = regex.charAt(offset)) == '#' >- || next == '\t' || next == '\n' || next == '\f' >- || next == '\r' || next == ' ') { >- buffer.append((char)next); >- offset ++; >- } else { // Other escaped character. >- buffer.append('\\'); >- buffer.append((char)next); >- offset ++; >- } >- } else // As is. >- buffer.append((char)ch); >- } >- return buffer.toString(); >- } >- >- // ================================================================ >- >- /** >- * Sample entry. >- * <div>Usage: <KBD>org.apache.xerces.utils.regex.REUtil <regex> <string></KBD></div> >- */ >- public static void main(String[] argv) { >- String pattern = null; >- try { >- String options = ""; >- String target = null; >- if( argv.length == 0 ) { >- System.out.println( "Error:Usage: java REUtil -i|-m|-s|-u|-w|-X regularExpression String" ); >- System.exit( 0 ); >- } >- for (int i = 0; i < argv.length; i ++) { >- if (argv[i].length() == 0 || argv[i].charAt(0) != '-') { >- if (pattern == null) >- pattern = argv[i]; >- else if (target == null) >- target = argv[i]; >- else >- System.err.println("Unnecessary: "+argv[i]); >- } else if (argv[i].equals("-i")) { >- options += "i"; >- } else if (argv[i].equals("-m")) { >- options += "m"; >- } else if (argv[i].equals("-s")) { >- options += "s"; >- } else if (argv[i].equals("-u")) { >- options += "u"; >- } else if (argv[i].equals("-w")) { >- options += "w"; >- } else if (argv[i].equals("-X")) { >- options += "X"; >- } else { >- System.err.println("Unknown option: "+argv[i]); >- } >- } >- RegularExpression reg = new RegularExpression(pattern, options); >- System.out.println("RegularExpression: "+reg); >- Match match = new Match(); >- reg.matches(target, match); >- for (int i = 0; i < match.getNumberOfGroups(); i ++) { >- if (i == 0 ) System.out.print("Matched range for the whole pattern: "); >- else System.out.print("["+i+"]: "); >- if (match.getBeginning(i) < 0) >- System.out.println("-1"); >- else { >- System.out.print(match.getBeginning(i)+", "+match.getEnd(i)+", "); >- System.out.println("\""+match.getCapturedText(i)+"\""); >- } >- } >- } catch (ParseException pe) { >- if (pattern == null) { >- pe.printStackTrace(); >- } else { >- System.err.println("org.apache.xerces.utils.regex.ParseException: "+pe.getMessage()); >- String indent = " "; >- System.err.println(indent+pattern); >- int loc = pe.getLocation(); >- if (loc >= 0) { >- System.err.print(indent); >- for (int i = 0; i < loc; i ++) System.err.print("-"); >- System.err.println("^"); >- } >- } >- } catch (Exception e) { >- e.printStackTrace(); >- } >- } >- >- static final int CACHESIZE = 20; >- static final RegularExpression[] regexCache = new RegularExpression[CACHESIZE]; >- /** >- * Creates a RegularExpression instance. >- * This method caches created instances. >- * >- * @see RegularExpression#RegularExpression(String, String) >- */ >- public static RegularExpression createRegex(String pattern, String options) >- throws ParseException { >- RegularExpression re = null; >- int intOptions = REUtil.parseOptions(options); >- synchronized (REUtil.regexCache) { >- int i; >- for (i = 0; i < REUtil.CACHESIZE; i ++) { >- RegularExpression cached = REUtil.regexCache[i]; >- if (cached == null) { >- i = -1; >- break; >- } >- if (cached.equals(pattern, intOptions)) { >- re = cached; >- break; >- } >- } >- if (re != null) { >- if (i != 0) { >- System.arraycopy(REUtil.regexCache, 0, REUtil.regexCache, 1, i); >- REUtil.regexCache[0] = re; >- } >- } else { >- re = new RegularExpression(pattern, options); >- System.arraycopy(REUtil.regexCache, 0, REUtil.regexCache, 1, REUtil.CACHESIZE-1); >- REUtil.regexCache[0] = re; >- } >- } >- return re; >- } >- >- /** >- * >- * @see RegularExpression#matches(String) >- */ >- public static boolean matches(String regex, String target) throws ParseException { >- return REUtil.createRegex(regex, null).matches(target); >- } >- >- /** >- * >- * @see RegularExpression#matches(String) >- */ >- public static boolean matches(String regex, String options, String target) throws ParseException { >- return REUtil.createRegex(regex, options).matches(target); >- } >- >- // ================================================================ >- >- /** >- * >- */ >- public static String quoteMeta(String literal) { >- int len = literal.length(); >- StringBuffer buffer = null; >- for (int i = 0; i < len; i ++) { >- int ch = literal.charAt(i); >- if (".*+?{[()|\\^$".indexOf(ch) >= 0) { >- if (buffer == null) { >- buffer = new StringBuffer(i+(len-i)*2); >- if (i > 0) buffer.append(literal.substring(0, i)); >- } >- buffer.append('\\'); >- buffer.append((char)ch); >- } else if (buffer != null) >- buffer.append((char)ch); >- } >- return buffer != null ? buffer.toString() : literal; >- } >- >- // ================================================================ >- >- static void dumpString(String v) { >- for (int i = 0; i < v.length(); i ++) { >- System.out.print(Integer.toHexString(v.charAt(i))); >- System.out.print(" "); >- } >- System.out.println(); >- } >-} >- >- >- /** >- * A regular expression matching engine using Non-deterministic Finite Automaton (NFA). >- * This engine does not conform to the POSIX regular expression. >- * >- * <hr width="50%"> >- * <h3>How to use</h3> >- * >- * <dl> >- * <dt>A. Standard way >- * <dd> >- * <pre> >- * RegularExpression re = new RegularExpression(<var>regex</var>); >- * if (re.matches(text)) { ... } >- * </pre> >- * >- * <dt>B. Capturing groups >- * <dd> >- * <pre> >- * RegularExpression re = new RegularExpression(<var>regex</var>); >- * Match match = new Match(); >- * if (re.matches(text, match)) { >- * ... // You can refer captured texts with methods of the <code>Match</code> class. >- * } >- * </pre> >- * >- * </dl> >- * >- * <h4>Case-insensitive matching</h4> >- * <pre> >- * RegularExpression re = new RegularExpression(<var>regex</var>, "i"); >- * if (re.matches(text) >= 0) { ...} >- * </pre> >- * >- * <h4>Options</h4> >- * <p>You can specify options to <a href="#RegularExpression(java.lang.String, java.lang.String)"><code>RegularExpression(</code><var>regex</var><code>, </code><var>options</var><code>)</code></a> >- * or <a href="#setPattern(java.lang.String, java.lang.String)"><code>setPattern(</code><var>regex</var><code>, </code><var>options</var><code>)</code></a>. >- * This <var>options</var> parameter consists of the following characters. >- * </p> >- * <dl> >- * <dt><a name="I_OPTION"><code>"i"</code></a> >- * <dd>This option indicates case-insensitive matching. >- * <dt><a name="M_OPTION"><code>"m"</code></a> >- * <dd class="REGEX"><kbd>^</kbd> and <kbd>$</kbd> consider the EOL characters within the text. >- * <dt><a name="S_OPTION"><code>"s"</code></a> >- * <dd class="REGEX"><kbd>.</kbd> matches any one character. >- * <dt><a name="U_OPTION"><code>"u"</code></a> >- * <dd class="REGEX">Redefines <Kbd>\d \D \w \W \s \S \b \B \< \></kbd> as becoming to Unicode. >- * <dt><a name="W_OPTION"><code>"w"</code></a> >- * <dd class="REGEX">By this option, <kbd>\b \B \< \></kbd> are processed with the method of >- * 'Unicode Regular Expression Guidelines' Revision 4. >- * When "w" and "u" are specified at the same time, >- * <kbd>\b \B \< \></kbd> are processed for the "w" option. >- * <dt><a name="COMMA_OPTION"><code>","</code></a> >- * <dd>The parser treats a comma in a character class as a range separator. >- * <kbd class="REGEX">[a,b]</kbd> matches <kbd>a</kbd> or <kbd>,</kbd> or <kbd>b</kbd> without this option. >- * <kbd class="REGEX">[a,b]</kbd> matches <kbd>a</kbd> or <kbd>b</kbd> with this option. >- * >- * <dt><a name="X_OPTION"><code>"X"</code></a> >- * <dd class="REGEX"> >- * By this option, the engine confoms to <a href="http://www.w3.org/TR/2000/WD-xmlschema-2-20000407/#regexs">XML Schema: Regular Expression</a>. >- * The <code>match()</code> method does not do subsring matching >- * but entire string matching. >- * >- * </dl> >- * >- * <hr width="50%"> >- * <h3>Syntax</h3> >- * <table border="1" bgcolor="#ddeeff"> >- * <tr> >- * <td> >- * <h4>Differences from the Perl 5 regular expression</h4> >- * <ul> >- * <li>There is 6-digit hexadecimal character representation (<kbd>\u005cv</kbd><var>HHHHHH</var>.) >- * <li>Supports subtraction, union, and intersection operations for character classes. >- * <li>Not supported: <kbd>\</kbd><var>ooo</var> (Octal character representations), >- * <Kbd>\G</kbd>, <kbd>\C</kbd>, <kbd>\l</kbd><var>c</var>, >- * <kbd>\u005c u</kbd><var>c</var>, <kbd>\L</kbd>, <kbd>\U</kbd>, >- * <kbd>\E</kbd>, <kbd>\Q</kbd>, <kbd>\N{</kbd><var>name</var><kbd>}</kbd>, >- * <Kbd>(?{<kbd><var>code</var><kbd>})</kbd>, <Kbd>(??{<kbd><var>code</var><kbd>})</kbd> >- * </ul> >- * </td> >- * </tr> >- * </table> >- * >- * <P>Meta characters are `<KBD>. * + ? { [ ( ) | \ ^ $</KBD>'.</P> >- * <ul> >- * <li>Character >- * <dl> >- * <dt class="REGEX"><kbd>.</kbd> (A period) >- * <dd>Matches any one character except the following characters. >- * <dd>LINE FEED (U+000A), CARRIAGE RETURN (U+000D), >- * PARAGRAPH SEPARATOR (U+2029), LINE SEPARATOR (U+2028) >- * <dd>This expression matches one code point in Unicode. It can match a pair of surrogates. >- * <dd>When <a href="#S_OPTION">the "s" option</a> is specified, >- * it matches any character including the above four characters. >- * >- * <dt class="REGEX"><Kbd>\e \f \n \r \t</kbd> >- * <dd>Matches ESCAPE (U+001B), FORM FEED (U+000C), LINE FEED (U+000A), >- * CARRIAGE RETURN (U+000D), HORIZONTAL TABULATION (U+0009) >- * >- * <dt class="REGEX"><kbd>\c</kbd><var>C</var> >- * <dd>Matches a control character. >- * The <var>C</var> must be one of '<kbd>@</kbd>', '<kbd>A</kbd>'-'<kbd>Z</kbd>', >- * '<kbd>[</kbd>', '<kbd>\u005c</kbd>', '<kbd>]</kbd>', '<kbd>^</kbd>', '<kbd>_</kbd>'. >- * It matches a control character of which the character code is less than >- * the character code of the <var>C</var> by 0x0040. >- * <dd class="REGEX">For example, a <kbd>\cJ</kbd> matches a LINE FEED (U+000A), >- * and a <kbd>\c[</kbd> matches an ESCAPE (U+001B). >- * >- * <dt class="REGEX">a non-meta character >- * <dd>Matches the character. >- * >- * <dt class="REGEX"><KBD>\</KBD> + a meta character >- * <dd>Matches the meta character. >- * >- * <dt class="REGEX"><kbd>\u005cx</kbd><var>HH</var> <kbd>\u005cx{</kbd><var>HHHH</var><kbd>}</kbd> >- * <dd>Matches a character of which code point is <var>HH</var> (Hexadecimal) in Unicode. >- * You can write just 2 digits for <kbd>\u005cx</kbd><var>HH</var>, and >- * variable length digits for <kbd>\u005cx{</kbd><var>HHHH</var><kbd>}</kbd>. >- * >- * <!-- >- * <dt class="REGEX"><kbd>\u005c u</kbd><var>HHHH</var> >- * <dd>Matches a character of which code point is <var>HHHH</var> (Hexadecimal) in Unicode. >- * --> >- * >- * <dt class="REGEX"><kbd>\u005cv</kbd><var>HHHHHH</var> >- * <dd>Matches a character of which code point is <var>HHHHHH</var> (Hexadecimal) in Unicode. >- * >- * <dt class="REGEX"><kbd>\g</kbd> >- * <dd>Matches a grapheme. >- * <dd class="REGEX">It is equivalent to <kbd>(?[\p{ASSIGNED}]-[\p{M}\p{C}])?(?:\p{M}|[\x{094D}\x{09CD}\x{0A4D}\x{0ACD}\x{0B3D}\x{0BCD}\x{0C4D}\x{0CCD}\x{0D4D}\x{0E3A}\x{0F84}]\p{L}|[\x{1160}-\x{11A7}]|[\x{11A8}-\x{11FF}]|[\x{FF9E}\x{FF9F}])*</kbd> >- * >- * <dt class="REGEX"><kbd>\X</kbd> >- * <dd class="REGEX">Matches a combining character sequence. >- * It is equivalent to <kbd>(?:\PM\pM*)</kbd> >- * </dl> >- * </li> >- * >- * <li>Character class >- * <dl> >- + * <dt class="REGEX"><kbd>[</kbd><var>R<sub>1</sub></var><var>R<sub>2</sub></var><var>...</var><var>R<sub>n</sub></var><kbd>]</kbd> (without <a href="#COMMA_OPTION">"," option</a>) >- + * <dt class="REGEX"><kbd>[</kbd><var>R<sub>1</sub></var><kbd>,</kbd><var>R<sub>2</sub></var><kbd>,</kbd><var>...</var><kbd>,</kbd><var>R<sub>n</sub></var><kbd>]</kbd> (with <a href="#COMMA_OPTION">"," option</a>) >- * <dd>Positive character class. It matches a character in ranges. >- * <dd><var>R<sub>n</sub></var>: >- * <ul> >- * <li class="REGEX">A character (including <Kbd>\e \f \n \r \t</kbd> <kbd>\u005cx</kbd><var>HH</var> <kbd>\u005cx{</kbd><var>HHHH</var><kbd>}</kbd> <!--kbd>\u005c u</kbd><var>HHHH</var--> <kbd>\u005cv</kbd><var>HHHHHH</var>) >- * <p>This range matches the character. >- * <li class="REGEX"><var>C<sub>1</sub></var><kbd>-</kbd><var>C<sub>2</sub></var> >- * <p>This range matches a character which has a code point that is >= <var>C<sub>1</sub></var>'s code point and <= <var>C<sub>2</sub></var>'s code point. >- + * <li class="REGEX">A POSIX character class: <Kbd>[:alpha:] [:alnum:] [:ascii:] [:cntrl:] [:digit:] [:graph:] [:lower:] [:print:] [:punct:] [:space:] [:upper:] [:xdigit:]</kbd>, >- + * and negative POSIX character classes in Perl like <kbd>[:^alpha:]</kbd> >- * <p>... >- * <li class="REGEX"><kbd>\d \D \s \S \w \W \p{</kbd><var>name</var><kbd>} \P{</kbd><var>name</var><kbd>}</kbd> >- * <p>These expressions specifies the same ranges as the following expressions. >- * </ul> >- * <p class="REGEX">Enumerated ranges are merged (union operation). >- * <kbd>[a-ec-z]</kbd> is equivalent to <kbd>[a-z]</kbd> >- * >- * <dt class="REGEX"><kbd>[^</kbd><var>R<sub>1</sub></var><var>R<sub>2</sub></var><var>...</var><var>R<sub>n</sub></var><kbd>]</kbd> (without a <a href="#COMMA_OPTION">"," option</a>) >- * <dt class="REGEX"><kbd>[^</kbd><var>R<sub>1</sub></var><kbd>,</kbd><var>R<sub>2</sub></var><kbd>,</kbd><var>...</var><kbd>,</kbd><var>R<sub>n</sub></var><kbd>]</kbd> (with a <a href="#COMMA_OPTION">"," option</a>) >- * <dd>Negative character class. It matches a character not in ranges. >- * >- * <dt class="REGEX"><kbd>(?[</kbd><var>ranges</var><kbd>]</kbd><var>op</var><kbd>[</kbd><var>ranges</var><kbd>]</kbd><var>op</var><kbd>[</kbd><var>ranges</var><kbd>]</kbd> ... <Kbd>)</kbd> >- * (<var>op</var> is <kbd>-</kbd> or <kbd>+</kbd> or <kbd>&</kbd>.) >- * <dd>Subtraction or union or intersection for character classes. >- * <dd class="REGEX">For exmaple, <kbd>(?[A-Z]-[CF])</kbd> is equivalent to <kbd>[A-BD-EG-Z]</kbd>, and <kbd>(?[0x00-0x7f]-[K]&[\p{Lu}])</kbd> is equivalent to <kbd>[A-JL-Z]</kbd>. >- * <dd>The result of this operations is a <u>positive character class</u> >- * even if an expression includes any negative character classes. >- * You have to take care on this in case-insensitive matching. >- * For instance, <kbd>(?[^b])</kbd> is equivalent to <kbd>[\x00-ac-\x{10ffff}]</kbd>, >- * which is equivalent to <kbd>[^b]</kbd> in case-sensitive matching. >- * But, in case-insensitive matching, <kbd>(?[^b])</kbd> matches any character because >- * it includes '<kbd>B</kbd>' and '<kbd>B</kbd>' matches '<kbd>b</kbd>' >- * though <kbd>[^b]</kbd> is processed as <kbd>[^Bb]</kbd>. >- * >- * <dt class="REGEX"><kbd>[</kbd><var>R<sub>1</sub>R<sub>2</sub>...</var><kbd>-[</kbd><var>R<sub>n</sub>R<sub>n+1</sub>...</var><kbd>]]</kbd> (with an <a href="#X_OPTION">"X" option</a>)</dt> >- * <dd>Character class subtraction for the XML Schema. >- * You can use this syntax when you specify an <a href="#X_OPTION">"X" option</a>. >- * >- * <dt class="REGEX"><kbd>\d</kbd> >- * <dd class="REGEX">Equivalent to <kbd>[0-9]</kbd>. >- * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to >- * <span class="REGEX"><kbd>\p{Nd}</kbd></span>. >- * >- * <dt class="REGEX"><kbd>\D</kbd> >- * <dd class="REGEX">Equivalent to <kbd>[^0-9]</kbd> >- * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to >- * <span class="REGEX"><kbd>\P{Nd}</kbd></span>. >- * >- * <dt class="REGEX"><kbd>\s</kbd> >- * <dd class="REGEX">Equivalent to <kbd>[ \f\n\r\t]</kbd> >- * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to >- * <span class="REGEX"><kbd>[ \f\n\r\t\p{Z}]</kbd></span>. >- * >- * <dt class="REGEX"><kbd>\S</kbd> >- * <dd class="REGEX">Equivalent to <kbd>[^ \f\n\r\t]</kbd> >- * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to >- * <span class="REGEX"><kbd>[^ \f\n\r\t\p{Z}]</kbd></span>. >- * >- * <dt class="REGEX"><kbd>\w</kbd> >- * <dd class="REGEX">Equivalent to <kbd>[a-zA-Z0-9_]</kbd> >- * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to >- * <span class="REGEX"><kbd>[\p{Lu}\p{Ll}\p{Lo}\p{Nd}_]</kbd></span>. >- * >- * <dt class="REGEX"><kbd>\W</kbd> >- * <dd class="REGEX">Equivalent to <kbd>[^a-zA-Z0-9_]</kbd> >- * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to >- * <span class="REGEX"><kbd>[^\p{Lu}\p{Ll}\p{Lo}\p{Nd}_]</kbd></span>. >- * >- * <dt class="REGEX"><kbd>\p{</kbd><var>name</var><kbd>}</kbd> >- * <dd>Matches one character in the specified General Category (the second field in <a href="ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt"><kbd>UnicodeData.txt</kbd></a>) or the specified <a href="ftp://ftp.unicode.org/Public/UNIDATA/Blocks.txt">Block</a>. >- * The following names are available: >- * <dl> >- * <dt>Unicode General Categories: >- * <dd><kbd> >- * L, M, N, Z, C, P, S, Lu, Ll, Lt, Lm, Lo, Mn, Me, Mc, Nd, Nl, No, Zs, Zl, Zp, >- * Cc, Cf, Cn, Co, Cs, Pd, Ps, Pe, Pc, Po, Sm, Sc, Sk, So, >- * </kbd> >- * <dd>(Currently the Cn category includes U+10000-U+10FFFF characters) >- * <dt>Unicode Blocks: >- * <dd><kbd> >- * Basic Latin, Latin-1 Supplement, Latin Extended-A, Latin Extended-B, >- * IPA Extensions, Spacing Modifier Letters, Combining Diacritical Marks, Greek, >- * Cyrillic, Armenian, Hebrew, Arabic, Devanagari, Bengali, Gurmukhi, Gujarati, >- * Oriya, Tamil, Telugu, Kannada, Malayalam, Thai, Lao, Tibetan, Georgian, >- * Hangul Jamo, Latin Extended Additional, Greek Extended, General Punctuation, >- * Superscripts and Subscripts, Currency Symbols, Combining Marks for Symbols, >- * Letterlike Symbols, Number Forms, Arrows, Mathematical Operators, >- * Miscellaneous Technical, Control Pictures, Optical Character Recognition, >- * Enclosed Alphanumerics, Box Drawing, Block Elements, Geometric Shapes, >- * Miscellaneous Symbols, Dingbats, CJK Symbols and Punctuation, Hiragana, >- * Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun, >- * Enclosed CJK Letters and Months, CJK Compatibility, CJK Unified Ideographs, >- * Hangul Syllables, High Surrogates, High Private Use Surrogates, Low Surrogates, >- * Private Use, CJK Compatibility Ideographs, Alphabetic Presentation Forms, >- * Arabic Presentation Forms-A, Combining Half Marks, CJK Compatibility Forms, >- * Small Form Variants, Arabic Presentation Forms-B, Specials, >- * Halfwidth and Fullwidth Forms >- * </kbd> >- * <dt>Others: >- * <dd><kbd>ALL</kbd> (Equivalent to <kbd>[\u005cu0000-\u005cv10FFFF]</kbd>) >- * <dd><kbd>ASSGINED</kbd> (<kbd>\p{ASSIGNED}</kbd> is equivalent to <kbd>\P{Cn}</kbd>) >- * <dd><kbd>UNASSGINED</kbd> >- * (<kbd>\p{UNASSIGNED}</kbd> is equivalent to <kbd>\p{Cn}</kbd>) >- * </dl> >- * >- * <dt class="REGEX"><kbd>\P{</kbd><var>name</var><kbd>}</kbd> >- * <dd>Matches one character not in the specified General Category or the specified Block. >- * </dl> >- * </li> >- * >- * <li>Selection and Quantifier >- * <dl> >- * <dt class="REGEX"><VAR>X</VAR><kbd>|</kbd><VAR>Y</VAR> >- * <dd>... >- * >- * <dt class="REGEX"><VAR>X</VAR><kbd>*</KBD> >- * <dd>Matches 0 or more <var>X</var>. >- * >- * <dt class="REGEX"><VAR>X</VAR><kbd>+</KBD> >- * <dd>Matches 1 or more <var>X</var>. >- * >- * <dt class="REGEX"><VAR>X</VAR><kbd>?</KBD> >- * <dd>Matches 0 or 1 <var>X</var>. >- * >- * <dt class="REGEX"><var>X</var><kbd>{</kbd><var>number</var><kbd>}</kbd> >- * <dd>Matches <var>number</var> times. >- * >- * <dt class="REGEX"><var>X</var><kbd>{</kbd><var>min</var><kbd>,}</kbd> >- * <dd>... >- * >- * <dt class="REGEX"><var>X</var><kbd>{</kbd><var>min</var><kbd>,</kbd><var>max</var><kbd>}</kbd> >- * <dd>... >- * >- * <dt class="REGEX"><VAR>X</VAR><kbd>*?</kbd> >- * <dt class="REGEX"><VAR>X</VAR><kbd>+?</kbd> >- * <dt class="REGEX"><VAR>X</VAR><kbd>??</kbd> >- * <dt class="REGEX"><var>X</var><kbd>{</kbd><var>min</var><kbd>,}?</kbd> >- * <dt class="REGEX"><var>X</var><kbd>{</kbd><var>min</var><kbd>,</kbd><var>max</var><kbd>}?</kbd> >- * <dd>Non-greedy matching. >- * </dl> >- * </li> >- * >- * <li>Grouping, Capturing, and Back-reference >- * <dl> >- * <dt class="REGEX"><KBD>(?:</kbd><VAR>X</VAR><kbd>)</KBD> >- * <dd>Grouping. "<KBD>foo+</KBD>" matches "<KBD>foo</KBD>" or "<KBD>foooo</KBD>". >- * If you want it matches "<KBD>foofoo</KBD>" or "<KBD>foofoofoo</KBD>", >- * you have to write "<KBD>(?:foo)+</KBD>". >- * >- * <dt class="REGEX"><KBD>(</kbd><VAR>X</VAR><kbd>)</KBD> >- * <dd>Grouping with capturing. >- * It make a group and applications can know >- * where in target text a group matched with methods of a <code>Match</code> instance >- * after <code><a href="#matches(java.lang.String, org.apache.xerces.utils.regex.Match)">matches(String,Match)</a></code>. >- * The 0th group means whole of this regular expression. >- * The <VAR>N</VAR>th gorup is the inside of the <VAR>N</VAR>th left parenthesis. >- * >- * <p>For instance, a regular expression is >- * "<FONT color=blue><KBD> *([^<:]*) +<([^>]*)> *</KBD></FONT>" >- * and target text is >- * "<FONT color=red><KBD>From: TAMURA Kent <kent@trl.ibm.co.jp></KBD></FONT>": >- * <ul> >- * <li><code>Match.getCapturedText(0)</code>: >- * "<FONT color=red><KBD> TAMURA Kent <kent@trl.ibm.co.jp></KBD></FONT>" >- * <li><code>Match.getCapturedText(1)</code>: "<FONT color=red><KBD>TAMURA Kent</KBD></FONT>" >- * <li><code>Match.getCapturedText(2)</code>: "<FONT color=red><KBD>kent@trl.ibm.co.jp</KBD></FONT>" >- * </ul> >- * >- * <dt class="REGEX"><kbd>\1 \2 \3 \4 \5 \6 \7 \8 \9</kbd> >- * <dd> >- * >- * <dt class="REGEX"><kbd>(?></kbd><var>X</var><kbd>)</kbd> >- * <dd>Independent expression group. ................ >- * >- * <dt class="REGEX"><kbd>(?</kbd><var>options</var><kbd>:</kbd><var>X</var><kbd>)</kbd> >- * <dt class="REGEX"><kbd>(?</kbd><var>options</var><kbd>-</kbd><var>options2</var><kbd>:</kbd><var>X</var><kbd>)</kbd> >- * <dd>............................ >- * <dd>The <var>options</var> or the <var>options2</var> consists of 'i' 'm' 's' 'w'. >- * Note that it can not contain 'u'. >- * >- * <dt class="REGEX"><kbd>(?</kbd><var>options</var><kbd>)</kbd> >- * <dt class="REGEX"><kbd>(?</kbd><var>options</var><kbd>-</kbd><var>options2</var><kbd>)</kbd> >- * <dd>...... >- * <dd>These expressions must be at the beginning of a group. >- * </dl> >- * </li> >- * >- * <li>Anchor >- * <dl> >- * <dt class="REGEX"><kbd>\A</kbd> >- * <dd>Matches the beginnig of the text. >- * >- * <dt class="REGEX"><kbd>\Z</kbd> >- * <dd>Matches the end of the text, or before an EOL character at the end of the text, >- * or CARRIAGE RETURN + LINE FEED at the end of the text. >- * >- * <dt class="REGEX"><kbd>\z</kbd> >- * <dd>Matches the end of the text. >- * >- * <dt class="REGEX"><kbd>^</kbd> >- * <dd>Matches the beginning of the text. It is equivalent to <span class="REGEX"><Kbd>\A</kbd></span>. >- * <dd>When <a href="#M_OPTION">a "m" option</a> is set, >- * it matches the beginning of the text, or after one of EOL characters ( >- * LINE FEED (U+000A), CARRIAGE RETURN (U+000D), LINE SEPARATOR (U+2028), >- * PARAGRAPH SEPARATOR (U+2029).) >- * >- * <dt class="REGEX"><kbd>$</kbd> >- * <dd>Matches the end of the text, or before an EOL character at the end of the text, >- * or CARRIAGE RETURN + LINE FEED at the end of the text. >- * <dd>When <a href="#M_OPTION">a "m" option</a> is set, >- * it matches the end of the text, or before an EOL character. >- * >- * <dt class="REGEX"><kbd>\b</kbd> >- * <dd>Matches word boundary. >- * (See <a href="#W_OPTION">a "w" option</a>) >- * >- * <dt class="REGEX"><kbd>\B</kbd> >- * <dd>Matches non word boundary. >- * (See <a href="#W_OPTION">a "w" option</a>) >- * >- * <dt class="REGEX"><kbd>\<</kbd> >- * <dd>Matches the beginning of a word. >- * (See <a href="#W_OPTION">a "w" option</a>) >- * >- * <dt class="REGEX"><kbd>\></kbd> >- * <dd>Matches the end of a word. >- * (See <a href="#W_OPTION">a "w" option</a>) >- * </dl> >- * </li> >- * <li>Lookahead and lookbehind >- * <dl> >- * <dt class="REGEX"><kbd>(?=</kbd><var>X</var><kbd>)</kbd> >- * <dd>Lookahead. >- * >- * <dt class="REGEX"><kbd>(?!</kbd><var>X</var><kbd>)</kbd> >- * <dd>Negative lookahead. >- * >- * <dt class="REGEX"><kbd>(?<=</kbd><var>X</var><kbd>)</kbd> >- * <dd>Lookbehind. >- * <dd>(Note for text capturing......) >- * >- * <dt class="REGEX"><kbd>(?<!</kbd><var>X</var><kbd>)</kbd> >- * <dd>Negative lookbehind. >- * </dl> >- * </li> >- * >- * <li>Misc. >- * <dl> >- * <dt class="REGEX"><kbd>(?(</Kbd><var>condition</var><Kbd>)</kbd><var>yes-pattern</var><kbd>|</kbd><var>no-pattern</var><kbd>)</kbd>, >- * <dt class="REGEX"><kbd>(?(</kbd><var>condition</var><kbd>)</kbd><var>yes-pattern</var><kbd>)</kbd> >- * <dd>...... >- * <dt class="REGEX"><kbd>(?#</kbd><var>comment</var><kbd>)</kbd> >- * <dd>Comment. A comment string consists of characters except '<kbd>)</kbd>'. >- * You can not write comments in character classes and before quantifiers. >- * </dl> >- * </li> >- * </ul> >- * >- * >- * <hr width="50%"> >- * <h3>BNF for the regular expression</h3> >- * <pre> >- * regex ::= ('(?' options ')')? term ('|' term)* >- * term ::= factor+ >- * factor ::= anchors | atom (('*' | '+' | '?' | minmax ) '?'? )? >- * | '(?#' [^)]* ')' >- * minmax ::= '{' ([0-9]+ | [0-9]+ ',' | ',' [0-9]+ | [0-9]+ ',' [0-9]+) '}' >- * atom ::= char | '.' | char-class | '(' regex ')' | '(?:' regex ')' | '\' [0-9] >- * | '\w' | '\W' | '\d' | '\D' | '\s' | '\S' | category-block | '\X' >- * | '(?>' regex ')' | '(?' options ':' regex ')' >- * | '(?' ('(' [0-9] ')' | '(' anchors ')' | looks) term ('|' term)? ')' >- * options ::= [imsw]* ('-' [imsw]+)? >- * anchors ::= '^' | '$' | '\A' | '\Z' | '\z' | '\b' | '\B' | '\<' | '\>' >- * looks ::= '(?=' regex ')' | '(?!' regex ')' >- * | '(?<=' regex ')' | '(?<!' regex ')' >- * char ::= '\\' | '\' [efnrtv] | '\c' [@-_] | code-point | character-1 >- * category-block ::= '\' [pP] category-symbol-1 >- * | ('\p{' | '\P{') (category-symbol | block-name >- * | other-properties) '}' >- * category-symbol-1 ::= 'L' | 'M' | 'N' | 'Z' | 'C' | 'P' | 'S' >- * category-symbol ::= category-symbol-1 | 'Lu' | 'Ll' | 'Lt' | 'Lm' | Lo' >- * | 'Mn' | 'Me' | 'Mc' | 'Nd' | 'Nl' | 'No' >- * | 'Zs' | 'Zl' | 'Zp' | 'Cc' | 'Cf' | 'Cn' | 'Co' | 'Cs' >- * | 'Pd' | 'Ps' | 'Pe' | 'Pc' | 'Po' >- * | 'Sm' | 'Sc' | 'Sk' | 'So' >- * block-name ::= (See above) >- * other-properties ::= 'ALL' | 'ASSIGNED' | 'UNASSIGNED' >- * character-1 ::= (any character except meta-characters) >- * >- * char-class ::= '[' ranges ']' >- * | '(?[' ranges ']' ([-+&] '[' ranges ']')? ')' >- * ranges ::= '^'? (range <a href="#COMMA_OPTION">','?</a>)+ >- * range ::= '\d' | '\w' | '\s' | '\D' | '\W' | '\S' | category-block >- * | range-char | range-char '-' range-char >- * range-char ::= '\[' | '\]' | '\\' | '\' [,-efnrtv] | code-point | character-2 >- * code-point ::= '\x' hex-char hex-char >- * | '\x{' hex-char+ '}' >- * <!-- | '\u005c u' hex-char hex-char hex-char hex-char >- * --> | '\v' hex-char hex-char hex-char hex-char hex-char hex-char >- * hex-char ::= [0-9a-fA-F] >- * character-2 ::= (any character except \[]-,) >- * </pre> >- * >- * <hr width="50%"> >- * <h3>to do</h3> >- * <ul> >- * <li><a href="http://www.unicode.org/unicode/reports/tr18/">Unicode Regular Expression Guidelines</a> >- * <ul> >- * <li>2.4 Canonical Equivalents >- * <li>Level 3 >- * </ul> >- * <li>Parsing performance >- * </ul> >- * >- * <hr width="50%"> >- * >- * @author TAMURA Kent <kent@trl.ibm.co.jp> >- * @version $Id: RegEx.java,v 1.8.4.1 2007/08/14 18:18:44 emerks Exp $ >- */ >- public static class RegularExpression implements java.io.Serializable { >- static final boolean DEBUG = false; >- >- /** >- * Compiles a token tree into an operation flow. >- */ >- private synchronized void compile(Token tok) { >- if (this.operations != null) >- return; >- this.numberOfClosures = 0; >- this.operations = this.compile(tok, null, false); >- } >- >- /** >- * Converts a token to an operation. >- */ >- private Op compile(Token tok, Op next, boolean reverse) { >- Op ret; >- switch (tok.type) { >- case Token.DOT: >- ret = Op.createDot(); >- ret.next = next; >- break; >- >- case Token.CHAR: >- ret = Op.createChar(tok.getChar()); >- ret.next = next; >- break; >- >- case Token.ANCHOR: >- ret = Op.createAnchor(tok.getChar()); >- ret.next = next; >- break; >- >- case Token.RANGE: >- case Token.NRANGE: >- ret = Op.createRange(tok); >- ret.next = next; >- break; >- >- case Token.CONCAT: >- ret = next; >- if (!reverse) { >- for (int i = tok.size()-1; i >= 0; i --) { >- ret = compile(tok.getChild(i), ret, false); >- } >- } else { >- for (int i = 0; i < tok.size(); i ++) { >- ret = compile(tok.getChild(i), ret, true); >- } >- } >- break; >- >- case Token.UNION: >- Op.UnionOp uni = Op.createUnion(tok.size()); >- for (int i = 0; i < tok.size(); i ++) { >- uni.addElement(compile(tok.getChild(i), next, reverse)); >- } >- ret = uni; // ret.next is null. >- break; >- >- case Token.CLOSURE: >- case Token.NONGREEDYCLOSURE: >- Token child = tok.getChild(0); >- int min = tok.getMin(); >- int max = tok.getMax(); >- if (min >= 0 && min == max) { // {n} >- ret = next; >- for (int i = 0; i < min; i ++) { >- ret = compile(child, ret, reverse); >- } >- break; >- } >- if (min > 0 && max > 0) >- max -= min; >- if (max > 0) { >- // X{2,6} -> XX(X(X(XX?)?)?)? >- ret = next; >- for (int i = 0; i < max; i ++) { >- Op.ChildOp q = Op.createQuestion(tok.type == Token.NONGREEDYCLOSURE); >- q.next = next; >- q.setChild(compile(child, ret, reverse)); >- ret = q; >- } >- } else { >- Op.ChildOp op; >- if (tok.type == Token.NONGREEDYCLOSURE) { >- op = Op.createNonGreedyClosure(); >- } else { // Token.CLOSURE >- if (child.getMinLength() == 0) >- op = Op.createClosure(this.numberOfClosures++); >- else >- op = Op.createClosure(-1); >- } >- op.next = next; >- op.setChild(compile(child, op, reverse)); >- ret = op; >- } >- if (min > 0) { >- for (int i = 0; i < min; i ++) { >- ret = compile(child, ret, reverse); >- } >- } >- break; >- >- case Token.EMPTY: >- ret = next; >- break; >- >- case Token.STRING: >- ret = Op.createString(tok.getString()); >- ret.next = next; >- break; >- >- case Token.BACKREFERENCE: >- ret = Op.createBackReference(tok.getReferenceNumber()); >- ret.next = next; >- break; >- >- case Token.PAREN: >- if (tok.getParenNumber() == 0) { >- ret = compile(tok.getChild(0), next, reverse); >- } else if (reverse) { >- next = Op.createCapture(tok.getParenNumber(), next); >- next = compile(tok.getChild(0), next, reverse); >- ret = Op.createCapture(-tok.getParenNumber(), next); >- } else { >- next = Op.createCapture(-tok.getParenNumber(), next); >- next = compile(tok.getChild(0), next, reverse); >- ret = Op.createCapture(tok.getParenNumber(), next); >- } >- break; >- >- case Token.LOOKAHEAD: >- ret = Op.createLook(Op.LOOKAHEAD, next, compile(tok.getChild(0), null, false)); >- break; >- case Token.NEGATIVELOOKAHEAD: >- ret = Op.createLook(Op.NEGATIVELOOKAHEAD, next, compile(tok.getChild(0), null, false)); >- break; >- case Token.LOOKBEHIND: >- ret = Op.createLook(Op.LOOKBEHIND, next, compile(tok.getChild(0), null, true)); >- break; >- case Token.NEGATIVELOOKBEHIND: >- ret = Op.createLook(Op.NEGATIVELOOKBEHIND, next, compile(tok.getChild(0), null, true)); >- break; >- >- case Token.INDEPENDENT: >- ret = Op.createIndependent(next, compile(tok.getChild(0), null, reverse)); >- break; >- >- case Token.MODIFIERGROUP: >- ret = Op.createModifier(next, compile(tok.getChild(0), null, reverse), >- ((Token.ModifierToken)tok).getOptions(), >- ((Token.ModifierToken)tok).getOptionsMask()); >- break; >- >- case Token.CONDITION: >- Token.ConditionToken ctok = (Token.ConditionToken)tok; >- int ref = ctok.refNumber; >- Op condition = ctok.condition == null ? null : compile(ctok.condition, null, reverse); >- Op yes = compile(ctok.yes, next, reverse); >- Op no = ctok.no == null ? null : compile(ctok.no, next, reverse); >- ret = Op.createCondition(next, ref, condition, yes, no); >- break; >- >- default: >- throw new RuntimeException("Unknown token type: "+tok.type); >- } // switch (tok.type) >- return ret; >- } >- >- >-// Public >- >- /** >- * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not. >- * >- * @return true if the target is matched to this regular expression. >- */ >- public boolean matches(char[] target) { >- return this.matches(target, 0, target .length , (Match)null); >- } >- >- /** >- * Checks whether the <var>target</var> text <strong>contains</strong> this pattern >- * in specified range or not. >- * >- * @param start Start offset of the range. >- * @param end End offset +1 of the range. >- * @return true if the target is matched to this regular expression. >- */ >- public boolean matches(char[] target, int start, int end) { >- return this.matches(target, start, end, (Match)null); >- } >- >- /** >- * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not. >- * >- * @param match A Match instance for storing matching result. >- * @return Offset of the start position in <VAR>target</VAR>; or -1 if not match. >- */ >- public boolean matches(char[] target, Match match) { >- return this.matches(target, 0, target .length , match); >- } >- >- >- /** >- * Checks whether the <var>target</var> text <strong>contains</strong> this pattern >- * in specified range or not. >- * >- * @param start Start offset of the range. >- * @param end End offset +1 of the range. >- * @param match A Match instance for storing matching result. >- * @return Offset of the start position in <VAR>target</VAR>; or -1 if not match. >- */ >- public boolean matches(char[] target, int start, int end, Match match) { >- >- synchronized (this) { >- if (this.operations == null) >- this.prepare(); >- if (this.context == null) >- this.context = new Context(); >- } >- Context con = null; >- synchronized (this.context) { >- con = this.context.inuse ? new Context() : this.context; >- con.reset(target, start, end, this.numberOfClosures); >- } >- if (match != null) { >- match.setNumberOfGroups(this.nofparen); >- match.setSource(target); >- } else if (this.hasBackReferences) { >- match = new Match(); >- match.setNumberOfGroups(this.nofparen); >- // Need not to call setSource() because >- // a caller can not access this match instance. >- } >- con.match = match; >- >- if (RegularExpression.isSet(this.options, XMLSCHEMA_MODE)) { >- int matchEnd = this. matchCharArray (con, this.operations, con.start, 1, this.options); >- //System.err.println("DEBUG: matchEnd="+matchEnd); >- if (matchEnd == con.limit) { >- if (con.match != null) { >- con.match.setBeginning(0, con.start); >- con.match.setEnd(0, matchEnd); >- } >- con.inuse = false; >- return true; >- } >- return false; >- } >- >- /* >- * The pattern has only fixed string. >- * The engine uses Boyer-Moore. >- */ >- if (this.fixedStringOnly) { >- //System.err.println("DEBUG: fixed-only: "+this.fixedString); >- int o = this.fixedStringTable.matches(target, con.start, con.limit); >- if (o >= 0) { >- if (con.match != null) { >- con.match.setBeginning(0, o); >- con.match.setEnd(0, o+this.fixedString.length()); >- } >- con.inuse = false; >- return true; >- } >- con.inuse = false; >- return false; >- } >- >- /* >- * The pattern contains a fixed string. >- * The engine checks with Boyer-Moore whether the text contains the fixed string or not. >- * If not, it return with false. >- */ >- if (this.fixedString != null) { >- int o = this.fixedStringTable.matches(target, con.start, con.limit); >- if (o < 0) { >- //System.err.println("Non-match in fixed-string search."); >- con.inuse = false; >- return false; >- } >- } >- >- int limit = con.limit-this.minlength; >- int matchStart; >- int matchEnd = -1; >- >- /* >- * Checks whether the expression starts with ".*". >- */ >- if (this.operations != null >- && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) { >- if (isSet(this.options, SINGLE_LINE)) { >- matchStart = con.start; >- matchEnd = this. matchCharArray (con, this.operations, con.start, 1, this.options); >- } else { >- boolean previousIsEOL = true; >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- int ch = target [ matchStart ] ; >- if (isEOLChar(ch)) { >- previousIsEOL = true; >- } else { >- if (previousIsEOL) { >- if (0 <= (matchEnd = this. matchCharArray (con, this.operations, >- matchStart, 1, this.options))) >- break; >- } >- previousIsEOL = false; >- } >- } >- } >- } >- >- /* >- * Optimization against the first character. >- */ >- else if (this.firstChar != null) { >- //System.err.println("DEBUG: with firstchar-matching: "+this.firstChar); >- RangeToken range = this.firstChar; >- if (RegularExpression.isSet(this.options, IGNORE_CASE)) { >- range = this.firstChar.getCaseInsensitiveToken(); >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- int ch = target [ matchStart ] ; >- if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) { >- ch = REUtil.composeFromSurrogates(ch, target [ matchStart+1 ] ); >- if (!range.match(ch)) continue; >- } else { >- if (!range.match(ch)) { >- char ch1 = Character.toUpperCase((char)ch); >- if (!range.match(ch1)) >- if (!range.match(Character.toLowerCase(ch1))) >- continue; >- } >- } >- if (0 <= (matchEnd = this. matchCharArray (con, this.operations, >- matchStart, 1, this.options))) >- break; >- } >- } else { >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- int ch = target [ matchStart ] ; >- if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) >- ch = REUtil.composeFromSurrogates(ch, target [ matchStart+1 ] ); >- if (!range.match(ch)) continue; >- if (0 <= (matchEnd = this. matchCharArray (con, this.operations, >- matchStart, 1, this.options))) >- break; >- } >- } >- } >- >- /* >- * Straightforward matching. >- */ >- else { >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- if (0 <= (matchEnd = this. matchCharArray (con, this.operations, matchStart, 1, this.options))) >- break; >- } >- } >- >- if (matchEnd >= 0) { >- if (con.match != null) { >- con.match.setBeginning(0, matchStart); >- con.match.setEnd(0, matchEnd); >- } >- con.inuse = false; >- return true; >- } else { >- con.inuse = false; >- return false; >- } >- } >- >- /** >- * @return -1 when not match; offset of the end of matched string when match. >- */ >- private int matchCharArray (Context con, Op op, int offset, int dx, int opts) { >- >- char[] target = con.charTarget; >- >- >- while (true) { >- if (op == null) >- return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset; >- if (offset > con.limit || offset < con.start) >- return -1; >- switch (op.type) { >- case Op.CHAR: >- if (isSet(opts, IGNORE_CASE)) { >- int ch = op.getData(); >- if (dx > 0) { >- if (offset >= con.limit || !matchIgnoreCase(ch, target [ offset ] )) >- return -1; >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target [ o1 ] )) >- return -1; >- offset = o1; >- } >- } else { >- int ch = op.getData(); >- if (dx > 0) { >- if (offset >= con.limit || ch != target [ offset ] ) >- return -1; >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0 || ch != target [ o1 ] ) >- return -1; >- offset = o1; >- } >- } >- op = op.next; >- break; >- >- case Op.DOT: >- if (dx > 0) { >- if (offset >= con.limit) >- return -1; >- int ch = target [ offset ] ; >- if (isSet(opts, SINGLE_LINE)) { >- if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit) >- offset ++; >- } else { >- if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit) >- ch = REUtil.composeFromSurrogates(ch, target [ ++offset ] ); >- if (isEOLChar(ch)) >- return -1; >- } >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0) >- return -1; >- int ch = target [ o1 ] ; >- if (isSet(opts, SINGLE_LINE)) { >- if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) >- o1 --; >- } else { >- if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) >- ch = REUtil.composeFromSurrogates( target [ --o1 ] , ch); >- if (!isEOLChar(ch)) >- return -1; >- } >- offset = o1; >- } >- op = op.next; >- break; >- >- case Op.RANGE: >- case Op.NRANGE: >- if (dx > 0) { >- if (offset >= con.limit) >- return -1; >- int ch = target [ offset ] ; >- if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit) >- ch = REUtil.composeFromSurrogates(ch, target [ ++offset ] ); >- RangeToken tok = op.getToken(); >- if (isSet(opts, IGNORE_CASE)) { >- tok = tok.getCaseInsensitiveToken(); >- if (!tok.match(ch)) { >- if (ch >= 0x10000) return -1; >- char uch; >- if (!tok.match(uch = Character.toUpperCase((char)ch)) >- && !tok.match(Character.toLowerCase(uch))) >- return -1; >- } >- } else { >- if (!tok.match(ch)) return -1; >- } >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0) >- return -1; >- int ch = target [ o1 ] ; >- if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) >- ch = REUtil.composeFromSurrogates( target [ --o1 ] , ch); >- RangeToken tok = op.getToken(); >- if (isSet(opts, IGNORE_CASE)) { >- tok = tok.getCaseInsensitiveToken(); >- if (!tok.match(ch)) { >- if (ch >= 0x10000) return -1; >- char uch; >- if (!tok.match(uch = Character.toUpperCase((char)ch)) >- && !tok.match(Character.toLowerCase(uch))) >- return -1; >- } >- } else { >- if (!tok.match(ch)) return -1; >- } >- offset = o1; >- } >- op = op.next; >- break; >- >- case Op.ANCHOR: >- boolean go = false; >- switch (op.getData()) { >- case '^': >- if (isSet(opts, MULTIPLE_LINES)) { >- if (!(offset == con.start >- || offset > con.start && isEOLChar( target [ offset-1 ] ))) >- return -1; >- } else { >- if (offset != con.start) >- return -1; >- } >- break; >- >- case '@': // Internal use only. >- // The @ always matches line beginnings. >- if (!(offset == con.start >- || offset > con.start && isEOLChar( target [ offset-1 ] ))) >- return -1; >- break; >- >- case '$': >- if (isSet(opts, MULTIPLE_LINES)) { >- if (!(offset == con.limit >- || offset < con.limit && isEOLChar( target [ offset ] ))) >- return -1; >- } else { >- if (!(offset == con.limit >- || offset+1 == con.limit && isEOLChar( target [ offset ] ) >- || offset+2 == con.limit && target [ offset ] == CARRIAGE_RETURN >- && target [ offset+1 ] == LINE_FEED)) >- return -1; >- } >- break; >- >- case 'A': >- if (offset != con.start) return -1; >- break; >- >- case 'Z': >- if (!(offset == con.limit >- || offset+1 == con.limit && isEOLChar( target [ offset ] ) >- || offset+2 == con.limit && target [ offset ] == CARRIAGE_RETURN >- && target [ offset+1 ] == LINE_FEED)) >- return -1; >- break; >- >- case 'z': >- if (offset != con.limit) return -1; >- break; >- >- case 'b': >- if (con.length == 0) return -1; >- { >- int after = getWordType(target, con.start, con.limit, offset, opts); >- if (after == WT_IGNORE) return -1; >- int before = getPreviousWordType(target, con.start, con.limit, offset, opts); >- if (after == before) return -1; >- } >- break; >- >- case 'B': >- if (con.length == 0) >- go = true; >- else { >- int after = getWordType(target, con.start, con.limit, offset, opts); >- go = after == WT_IGNORE >- || after == getPreviousWordType(target, con.start, con.limit, offset, opts); >- } >- if (!go) return -1; >- break; >- >- case '<': >- if (con.length == 0 || offset == con.limit) return -1; >- if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER >- || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER) >- return -1; >- break; >- >- case '>': >- if (con.length == 0 || offset == con.start) return -1; >- if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER >- || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER) >- return -1; >- break; >- } // switch anchor type >- op = op.next; >- break; >- >- case Op.BACKREFERENCE: >- { >- int refno = op.getData(); >- if (refno <= 0 || refno >= this.nofparen) >- throw new RuntimeException("Internal Error: Reference number must be more than zero: "+refno); >- if (con.match.getBeginning(refno) < 0 >- || con.match.getEnd(refno) < 0) >- return -1; // ******** >- int o2 = con.match.getBeginning(refno); >- int literallen = con.match.getEnd(refno)-o2; >- if (!isSet(opts, IGNORE_CASE)) { >- if (dx > 0) { >- if (!regionMatches(target, offset, con.limit, o2, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatches(target, offset-literallen, con.limit, o2, literallen)) >- return -1; >- offset -= literallen; >- } >- } else { >- if (dx > 0) { >- if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit, >- o2, literallen)) >- return -1; >- offset -= literallen; >- } >- } >- } >- op = op.next; >- break; >- case Op.STRING: >- { >- String literal = op.getString(); >- int literallen = literal.length(); >- if (!isSet(opts, IGNORE_CASE)) { >- if (dx > 0) { >- if (!regionMatches(target, offset, con.limit, literal, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatches(target, offset-literallen, con.limit, literal, literallen)) >- return -1; >- offset -= literallen; >- } >- } else { >- if (dx > 0) { >- if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit, >- literal, literallen)) >- return -1; >- offset -= literallen; >- } >- } >- } >- op = op.next; >- break; >- >- case Op.CLOSURE: >- { >- /* >- * Saves current position to avoid >- * zero-width repeats. >- */ >- int id = op.getData(); >- if (id >= 0) { >- int previousOffset = con.offsets[id]; >- if (previousOffset < 0 || previousOffset != offset) { >- con.offsets[id] = offset; >- } else { >- con.offsets[id] = -1; >- op = op.next; >- break; >- } >- } >- >- int ret = this. matchCharArray (con, op.getChild(), offset, dx, opts); >- if (id >= 0) con.offsets[id] = -1; >- if (ret >= 0) return ret; >- op = op.next; >- } >- break; >- >- case Op.QUESTION: >- { >- int ret = this. matchCharArray (con, op.getChild(), offset, dx, opts); >- if (ret >= 0) return ret; >- op = op.next; >- } >- break; >- >- case Op.NONGREEDYCLOSURE: >- case Op.NONGREEDYQUESTION: >- { >- int ret = this. matchCharArray (con, op.next, offset, dx, opts); >- if (ret >= 0) return ret; >- op = op.getChild(); >- } >- break; >- >- case Op.UNION: >- for (int i = 0; i < op.size(); i ++) { >- int ret = this. matchCharArray (con, op.elementAt(i), offset, dx, opts); >- if (DEBUG) { >- System.err.println("UNION: "+i+", ret="+ret); >- } >- if (ret >= 0) return ret; >- } >- return -1; >- >- case Op.CAPTURE: >- int refno = op.getData(); >- if (con.match != null && refno > 0) { >- int save = con.match.getBeginning(refno); >- con.match.setBeginning(refno, offset); >- int ret = this. matchCharArray (con, op.next, offset, dx, opts); >- if (ret < 0) con.match.setBeginning(refno, save); >- return ret; >- } else if (con.match != null && refno < 0) { >- int index = -refno; >- int save = con.match.getEnd(index); >- con.match.setEnd(index, offset); >- int ret = this. matchCharArray (con, op.next, offset, dx, opts); >- if (ret < 0) con.match.setEnd(index, save); >- return ret; >- } >- op = op.next; >- break; >- >- case Op.LOOKAHEAD: >- if (0 > this. matchCharArray (con, op.getChild(), offset, 1, opts)) return -1; >- op = op.next; >- break; >- case Op.NEGATIVELOOKAHEAD: >- if (0 <= this. matchCharArray (con, op.getChild(), offset, 1, opts)) return -1; >- op = op.next; >- break; >- case Op.LOOKBEHIND: >- if (0 > this. matchCharArray (con, op.getChild(), offset, -1, opts)) return -1; >- op = op.next; >- break; >- case Op.NEGATIVELOOKBEHIND: >- if (0 <= this. matchCharArray (con, op.getChild(), offset, -1, opts)) return -1; >- op = op.next; >- break; >- >- case Op.INDEPENDENT: >- { >- int ret = this. matchCharArray (con, op.getChild(), offset, dx, opts); >- if (ret < 0) return ret; >- offset = ret; >- op = op.next; >- } >- break; >- >- case Op.MODIFIER: >- { >- int localopts = opts; >- localopts |= op.getData(); >- localopts &= ~op.getData2(); >- //System.err.println("MODIFIER: "+Integer.toString(opts, 16)+" -> "+Integer.toString(localopts, 16)); >- int ret = this. matchCharArray (con, op.getChild(), offset, dx, localopts); >- if (ret < 0) return ret; >- offset = ret; >- op = op.next; >- } >- break; >- >- case Op.CONDITION: >- { >- Op.ConditionOp cop = (Op.ConditionOp)op; >- boolean matchp = false; >- if (cop.refNumber > 0) { >- if (cop.refNumber >= this.nofparen) >- throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber); >- matchp = con.match.getBeginning(cop.refNumber) >= 0 >- && con.match.getEnd(cop.refNumber) >= 0; >- } else { >- matchp = 0 <= this. matchCharArray (con, cop.condition, offset, dx, opts); >- } >- >- if (matchp) { >- op = cop.yes; >- } else if (cop.no != null) { >- op = cop.no; >- } else { >- op = cop.next; >- } >- } >- break; >- >- default: >- throw new RuntimeException("Unknown operation type: "+op.type); >- } // switch (op.type) >- } // while >- } >- >- private static final int getPreviousWordType(char[] target, int begin, int end, >- int offset, int opts) { >- int ret = getWordType(target, begin, end, --offset, opts); >- while (ret == WT_IGNORE) >- ret = getWordType(target, begin, end, --offset, opts); >- return ret; >- } >- >- private static final int getWordType(char[] target, int begin, int end, >- int offset, int opts) { >- if (offset < begin || offset >= end) return WT_OTHER; >- return getWordType0( target [ offset ] , opts); >- } >- >- >- >- private static final boolean regionMatches(char[] target, int offset, int limit, >- String part, int partlen) { >- if (offset < 0) return false; >- if (limit-offset < partlen) >- return false; >- int i = 0; >- while (partlen-- > 0) { >- if ( target [ offset++ ] != part.charAt(i++)) >- return false; >- } >- return true; >- } >- >- private static final boolean regionMatches(char[] target, int offset, int limit, >- int offset2, int partlen) { >- if (offset < 0) return false; >- if (limit-offset < partlen) >- return false; >- int i = offset2; >- while (partlen-- > 0) { >- if ( target [ offset++ ] != target [ i++ ] ) >- return false; >- } >- return true; >- } >- >- /** >- * @see java.lang.String#regionMatches >- */ >- private static final boolean regionMatchesIgnoreCase(char[] target, int offset, int limit, >- String part, int partlen) { >- if (offset < 0) return false; >- if (limit-offset < partlen) >- return false; >- int i = 0; >- while (partlen-- > 0) { >- char ch1 = target [ offset++ ] ; >- char ch2 = part.charAt(i++); >- if (ch1 == ch2) >- continue; >- char uch1 = Character.toUpperCase(ch1); >- char uch2 = Character.toUpperCase(ch2); >- if (uch1 == uch2) >- continue; >- if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2)) >- return false; >- } >- return true; >- } >- >- private static final boolean regionMatchesIgnoreCase(char[] target, int offset, int limit, >- int offset2, int partlen) { >- if (offset < 0) return false; >- if (limit-offset < partlen) >- return false; >- int i = offset2; >- while (partlen-- > 0) { >- char ch1 = target [ offset++ ] ; >- char ch2 = target [ i++ ] ; >- if (ch1 == ch2) >- continue; >- char uch1 = Character.toUpperCase(ch1); >- char uch2 = Character.toUpperCase(ch2); >- if (uch1 == uch2) >- continue; >- if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2)) >- return false; >- } >- return true; >- } >- >- >- >- >- /** >- * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not. >- * >- * @return true if the target is matched to this regular expression. >- */ >- public boolean matches(String target) { >- return this.matches(target, 0, target .length() , (Match)null); >- } >- >- /** >- * Checks whether the <var>target</var> text <strong>contains</strong> this pattern >- * in specified range or not. >- * >- * @param start Start offset of the range. >- * @param end End offset +1 of the range. >- * @return true if the target is matched to this regular expression. >- */ >- public boolean matches(String target, int start, int end) { >- return this.matches(target, start, end, (Match)null); >- } >- >- /** >- * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not. >- * >- * @param match A Match instance for storing matching result. >- * @return Offset of the start position in <VAR>target</VAR>; or -1 if not match. >- */ >- public boolean matches(String target, Match match) { >- return this.matches(target, 0, target .length() , match); >- } >- >- /** >- * Checks whether the <var>target</var> text <strong>contains</strong> this pattern >- * in specified range or not. >- * >- * @param start Start offset of the range. >- * @param end End offset +1 of the range. >- * @param match A Match instance for storing matching result. >- * @return Offset of the start position in <VAR>target</VAR>; or -1 if not match. >- */ >- public boolean matches(String target, int start, int end, Match match) { >- >- synchronized (this) { >- if (this.operations == null) >- this.prepare(); >- if (this.context == null) >- this.context = new Context(); >- } >- Context con = null; >- synchronized (this.context) { >- con = this.context.inuse ? new Context() : this.context; >- con.reset(target, start, end, this.numberOfClosures); >- } >- if (match != null) { >- match.setNumberOfGroups(this.nofparen); >- match.setSource(target); >- } else if (this.hasBackReferences) { >- match = new Match(); >- match.setNumberOfGroups(this.nofparen); >- // Need not to call setSource() because >- // a caller can not access this match instance. >- } >- con.match = match; >- >- if (RegularExpression.isSet(this.options, XMLSCHEMA_MODE)) { >- if (DEBUG) { >- System.err.println("target string="+target); >- } >- int matchEnd = this. matchString (con, this.operations, con.start, 1, this.options); >- if (DEBUG) { >- System.err.println("matchEnd="+matchEnd); >- System.err.println("con.limit="+con.limit); >- } >- if (matchEnd == con.limit) { >- if (con.match != null) { >- con.match.setBeginning(0, con.start); >- con.match.setEnd(0, matchEnd); >- } >- con.inuse = false; >- return true; >- } >- return false; >- } >- >- /* >- * The pattern has only fixed string. >- * The engine uses Boyer-Moore. >- */ >- if (this.fixedStringOnly) { >- //System.err.println("DEBUG: fixed-only: "+this.fixedString); >- int o = this.fixedStringTable.matches(target, con.start, con.limit); >- if (o >= 0) { >- if (con.match != null) { >- con.match.setBeginning(0, o); >- con.match.setEnd(0, o+this.fixedString.length()); >- } >- con.inuse = false; >- return true; >- } >- con.inuse = false; >- return false; >- } >- >- /* >- * The pattern contains a fixed string. >- * The engine checks with Boyer-Moore whether the text contains the fixed string or not. >- * If not, it return with false. >- */ >- if (this.fixedString != null) { >- int o = this.fixedStringTable.matches(target, con.start, con.limit); >- if (o < 0) { >- //System.err.println("Non-match in fixed-string search."); >- con.inuse = false; >- return false; >- } >- } >- >- int limit = con.limit-this.minlength; >- int matchStart; >- int matchEnd = -1; >- >- /* >- * Checks whether the expression starts with ".*". >- */ >- if (this.operations != null >- && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) { >- if (isSet(this.options, SINGLE_LINE)) { >- matchStart = con.start; >- matchEnd = this. matchString (con, this.operations, con.start, 1, this.options); >- } else { >- boolean previousIsEOL = true; >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- int ch = target .charAt( matchStart ) ; >- if (isEOLChar(ch)) { >- previousIsEOL = true; >- } else { >- if (previousIsEOL) { >- if (0 <= (matchEnd = this. matchString (con, this.operations, >- matchStart, 1, this.options))) >- break; >- } >- previousIsEOL = false; >- } >- } >- } >- } >- >- /* >- * Optimization against the first character. >- */ >- else if (this.firstChar != null) { >- //System.err.println("DEBUG: with firstchar-matching: "+this.firstChar); >- RangeToken range = this.firstChar; >- if (RegularExpression.isSet(this.options, IGNORE_CASE)) { >- range = this.firstChar.getCaseInsensitiveToken(); >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- int ch = target .charAt( matchStart ) ; >- if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) { >- ch = REUtil.composeFromSurrogates(ch, target .charAt( matchStart+1 ) ); >- if (!range.match(ch)) continue; >- } else { >- if (!range.match(ch)) { >- char ch1 = Character.toUpperCase((char)ch); >- if (!range.match(ch1)) >- if (!range.match(Character.toLowerCase(ch1))) >- continue; >- } >- } >- if (0 <= (matchEnd = this. matchString (con, this.operations, >- matchStart, 1, this.options))) >- break; >- } >- } else { >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- int ch = target .charAt( matchStart ) ; >- if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) >- ch = REUtil.composeFromSurrogates(ch, target .charAt( matchStart+1 ) ); >- if (!range.match(ch)) continue; >- if (0 <= (matchEnd = this. matchString (con, this.operations, >- matchStart, 1, this.options))) >- break; >- } >- } >- } >- >- /* >- * Straightforward matching. >- */ >- else { >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- if (0 <= (matchEnd = this. matchString (con, this.operations, matchStart, 1, this.options))) >- break; >- } >- } >- >- if (matchEnd >= 0) { >- if (con.match != null) { >- con.match.setBeginning(0, matchStart); >- con.match.setEnd(0, matchEnd); >- } >- con.inuse = false; >- return true; >- } else { >- con.inuse = false; >- return false; >- } >- } >- >- /** >- * @return -1 when not match; offset of the end of matched string when match. >- */ >- private int matchString (Context con, Op op, int offset, int dx, int opts) { >- >- >- >- >- String target = con.strTarget; >- >- >- >- >- while (true) { >- if (op == null) >- return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset; >- if (offset > con.limit || offset < con.start) >- return -1; >- switch (op.type) { >- case Op.CHAR: >- if (isSet(opts, IGNORE_CASE)) { >- int ch = op.getData(); >- if (dx > 0) { >- if (offset >= con.limit || !matchIgnoreCase(ch, target .charAt( offset ) )) >- return -1; >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target .charAt( o1 ) )) >- return -1; >- offset = o1; >- } >- } else { >- int ch = op.getData(); >- if (dx > 0) { >- if (offset >= con.limit || ch != target .charAt( offset ) ) >- return -1; >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0 || ch != target .charAt( o1 ) ) >- return -1; >- offset = o1; >- } >- } >- op = op.next; >- break; >- >- case Op.DOT: >- if (dx > 0) { >- if (offset >= con.limit) >- return -1; >- int ch = target .charAt( offset ) ; >- if (isSet(opts, SINGLE_LINE)) { >- if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit) >- offset ++; >- } else { >- if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit) >- ch = REUtil.composeFromSurrogates(ch, target .charAt( ++offset ) ); >- if (isEOLChar(ch)) >- return -1; >- } >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0) >- return -1; >- int ch = target .charAt( o1 ) ; >- if (isSet(opts, SINGLE_LINE)) { >- if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) >- o1 --; >- } else { >- if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) >- ch = REUtil.composeFromSurrogates( target .charAt( --o1 ) , ch); >- if (!isEOLChar(ch)) >- return -1; >- } >- offset = o1; >- } >- op = op.next; >- break; >- >- case Op.RANGE: >- case Op.NRANGE: >- if (dx > 0) { >- if (offset >= con.limit) >- return -1; >- int ch = target .charAt( offset ) ; >- if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit) >- ch = REUtil.composeFromSurrogates(ch, target .charAt( ++offset ) ); >- RangeToken tok = op.getToken(); >- if (isSet(opts, IGNORE_CASE)) { >- tok = tok.getCaseInsensitiveToken(); >- if (!tok.match(ch)) { >- if (ch >= 0x10000) return -1; >- char uch; >- if (!tok.match(uch = Character.toUpperCase((char)ch)) >- && !tok.match(Character.toLowerCase(uch))) >- return -1; >- } >- } else { >- if (!tok.match(ch)) return -1; >- } >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0) >- return -1; >- int ch = target .charAt( o1 ) ; >- if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) >- ch = REUtil.composeFromSurrogates( target .charAt( --o1 ) , ch); >- RangeToken tok = op.getToken(); >- if (isSet(opts, IGNORE_CASE)) { >- tok = tok.getCaseInsensitiveToken(); >- if (!tok.match(ch)) { >- if (ch >= 0x10000) return -1; >- char uch; >- if (!tok.match(uch = Character.toUpperCase((char)ch)) >- && !tok.match(Character.toLowerCase(uch))) >- return -1; >- } >- } else { >- if (!tok.match(ch)) return -1; >- } >- offset = o1; >- } >- op = op.next; >- break; >- >- case Op.ANCHOR: >- boolean go = false; >- switch (op.getData()) { >- case '^': >- if (isSet(opts, MULTIPLE_LINES)) { >- if (!(offset == con.start >- || offset > con.start && isEOLChar( target .charAt( offset-1 ) ))) >- return -1; >- } else { >- if (offset != con.start) >- return -1; >- } >- break; >- >- case '@': // Internal use only. >- // The @ always matches line beginnings. >- if (!(offset == con.start >- || offset > con.start && isEOLChar( target .charAt( offset-1 ) ))) >- return -1; >- break; >- >- case '$': >- if (isSet(opts, MULTIPLE_LINES)) { >- if (!(offset == con.limit >- || offset < con.limit && isEOLChar( target .charAt( offset ) ))) >- return -1; >- } else { >- if (!(offset == con.limit >- || offset+1 == con.limit && isEOLChar( target .charAt( offset ) ) >- || offset+2 == con.limit && target .charAt( offset ) == CARRIAGE_RETURN >- && target .charAt( offset+1 ) == LINE_FEED)) >- return -1; >- } >- break; >- >- case 'A': >- if (offset != con.start) return -1; >- break; >- >- case 'Z': >- if (!(offset == con.limit >- || offset+1 == con.limit && isEOLChar( target .charAt( offset ) ) >- || offset+2 == con.limit && target .charAt( offset ) == CARRIAGE_RETURN >- && target .charAt( offset+1 ) == LINE_FEED)) >- return -1; >- break; >- >- case 'z': >- if (offset != con.limit) return -1; >- break; >- >- case 'b': >- if (con.length == 0) return -1; >- { >- int after = getWordType(target, con.start, con.limit, offset, opts); >- if (after == WT_IGNORE) return -1; >- int before = getPreviousWordType(target, con.start, con.limit, offset, opts); >- if (after == before) return -1; >- } >- break; >- >- case 'B': >- if (con.length == 0) >- go = true; >- else { >- int after = getWordType(target, con.start, con.limit, offset, opts); >- go = after == WT_IGNORE >- || after == getPreviousWordType(target, con.start, con.limit, offset, opts); >- } >- if (!go) return -1; >- break; >- >- case '<': >- if (con.length == 0 || offset == con.limit) return -1; >- if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER >- || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER) >- return -1; >- break; >- >- case '>': >- if (con.length == 0 || offset == con.start) return -1; >- if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER >- || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER) >- return -1; >- break; >- } // switch anchor type >- op = op.next; >- break; >- >- case Op.BACKREFERENCE: >- { >- int refno = op.getData(); >- if (refno <= 0 || refno >= this.nofparen) >- throw new RuntimeException("Internal Error: Reference number must be more than zero: "+refno); >- if (con.match.getBeginning(refno) < 0 >- || con.match.getEnd(refno) < 0) >- return -1; // ******** >- int o2 = con.match.getBeginning(refno); >- int literallen = con.match.getEnd(refno)-o2; >- if (!isSet(opts, IGNORE_CASE)) { >- if (dx > 0) { >- if (!regionMatches(target, offset, con.limit, o2, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatches(target, offset-literallen, con.limit, o2, literallen)) >- return -1; >- offset -= literallen; >- } >- } else { >- if (dx > 0) { >- if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit, >- o2, literallen)) >- return -1; >- offset -= literallen; >- } >- } >- } >- op = op.next; >- break; >- case Op.STRING: >- { >- String literal = op.getString(); >- int literallen = literal.length(); >- if (!isSet(opts, IGNORE_CASE)) { >- if (dx > 0) { >- if (!regionMatches(target, offset, con.limit, literal, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatches(target, offset-literallen, con.limit, literal, literallen)) >- return -1; >- offset -= literallen; >- } >- } else { >- if (dx > 0) { >- if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit, >- literal, literallen)) >- return -1; >- offset -= literallen; >- } >- } >- } >- op = op.next; >- break; >- >- case Op.CLOSURE: >- { >- /* >- * Saves current position to avoid >- * zero-width repeats. >- */ >- int id = op.getData(); >- if (id >= 0) { >- int previousOffset = con.offsets[id]; >- if (previousOffset < 0 || previousOffset != offset) { >- con.offsets[id] = offset; >- } else { >- con.offsets[id] = -1; >- op = op.next; >- break; >- } >- } >- int ret = this. matchString (con, op.getChild(), offset, dx, opts); >- if (id >= 0) con.offsets[id] = -1; >- if (ret >= 0) return ret; >- op = op.next; >- } >- break; >- >- case Op.QUESTION: >- { >- int ret = this. matchString (con, op.getChild(), offset, dx, opts); >- if (ret >= 0) return ret; >- op = op.next; >- } >- break; >- >- case Op.NONGREEDYCLOSURE: >- case Op.NONGREEDYQUESTION: >- { >- int ret = this. matchString (con, op.next, offset, dx, opts); >- if (ret >= 0) return ret; >- op = op.getChild(); >- } >- break; >- >- case Op.UNION: >- for (int i = 0; i < op.size(); i ++) { >- int ret = this. matchString (con, op.elementAt(i), offset, dx, opts); >- if (DEBUG) { >- System.err.println("UNION: "+i+", ret="+ret); >- } >- if (ret >= 0) return ret; >- } >- return -1; >- >- case Op.CAPTURE: >- int refno = op.getData(); >- if (con.match != null && refno > 0) { >- int save = con.match.getBeginning(refno); >- con.match.setBeginning(refno, offset); >- int ret = this. matchString (con, op.next, offset, dx, opts); >- if (ret < 0) con.match.setBeginning(refno, save); >- return ret; >- } else if (con.match != null && refno < 0) { >- int index = -refno; >- int save = con.match.getEnd(index); >- con.match.setEnd(index, offset); >- int ret = this. matchString (con, op.next, offset, dx, opts); >- if (ret < 0) con.match.setEnd(index, save); >- return ret; >- } >- op = op.next; >- break; >- >- case Op.LOOKAHEAD: >- if (0 > this. matchString (con, op.getChild(), offset, 1, opts)) return -1; >- op = op.next; >- break; >- case Op.NEGATIVELOOKAHEAD: >- if (0 <= this. matchString (con, op.getChild(), offset, 1, opts)) return -1; >- op = op.next; >- break; >- case Op.LOOKBEHIND: >- if (0 > this. matchString (con, op.getChild(), offset, -1, opts)) return -1; >- op = op.next; >- break; >- case Op.NEGATIVELOOKBEHIND: >- if (0 <= this. matchString (con, op.getChild(), offset, -1, opts)) return -1; >- op = op.next; >- break; >- >- case Op.INDEPENDENT: >- { >- int ret = this. matchString (con, op.getChild(), offset, dx, opts); >- if (ret < 0) return ret; >- offset = ret; >- op = op.next; >- } >- break; >- >- case Op.MODIFIER: >- { >- int localopts = opts; >- localopts |= op.getData(); >- localopts &= ~op.getData2(); >- //System.err.println("MODIFIER: "+Integer.toString(opts, 16)+" -> "+Integer.toString(localopts, 16)); >- int ret = this. matchString (con, op.getChild(), offset, dx, localopts); >- if (ret < 0) return ret; >- offset = ret; >- op = op.next; >- } >- break; >- >- case Op.CONDITION: >- { >- Op.ConditionOp cop = (Op.ConditionOp)op; >- boolean matchp = false; >- if (cop.refNumber > 0) { >- if (cop.refNumber >= this.nofparen) >- throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber); >- matchp = con.match.getBeginning(cop.refNumber) >= 0 >- && con.match.getEnd(cop.refNumber) >= 0; >- } else { >- matchp = 0 <= this. matchString (con, cop.condition, offset, dx, opts); >- } >- >- if (matchp) { >- op = cop.yes; >- } else if (cop.no != null) { >- op = cop.no; >- } else { >- op = cop.next; >- } >- } >- break; >- >- default: >- throw new RuntimeException("Unknown operation type: "+op.type); >- } // switch (op.type) >- } // while >- } >- >- private static final int getPreviousWordType(String target, int begin, int end, >- int offset, int opts) { >- int ret = getWordType(target, begin, end, --offset, opts); >- while (ret == WT_IGNORE) >- ret = getWordType(target, begin, end, --offset, opts); >- return ret; >- } >- >- private static final int getWordType(String target, int begin, int end, >- int offset, int opts) { >- if (offset < begin || offset >= end) return WT_OTHER; >- return getWordType0( target .charAt( offset ) , opts); >- } >- >- >- private static final boolean regionMatches(String text, int offset, int limit, >- String part, int partlen) { >- if (limit-offset < partlen) return false; >- return text.regionMatches(offset, part, 0, partlen); >- } >- >- private static final boolean regionMatches(String text, int offset, int limit, >- int offset2, int partlen) { >- if (limit-offset < partlen) return false; >- return text.regionMatches(offset, text, offset2, partlen); >- } >- >- private static final boolean regionMatchesIgnoreCase(String text, int offset, int limit, >- String part, int partlen) { >- return text.regionMatches(true, offset, part, 0, partlen); >- } >- >- private static final boolean regionMatchesIgnoreCase(String text, int offset, int limit, >- int offset2, int partlen) { >- if (limit-offset < partlen) return false; >- return text.regionMatches(true, offset, text, offset2, partlen); >- } >- >- >- >- >- >- >- >- /** >- * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not. >- * >- * @return true if the target is matched to this regular expression. >- */ >- public boolean matches(CharacterIterator target) { >- return this.matches(target, (Match)null); >- } >- >- >- /** >- * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not. >- * >- * @param match A Match instance for storing matching result. >- * @return Offset of the start position in <VAR>target</VAR>; or -1 if not match. >- */ >- public boolean matches(CharacterIterator target, Match match) { >- int start = target.getBeginIndex(); >- int end = target.getEndIndex(); >- >- >- >- synchronized (this) { >- if (this.operations == null) >- this.prepare(); >- if (this.context == null) >- this.context = new Context(); >- } >- Context con = null; >- synchronized (this.context) { >- con = this.context.inuse ? new Context() : this.context; >- con.reset(target, start, end, this.numberOfClosures); >- } >- if (match != null) { >- match.setNumberOfGroups(this.nofparen); >- match.setSource(target); >- } else if (this.hasBackReferences) { >- match = new Match(); >- match.setNumberOfGroups(this.nofparen); >- // Need not to call setSource() because >- // a caller can not access this match instance. >- } >- con.match = match; >- >- if (RegularExpression.isSet(this.options, XMLSCHEMA_MODE)) { >- int matchEnd = this. matchCharacterIterator (con, this.operations, con.start, 1, this.options); >- //System.err.println("DEBUG: matchEnd="+matchEnd); >- if (matchEnd == con.limit) { >- if (con.match != null) { >- con.match.setBeginning(0, con.start); >- con.match.setEnd(0, matchEnd); >- } >- con.inuse = false; >- return true; >- } >- return false; >- } >- >- /* >- * The pattern has only fixed string. >- * The engine uses Boyer-Moore. >- */ >- if (this.fixedStringOnly) { >- //System.err.println("DEBUG: fixed-only: "+this.fixedString); >- int o = this.fixedStringTable.matches(target, con.start, con.limit); >- if (o >= 0) { >- if (con.match != null) { >- con.match.setBeginning(0, o); >- con.match.setEnd(0, o+this.fixedString.length()); >- } >- con.inuse = false; >- return true; >- } >- con.inuse = false; >- return false; >- } >- >- /* >- * The pattern contains a fixed string. >- * The engine checks with Boyer-Moore whether the text contains the fixed string or not. >- * If not, it return with false. >- */ >- if (this.fixedString != null) { >- int o = this.fixedStringTable.matches(target, con.start, con.limit); >- if (o < 0) { >- //System.err.println("Non-match in fixed-string search."); >- con.inuse = false; >- return false; >- } >- } >- >- int limit = con.limit-this.minlength; >- int matchStart; >- int matchEnd = -1; >- >- /* >- * Checks whether the expression starts with ".*". >- */ >- if (this.operations != null >- && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) { >- if (isSet(this.options, SINGLE_LINE)) { >- matchStart = con.start; >- matchEnd = this. matchCharacterIterator (con, this.operations, con.start, 1, this.options); >- } else { >- boolean previousIsEOL = true; >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- int ch = target .setIndex( matchStart ) ; >- if (isEOLChar(ch)) { >- previousIsEOL = true; >- } else { >- if (previousIsEOL) { >- if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, >- matchStart, 1, this.options))) >- break; >- } >- previousIsEOL = false; >- } >- } >- } >- } >- >- /* >- * Optimization against the first character. >- */ >- else if (this.firstChar != null) { >- //System.err.println("DEBUG: with firstchar-matching: "+this.firstChar); >- RangeToken range = this.firstChar; >- if (RegularExpression.isSet(this.options, IGNORE_CASE)) { >- range = this.firstChar.getCaseInsensitiveToken(); >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- int ch = target .setIndex( matchStart ) ; >- if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) { >- ch = REUtil.composeFromSurrogates(ch, target .setIndex( matchStart+1 ) ); >- if (!range.match(ch)) continue; >- } else { >- if (!range.match(ch)) { >- char ch1 = Character.toUpperCase((char)ch); >- if (!range.match(ch1)) >- if (!range.match(Character.toLowerCase(ch1))) >- continue; >- } >- } >- if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, >- matchStart, 1, this.options))) >- break; >- } >- } else { >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- int ch = target .setIndex( matchStart ) ; >- if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) >- ch = REUtil.composeFromSurrogates(ch, target .setIndex( matchStart+1 ) ); >- if (!range.match(ch)) continue; >- if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, >- matchStart, 1, this.options))) >- break; >- } >- } >- } >- >- /* >- * Straightforward matching. >- */ >- else { >- for (matchStart = con.start; matchStart <= limit; matchStart ++) { >- if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, matchStart, 1, this.options))) >- break; >- } >- } >- >- if (matchEnd >= 0) { >- if (con.match != null) { >- con.match.setBeginning(0, matchStart); >- con.match.setEnd(0, matchEnd); >- } >- con.inuse = false; >- return true; >- } else { >- con.inuse = false; >- return false; >- } >- } >- >- /** >- * @return -1 when not match; offset of the end of matched string when match. >- */ >- private int matchCharacterIterator (Context con, Op op, int offset, int dx, int opts) { >- >- >- CharacterIterator target = con.ciTarget; >- >- >- >- >- >- >- while (true) { >- if (op == null) >- return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset; >- if (offset > con.limit || offset < con.start) >- return -1; >- switch (op.type) { >- case Op.CHAR: >- if (isSet(opts, IGNORE_CASE)) { >- int ch = op.getData(); >- if (dx > 0) { >- if (offset >= con.limit || !matchIgnoreCase(ch, target .setIndex( offset ) )) >- return -1; >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target .setIndex( o1 ) )) >- return -1; >- offset = o1; >- } >- } else { >- int ch = op.getData(); >- if (dx > 0) { >- if (offset >= con.limit || ch != target .setIndex( offset ) ) >- return -1; >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0 || ch != target .setIndex( o1 ) ) >- return -1; >- offset = o1; >- } >- } >- op = op.next; >- break; >- >- case Op.DOT: >- if (dx > 0) { >- if (offset >= con.limit) >- return -1; >- int ch = target .setIndex( offset ) ; >- if (isSet(opts, SINGLE_LINE)) { >- if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit) >- offset ++; >- } else { >- if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit) >- ch = REUtil.composeFromSurrogates(ch, target .setIndex( ++offset ) ); >- if (isEOLChar(ch)) >- return -1; >- } >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0) >- return -1; >- int ch = target .setIndex( o1 ) ; >- if (isSet(opts, SINGLE_LINE)) { >- if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) >- o1 --; >- } else { >- if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) >- ch = REUtil.composeFromSurrogates( target .setIndex( --o1 ) , ch); >- if (!isEOLChar(ch)) >- return -1; >- } >- offset = o1; >- } >- op = op.next; >- break; >- >- case Op.RANGE: >- case Op.NRANGE: >- if (dx > 0) { >- if (offset >= con.limit) >- return -1; >- int ch = target .setIndex( offset ) ; >- if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit) >- ch = REUtil.composeFromSurrogates(ch, target .setIndex( ++offset ) ); >- RangeToken tok = op.getToken(); >- if (isSet(opts, IGNORE_CASE)) { >- tok = tok.getCaseInsensitiveToken(); >- if (!tok.match(ch)) { >- if (ch >= 0x10000) return -1; >- char uch; >- if (!tok.match(uch = Character.toUpperCase((char)ch)) >- && !tok.match(Character.toLowerCase(uch))) >- return -1; >- } >- } else { >- if (!tok.match(ch)) return -1; >- } >- offset ++; >- } else { >- int o1 = offset-1; >- if (o1 >= con.limit || o1 < 0) >- return -1; >- int ch = target .setIndex( o1 ) ; >- if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) >- ch = REUtil.composeFromSurrogates( target .setIndex( --o1 ) , ch); >- RangeToken tok = op.getToken(); >- if (isSet(opts, IGNORE_CASE)) { >- tok = tok.getCaseInsensitiveToken(); >- if (!tok.match(ch)) { >- if (ch >= 0x10000) return -1; >- char uch; >- if (!tok.match(uch = Character.toUpperCase((char)ch)) >- && !tok.match(Character.toLowerCase(uch))) >- return -1; >- } >- } else { >- if (!tok.match(ch)) return -1; >- } >- offset = o1; >- } >- op = op.next; >- break; >- >- case Op.ANCHOR: >- boolean go = false; >- switch (op.getData()) { >- case '^': >- if (isSet(opts, MULTIPLE_LINES)) { >- if (!(offset == con.start >- || offset > con.start && isEOLChar( target .setIndex( offset-1 ) ))) >- return -1; >- } else { >- if (offset != con.start) >- return -1; >- } >- break; >- >- case '@': // Internal use only. >- // The @ always matches line beginnings. >- if (!(offset == con.start >- || offset > con.start && isEOLChar( target .setIndex( offset-1 ) ))) >- return -1; >- break; >- >- case '$': >- if (isSet(opts, MULTIPLE_LINES)) { >- if (!(offset == con.limit >- || offset < con.limit && isEOLChar( target .setIndex( offset ) ))) >- return -1; >- } else { >- if (!(offset == con.limit >- || offset+1 == con.limit && isEOLChar( target .setIndex( offset ) ) >- || offset+2 == con.limit && target .setIndex( offset ) == CARRIAGE_RETURN >- && target .setIndex( offset+1 ) == LINE_FEED)) >- return -1; >- } >- break; >- >- case 'A': >- if (offset != con.start) return -1; >- break; >- >- case 'Z': >- if (!(offset == con.limit >- || offset+1 == con.limit && isEOLChar( target .setIndex( offset ) ) >- || offset+2 == con.limit && target .setIndex( offset ) == CARRIAGE_RETURN >- && target .setIndex( offset+1 ) == LINE_FEED)) >- return -1; >- break; >- >- case 'z': >- if (offset != con.limit) return -1; >- break; >- >- case 'b': >- if (con.length == 0) return -1; >- { >- int after = getWordType(target, con.start, con.limit, offset, opts); >- if (after == WT_IGNORE) return -1; >- int before = getPreviousWordType(target, con.start, con.limit, offset, opts); >- if (after == before) return -1; >- } >- break; >- >- case 'B': >- if (con.length == 0) >- go = true; >- else { >- int after = getWordType(target, con.start, con.limit, offset, opts); >- go = after == WT_IGNORE >- || after == getPreviousWordType(target, con.start, con.limit, offset, opts); >- } >- if (!go) return -1; >- break; >- >- case '<': >- if (con.length == 0 || offset == con.limit) return -1; >- if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER >- || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER) >- return -1; >- break; >- >- case '>': >- if (con.length == 0 || offset == con.start) return -1; >- if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER >- || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER) >- return -1; >- break; >- } // switch anchor type >- op = op.next; >- break; >- >- case Op.BACKREFERENCE: >- { >- int refno = op.getData(); >- if (refno <= 0 || refno >= this.nofparen) >- throw new RuntimeException("Internal Error: Reference number must be more than zero: "+refno); >- if (con.match.getBeginning(refno) < 0 >- || con.match.getEnd(refno) < 0) >- return -1; // ******** >- int o2 = con.match.getBeginning(refno); >- int literallen = con.match.getEnd(refno)-o2; >- if (!isSet(opts, IGNORE_CASE)) { >- if (dx > 0) { >- if (!regionMatches(target, offset, con.limit, o2, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatches(target, offset-literallen, con.limit, o2, literallen)) >- return -1; >- offset -= literallen; >- } >- } else { >- if (dx > 0) { >- if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit, >- o2, literallen)) >- return -1; >- offset -= literallen; >- } >- } >- } >- op = op.next; >- break; >- case Op.STRING: >- { >- String literal = op.getString(); >- int literallen = literal.length(); >- if (!isSet(opts, IGNORE_CASE)) { >- if (dx > 0) { >- if (!regionMatches(target, offset, con.limit, literal, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatches(target, offset-literallen, con.limit, literal, literallen)) >- return -1; >- offset -= literallen; >- } >- } else { >- if (dx > 0) { >- if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen)) >- return -1; >- offset += literallen; >- } else { >- if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit, >- literal, literallen)) >- return -1; >- offset -= literallen; >- } >- } >- } >- op = op.next; >- break; >- >- case Op.CLOSURE: >- { >- /* >- * Saves current position to avoid >- * zero-width repeats. >- */ >- int id = op.getData(); >- if (id >= 0) { >- int previousOffset = con.offsets[id]; >- if (previousOffset < 0 || previousOffset != offset) { >- con.offsets[id] = offset; >- } else { >- con.offsets[id] = -1; >- op = op.next; >- break; >- } >- } >- >- int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, opts); >- if (id >= 0) con.offsets[id] = -1; >- if (ret >= 0) return ret; >- op = op.next; >- } >- break; >- >- case Op.QUESTION: >- { >- int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, opts); >- if (ret >= 0) return ret; >- op = op.next; >- } >- break; >- >- case Op.NONGREEDYCLOSURE: >- case Op.NONGREEDYQUESTION: >- { >- int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts); >- if (ret >= 0) return ret; >- op = op.getChild(); >- } >- break; >- >- case Op.UNION: >- for (int i = 0; i < op.size(); i ++) { >- int ret = this. matchCharacterIterator (con, op.elementAt(i), offset, dx, opts); >- if (DEBUG) { >- System.err.println("UNION: "+i+", ret="+ret); >- } >- if (ret >= 0) return ret; >- } >- return -1; >- >- case Op.CAPTURE: >- int refno = op.getData(); >- if (con.match != null && refno > 0) { >- int save = con.match.getBeginning(refno); >- con.match.setBeginning(refno, offset); >- int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts); >- if (ret < 0) con.match.setBeginning(refno, save); >- return ret; >- } else if (con.match != null && refno < 0) { >- int index = -refno; >- int save = con.match.getEnd(index); >- con.match.setEnd(index, offset); >- int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts); >- if (ret < 0) con.match.setEnd(index, save); >- return ret; >- } >- op = op.next; >- break; >- >- case Op.LOOKAHEAD: >- if (0 > this. matchCharacterIterator (con, op.getChild(), offset, 1, opts)) return -1; >- op = op.next; >- break; >- case Op.NEGATIVELOOKAHEAD: >- if (0 <= this. matchCharacterIterator (con, op.getChild(), offset, 1, opts)) return -1; >- op = op.next; >- break; >- case Op.LOOKBEHIND: >- if (0 > this. matchCharacterIterator (con, op.getChild(), offset, -1, opts)) return -1; >- op = op.next; >- break; >- case Op.NEGATIVELOOKBEHIND: >- if (0 <= this. matchCharacterIterator (con, op.getChild(), offset, -1, opts)) return -1; >- op = op.next; >- break; >- >- case Op.INDEPENDENT: >- { >- int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, opts); >- if (ret < 0) return ret; >- offset = ret; >- op = op.next; >- } >- break; >- >- case Op.MODIFIER: >- { >- int localopts = opts; >- localopts |= op.getData(); >- localopts &= ~op.getData2(); >- //System.err.println("MODIFIER: "+Integer.toString(opts, 16)+" -> "+Integer.toString(localopts, 16)); >- int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, localopts); >- if (ret < 0) return ret; >- offset = ret; >- op = op.next; >- } >- break; >- >- case Op.CONDITION: >- { >- Op.ConditionOp cop = (Op.ConditionOp)op; >- boolean matchp = false; >- if (cop.refNumber > 0) { >- if (cop.refNumber >= this.nofparen) >- throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber); >- matchp = con.match.getBeginning(cop.refNumber) >= 0 >- && con.match.getEnd(cop.refNumber) >= 0; >- } else { >- matchp = 0 <= this. matchCharacterIterator (con, cop.condition, offset, dx, opts); >- } >- >- if (matchp) { >- op = cop.yes; >- } else if (cop.no != null) { >- op = cop.no; >- } else { >- op = cop.next; >- } >- } >- break; >- >- default: >- throw new RuntimeException("Unknown operation type: "+op.type); >- } // switch (op.type) >- } // while >- } >- >- private static final int getPreviousWordType(CharacterIterator target, int begin, int end, >- int offset, int opts) { >- int ret = getWordType(target, begin, end, --offset, opts); >- while (ret == WT_IGNORE) >- ret = getWordType(target, begin, end, --offset, opts); >- return ret; >- } >- >- private static final int getWordType(CharacterIterator target, int begin, int end, >- int offset, int opts) { >- if (offset < begin || offset >= end) return WT_OTHER; >- return getWordType0( target .setIndex( offset ) , opts); >- } >- >- >- >- private static final boolean regionMatches(CharacterIterator target, int offset, int limit, >- String part, int partlen) { >- if (offset < 0) return false; >- if (limit-offset < partlen) >- return false; >- int i = 0; >- while (partlen-- > 0) { >- if ( target .setIndex( offset++ ) != part.charAt(i++)) >- return false; >- } >- return true; >- } >- >- private static final boolean regionMatches(CharacterIterator target, int offset, int limit, >- int offset2, int partlen) { >- if (offset < 0) return false; >- if (limit-offset < partlen) >- return false; >- int i = offset2; >- while (partlen-- > 0) { >- if ( target .setIndex( offset++ ) != target .setIndex( i++ ) ) >- return false; >- } >- return true; >- } >- >- /** >- * @see java.lang.String#regionMatches >- */ >- private static final boolean regionMatchesIgnoreCase(CharacterIterator target, int offset, int limit, >- String part, int partlen) { >- if (offset < 0) return false; >- if (limit-offset < partlen) >- return false; >- int i = 0; >- while (partlen-- > 0) { >- char ch1 = target .setIndex( offset++ ) ; >- char ch2 = part.charAt(i++); >- if (ch1 == ch2) >- continue; >- char uch1 = Character.toUpperCase(ch1); >- char uch2 = Character.toUpperCase(ch2); >- if (uch1 == uch2) >- continue; >- if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2)) >- return false; >- } >- return true; >- } >- >- private static final boolean regionMatchesIgnoreCase(CharacterIterator target, int offset, int limit, >- int offset2, int partlen) { >- if (offset < 0) return false; >- if (limit-offset < partlen) >- return false; >- int i = offset2; >- while (partlen-- > 0) { >- char ch1 = target .setIndex( offset++ ) ; >- char ch2 = target .setIndex( i++ ) ; >- if (ch1 == ch2) >- continue; >- char uch1 = Character.toUpperCase(ch1); >- char uch2 = Character.toUpperCase(ch2); >- if (uch1 == uch2) >- continue; >- if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2)) >- return false; >- } >- return true; >- } >- >- >- >- >- // ================================================================ >- >- /** >- * A regular expression. >- * @serial >- */ >- String regex; >- /** >- * @serial >- */ >- int options; >- >- /** >- * The number of parenthesis in the regular expression. >- * @serial >- */ >- int nofparen; >- /** >- * Internal representation of the regular expression. >- * @serial >- */ >- Token tokentree; >- >- boolean hasBackReferences = false; >- >- transient int minlength; >- transient Op operations = null; >- transient int numberOfClosures; >- transient Context context = null; >- transient RangeToken firstChar = null; >- >- transient String fixedString = null; >- transient int fixedStringOptions; >- transient BMPattern fixedStringTable = null; >- transient boolean fixedStringOnly = false; >- >- >- static final class Context { >- CharacterIterator ciTarget; >- String strTarget; >- char[] charTarget; >- int start; >- int limit; >- int length; >- Match match; >- boolean inuse = false; >- int[] offsets; >- >- Context() { >- } >- >- private void resetCommon(int nofclosures) { >- this.length = this.limit-this.start; >- this.inuse = true; >- this.match = null; >- if (this.offsets == null || this.offsets.length != nofclosures) >- this.offsets = new int[nofclosures]; >- for (int i = 0; i < nofclosures; i ++) this.offsets[i] = -1; >- } >- void reset(CharacterIterator target, int start, int limit, int nofclosures) { >- this.ciTarget = target; >- this.start = start; >- this.limit = limit; >- this.resetCommon(nofclosures); >- } >- void reset(String target, int start, int limit, int nofclosures) { >- this.strTarget = target; >- this.start = start; >- this.limit = limit; >- this.resetCommon(nofclosures); >- } >- void reset(char[] target, int start, int limit, int nofclosures) { >- this.charTarget = target; >- this.start = start; >- this.limit = limit; >- this.resetCommon(nofclosures); >- } >- } >- >- /** >- * Prepares for matching. This method is called just before starting matching. >- */ >- void prepare() { >- if (Op.COUNT) Op.nofinstances = 0; >- this.compile(this.tokentree); >- /* >- if (this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) { // .* >- Op anchor = Op.createAnchor(isSet(this.options, SINGLE_LINE) ? 'A' : '@'); >- anchor.next = this.operations; >- this.operations = anchor; >- } >- */ >- if (Op.COUNT) System.err.println("DEBUG: The number of operations: "+Op.nofinstances); >- >- this.minlength = this.tokentree.getMinLength(); >- >- this.firstChar = null; >- if (!isSet(this.options, PROHIBIT_HEAD_CHARACTER_OPTIMIZATION) >- && !isSet(this.options, XMLSCHEMA_MODE)) { >- RangeToken firstChar = Token.createRange(); >- int fresult = this.tokentree.analyzeFirstCharacter(firstChar, this.options); >- if (fresult == Token.FC_TERMINAL) { >- firstChar.compactRanges(); >- this.firstChar = firstChar; >- if (DEBUG) >- System.err.println("DEBUG: Use the first character optimization: "+firstChar); >- } >- } >- >- if (this.operations != null >- && (this.operations.type == Op.STRING || this.operations.type == Op.CHAR) >- && this.operations.next == null) { >- if (DEBUG) >- System.err.print(" *** Only fixed string! *** "); >- this.fixedStringOnly = true; >- if (this.operations.type == Op.STRING) >- this.fixedString = this.operations.getString(); >- else if (this.operations.getData() >= 0x10000) { // Op.CHAR >- this.fixedString = REUtil.decomposeToSurrogates(this.operations.getData()); >- } else { >- char[] ac = new char[1]; >- ac[0] = (char)this.operations.getData(); >- this.fixedString = new String(ac); >- } >- this.fixedStringOptions = this.options; >- this.fixedStringTable = new BMPattern(this.fixedString, 256, >- isSet(this.fixedStringOptions, IGNORE_CASE)); >- } else if (!isSet(this.options, PROHIBIT_FIXED_STRING_OPTIMIZATION) >- && !isSet(this.options, XMLSCHEMA_MODE)) { >- Token.FixedStringContainer container = new Token.FixedStringContainer(); >- this.tokentree.findFixedString(container, this.options); >- this.fixedString = container.token == null ? null : container.token.getString(); >- this.fixedStringOptions = container.options; >- if (this.fixedString != null && this.fixedString.length() < 2) >- this.fixedString = null; >- // This pattern has a fixed string of which length is more than one. >- if (this.fixedString != null) { >- this.fixedStringTable = new BMPattern(this.fixedString, 256, >- isSet(this.fixedStringOptions, IGNORE_CASE)); >- if (DEBUG) { >- System.err.println("DEBUG: The longest fixed string: "+this.fixedString.length() >- +"/" //+this.fixedString >- +"/"+REUtil.createOptionString(this.fixedStringOptions)); >- System.err.print("String: "); >- REUtil.dumpString(this.fixedString); >- } >- } >- } >- } >- >- /** >- * An option. >- * If you specify this option, <span class="REGEX"><kbd>(</kbd><var>X</var><kbd>)</kbd></span> >- * captures matched text, and <span class="REGEX"><kbd>(:?</kbd><var>X</var><kbd>)</kbd></span> >- * does not capture. >- * >- * @see #RegularExpression(java.lang.String,int) >- * @see #setPattern(java.lang.String,int) >- static final int MARK_PARENS = 1<<0; >- */ >- >- /** >- * "i" >- */ >- static final int IGNORE_CASE = 1<<1; >- >- /** >- * "s" >- */ >- static final int SINGLE_LINE = 1<<2; >- >- /** >- * "m" >- */ >- static final int MULTIPLE_LINES = 1<<3; >- >- /** >- * "x" >- */ >- static final int EXTENDED_COMMENT = 1<<4; >- >- /** >- * This option redefines <span class="REGEX"><kbd>\d \D \w \W \s \S</kbd></span>. >- * >- * @see #RegularExpression(java.lang.String,int) >- * @see #setPattern(java.lang.String,int) >- * @see #UNICODE_WORD_BOUNDARY >- */ >- static final int USE_UNICODE_CATEGORY = 1<<5; // "u" >- >- /** >- * An option. >- * This enables to process locale-independent word boundary for <span class="REGEX"><kbd>\b \B \< \></kbd></span>. >- * <p>By default, the engine considers a position between a word character >- * (<span class="REGEX"><Kbd>\w</kbd></span>) and a non word character >- * is a word boundary. >- * <p>By this option, the engine checks word boundaries with the method of >- * 'Unicode Regular Expression Guidelines' Revision 4. >- * >- * @see #RegularExpression(java.lang.String,int) >- * @see #setPattern(java.lang.String,int) >- */ >- static final int UNICODE_WORD_BOUNDARY = 1<<6; // "w" >- >- /** >- * "H" >- */ >- static final int PROHIBIT_HEAD_CHARACTER_OPTIMIZATION = 1<<7; >- /** >- * "F" >- */ >- static final int PROHIBIT_FIXED_STRING_OPTIMIZATION = 1<<8; >- /** >- * "X". XML Schema mode. >- */ >- static final int XMLSCHEMA_MODE = 1<<9; >- /** >- * ",". >- */ >- static final int SPECIAL_COMMA = 1<<10; >- >- >- private static final boolean isSet(int options, int flag) { >- return (options & flag) == flag; >- } >- >- /** >- * Creates a new RegularExpression instance. >- * >- * @param regex A regular expression >- * @exception org.apache.xerces.utils.regex.ParseException <VAR>regex</VAR> is not conforming to the syntax. >- */ >- public RegularExpression(String regex) throws ParseException { >- this.setPattern(regex, null); >- } >- >- /** >- * Creates a new RegularExpression instance with options. >- * >- * @param regex A regular expression >- * @param options A String consisted of "i" "m" "s" "u" "w" "," "X" >- * @exception org.apache.xerces.utils.regex.ParseException <VAR>regex</VAR> is not conforming to the syntax. >- */ >- public RegularExpression(String regex, String options) throws ParseException { >- this.setPattern(regex, options); >- } >- >- RegularExpression(String regex, Token tok, int parens, boolean hasBackReferences, int options) { >- this.regex = regex; >- this.tokentree = tok; >- this.nofparen = parens; >- this.options = options; >- this.hasBackReferences = hasBackReferences; >- } >- >- /** >- * >- */ >- public void setPattern(String newPattern) throws ParseException { >- this.setPattern(newPattern, this.options); >- } >- >- private void setPattern(String newPattern, int options) throws ParseException { >- this.regex = newPattern; >- this.options = options; >- RegexParser rp = RegularExpression.isSet(this.options, RegularExpression.XMLSCHEMA_MODE) >- ? new ParserForXMLSchema() : new RegexParser(); >- this.tokentree = rp.parse(this.regex, this.options); >- this.nofparen = rp.parennumber; >- this.hasBackReferences = rp.hasBackReferences; >- >- this.operations = null; >- this.context = null; >- } >- /** >- * >- */ >- public void setPattern(String newPattern, String options) throws ParseException { >- this.setPattern(newPattern, REUtil.parseOptions(options)); >- } >- >- /** >- * >- */ >- public String getPattern() { >- return this.regex; >- } >- >- /** >- * Represents this instence in String. >- */ >- public String toString() { >- return this.tokentree.toString(this.options); >- } >- >- /** >- * Returns a option string. >- * The order of letters in it may be different from a string specified >- * in a constructor or <code>setPattern()</code>. >- * >- * @see #RegularExpression(String, String) >- * @see #setPattern(java.lang.String,java.lang.String) >- */ >- public String getOptions() { >- return REUtil.createOptionString(this.options); >- } >- >- /** >- * Return true if patterns are the same and the options are equivalent. >- */ >- public boolean equals(Object obj) { >- if (obj == null) return false; >- if (!(obj instanceof RegularExpression)) >- return false; >- RegularExpression r = (RegularExpression)obj; >- return this.regex.equals(r.regex) && this.options == r.options; >- } >- >- boolean equals(String pattern, int options) { >- return this.regex.equals(pattern) && this.options == options; >- } >- >- /** >- * >- */ >- public int hashCode() { >- return (this.regex+"/"+this.getOptions()).hashCode(); >- } >- >- /** >- * Return the number of regular expression groups. >- * This method returns 1 when the regular expression has no capturing-parenthesis. >- * >- */ >- public int getNumberOfGroups() { >- return this.nofparen; >- } >- >- // ================================================================ >- >- private static final int WT_IGNORE = 0; >- private static final int WT_LETTER = 1; >- private static final int WT_OTHER = 2; >- private static final int getWordType0(char ch, int opts) { >- if (!isSet(opts, UNICODE_WORD_BOUNDARY)) { >- if (isSet(opts, USE_UNICODE_CATEGORY)) { >- return (Token.getRange("IsWord", true).match(ch)) ? WT_LETTER : WT_OTHER; >- } >- return isWordChar(ch) ? WT_LETTER : WT_OTHER; >- } >- >- switch (Character.getType(ch)) { >- case Character.UPPERCASE_LETTER: // L >- case Character.LOWERCASE_LETTER: // L >- case Character.TITLECASE_LETTER: // L >- case Character.MODIFIER_LETTER: // L >- case Character.OTHER_LETTER: // L >- case Character.LETTER_NUMBER: // N >- case Character.DECIMAL_DIGIT_NUMBER: // N >- case Character.OTHER_NUMBER: // N >- case Character.COMBINING_SPACING_MARK: // Mc >- return WT_LETTER; >- >- case Character.FORMAT: // Cf >- case Character.NON_SPACING_MARK: // Mn >- case Character.ENCLOSING_MARK: // Mc >- return WT_IGNORE; >- >- case Character.CONTROL: // Cc >- switch (ch) { >- case '\t': >- case '\n': >- case '\u000B': >- case '\f': >- case '\r': >- return WT_OTHER; >- default: >- return WT_IGNORE; >- } >- >- default: >- return WT_OTHER; >- } >- } >- >- // ================================================================ >- >- static final int LINE_FEED = 0x000A; >- static final int CARRIAGE_RETURN = 0x000D; >- static final int LINE_SEPARATOR = 0x2028; >- static final int PARAGRAPH_SEPARATOR = 0x2029; >- >- private static final boolean isEOLChar(int ch) { >- return ch == LINE_FEED || ch == CARRIAGE_RETURN || ch == LINE_SEPARATOR >- || ch == PARAGRAPH_SEPARATOR; >- } >- >- private static final boolean isWordChar(int ch) { // Legacy word characters >- if (ch == '_') return true; >- if (ch < '0') return false; >- if (ch > 'z') return false; >- if (ch <= '9') return true; >- if (ch < 'A') return false; >- if (ch <= 'Z') return true; >- if (ch < 'a') return false; >- return true; >- } >- >- private static final boolean matchIgnoreCase(int chardata, int ch) { >- if (chardata == ch) return true; >- if (chardata > 0xffff || ch > 0xffff) return false; >- char uch1 = Character.toUpperCase((char)chardata); >- char uch2 = Character.toUpperCase((char)ch); >- if (uch1 == uch2) return true; >- return Character.toLowerCase(uch1) == Character.toLowerCase(uch2); >- } >- } >- >- public static class ParseException extends RuntimeException { >- int location; >- >- /* >- public ParseException(String mes) { >- this(mes, -1); >- } >- */ >- /** >- * >- */ >- public ParseException(String mes, int location) { >- super(mes); >- this.location = location; >- } >- >- /** >- * >- * @return -1 if location information is not available. >- */ >- public int getLocation() { >- return this.location; >- } >-} >- >- static class Op { >- static final int DOT = 0; >- static final int CHAR = 1; // Single character >- static final int RANGE = 3; // [a-zA-Z] >- static final int NRANGE = 4; // [^a-zA-Z] >- static final int ANCHOR = 5; // ^ $ ... >- static final int STRING = 6; // literal String >- static final int CLOSURE = 7; // X* >- static final int NONGREEDYCLOSURE = 8; // X*? >- static final int QUESTION = 9; // X? >- static final int NONGREEDYQUESTION = 10; // X?? >- static final int UNION = 11; // X|Y >- static final int CAPTURE = 15; // ( and ) >- static final int BACKREFERENCE = 16; // \1 \2 ... >- static final int LOOKAHEAD = 20; // (?=...) >- static final int NEGATIVELOOKAHEAD = 21; // (?!...) >- static final int LOOKBEHIND = 22; // (?<=...) >- static final int NEGATIVELOOKBEHIND = 23; // (?<!...) >- static final int INDEPENDENT = 24; // (?>...) >- static final int MODIFIER = 25; // (?ims-ims:...) >- static final int CONDITION = 26; // (?(..)yes|no) >- >- static int nofinstances = 0; >- static final boolean COUNT = false; >- >- static Op createDot() { >- if (Op.COUNT) Op.nofinstances ++; >- return new Op(Op.DOT); >- } >- static CharOp createChar(int data) { >- if (Op.COUNT) Op.nofinstances ++; >- return new CharOp(Op.CHAR, data); >- } >- static CharOp createAnchor(int data) { >- if (Op.COUNT) Op.nofinstances ++; >- return new CharOp(Op.ANCHOR, data); >- } >- static CharOp createCapture(int number, Op next) { >- if (Op.COUNT) Op.nofinstances ++; >- CharOp op = new CharOp(Op.CAPTURE, number); >- op.next = next; >- return op; >- } >- static UnionOp createUnion(int size) { >- if (Op.COUNT) Op.nofinstances ++; >- //System.err.println("Creates UnionOp"); >- return new UnionOp(Op.UNION, size); >- } >- static ChildOp createClosure(int id) { >- if (Op.COUNT) Op.nofinstances ++; >- return new ModifierOp(Op.CLOSURE, id, -1); >- } >- static ChildOp createNonGreedyClosure() { >- if (Op.COUNT) Op.nofinstances ++; >- return new ChildOp(Op.NONGREEDYCLOSURE); >- } >- static ChildOp createQuestion(boolean nongreedy) { >- if (Op.COUNT) Op.nofinstances ++; >- return new ChildOp(nongreedy ? Op.NONGREEDYQUESTION : Op.QUESTION); >- } >- static RangeOp createRange(Token tok) { >- if (Op.COUNT) Op.nofinstances ++; >- return new RangeOp(Op.RANGE, tok); >- } >- static ChildOp createLook(int type, Op next, Op branch) { >- if (Op.COUNT) Op.nofinstances ++; >- ChildOp op = new ChildOp(type); >- op.setChild(branch); >- op.next = next; >- return op; >- } >- static CharOp createBackReference(int refno) { >- if (Op.COUNT) Op.nofinstances ++; >- return new CharOp(Op.BACKREFERENCE, refno); >- } >- static StringOp createString(String literal) { >- if (Op.COUNT) Op.nofinstances ++; >- return new StringOp(Op.STRING, literal); >- } >- static ChildOp createIndependent(Op next, Op branch) { >- if (Op.COUNT) Op.nofinstances ++; >- ChildOp op = new ChildOp(Op.INDEPENDENT); >- op.setChild(branch); >- op.next = next; >- return op; >- } >- static ModifierOp createModifier(Op next, Op branch, int add, int mask) { >- if (Op.COUNT) Op.nofinstances ++; >- ModifierOp op = new ModifierOp(Op.MODIFIER, add, mask); >- op.setChild(branch); >- op.next = next; >- return op; >- } >- static ConditionOp createCondition(Op next, int ref, Op conditionflow, Op yesflow, Op noflow) { >- if (Op.COUNT) Op.nofinstances ++; >- ConditionOp op = new ConditionOp(Op.CONDITION, ref, conditionflow, yesflow, noflow); >- op.next = next; >- return op; >- } >- >- int type; >- Op next = null; >- >- protected Op(int type) { >- this.type = type; >- } >- >- int size() { // for UNION >- return 0; >- } >- Op elementAt(int index) { // for UNIoN >- throw new RuntimeException("Internal Error: type="+this.type); >- } >- Op getChild() { // for CLOSURE, QUESTION >- throw new RuntimeException("Internal Error: type="+this.type); >- } >- // ModifierOp >- int getData() { // CharOp for CHAR, BACKREFERENCE, CAPTURE, ANCHOR, >- throw new RuntimeException("Internal Error: type="+this.type); >- } >- int getData2() { // ModifierOp >- throw new RuntimeException("Internal Error: type="+this.type); >- } >- RangeToken getToken() { // RANGE, NRANGE >- throw new RuntimeException("Internal Error: type="+this.type); >- } >- String getString() { // STRING >- throw new RuntimeException("Internal Error: type="+this.type); >- } >- >- // ================================================================ >- static class CharOp extends Op { >- int charData; >- CharOp(int type, int data) { >- super(type); >- this.charData = data; >- } >- int getData() { >- return this.charData; >- } >- } >- >- // ================================================================ >- static class UnionOp extends Op { >- Vector branches; >- UnionOp(int type, int size) { >- super(type); >- this.branches = new Vector(size); >- } >- void addElement(Op op) { >- this.branches.addElement(op); >- } >- int size() { >- return this.branches.size(); >- } >- Op elementAt(int index) { >- return (Op)this.branches.elementAt(index); >- } >- } >- >- // ================================================================ >- static class ChildOp extends Op { >- Op child; >- ChildOp(int type) { >- super(type); >- } >- void setChild(Op child) { >- this.child = child; >- } >- Op getChild() { >- return this.child; >- } >- } >- // ================================================================ >- static class ModifierOp extends ChildOp { >- int v1; >- int v2; >- ModifierOp(int type, int v1, int v2) { >- super(type); >- this.v1 = v1; >- this.v2 = v2; >- } >- int getData() { >- return this.v1; >- } >- int getData2() { >- return this.v2; >- } >- } >- // ================================================================ >- static class RangeOp extends Op { >- Token tok; >- RangeOp(int type, Token tok) { >- super(type); >- this.tok = tok; >- } >- RangeToken getToken() { >- return (RangeToken)this.tok; >- } >- } >- // ================================================================ >- static class StringOp extends Op { >- String string; >- StringOp(int type, String literal) { >- super(type); >- this.string = literal; >- } >- String getString() { >- return this.string; >- } >- } >- // ================================================================ >- static class ConditionOp extends Op { >- int refNumber; >- Op condition; >- Op yes; >- Op no; >- ConditionOp(int type, int refno, Op conditionflow, Op yesflow, Op noflow) { >- super(type); >- this.refNumber = refno; >- this.condition = conditionflow; >- this.yes = yesflow; >- this.no = noflow; >- } >- } >-} >- >- final static class RangeToken extends Token implements java.io.Serializable { >- >- int[] ranges; >- boolean sorted; >- boolean compacted; >- RangeToken icaseCache = null; >- int[] map = null; >- int nonMapIndex; >- >- RangeToken(int type) { >- super(type); >- this.setSorted(false); >- } >- >- // for RANGE or NRANGE >- protected void addRange(int start, int end) { >- this.icaseCache = null; >- //System.err.println("Token#addRange(): "+start+" "+end); >- int r1, r2; >- if (start <= end) { >- r1 = start; >- r2 = end; >- } else { >- r1 = end; >- r2 = start; >- } >- >- int pos = 0; >- if (this.ranges == null) { >- this.ranges = new int[2]; >- this.ranges[0] = r1; >- this.ranges[1] = r2; >- this.setSorted(true); >- } else { >- pos = this.ranges.length; >- if (this.ranges[pos-1]+1 == r1) { >- this.ranges[pos-1] = r2; >- return; >- } >- int[] temp = new int[pos+2]; >- System.arraycopy(this.ranges, 0, temp, 0, pos); >- this.ranges = temp; >- if (this.ranges[pos-1] >= r1) >- this.setSorted(false); >- this.ranges[pos++] = r1; >- this.ranges[pos] = r2; >- if (!this.sorted) >- this.sortRanges(); >- } >- } >- >- private final boolean isSorted() { >- return this.sorted; >- } >- private final void setSorted(boolean sort) { >- this.sorted = sort; >- if (!sort) this.compacted = false; >- } >- private final boolean isCompacted() { >- return this.compacted; >- } >- private final void setCompacted() { >- this.compacted = true; >- } >- >- protected void sortRanges() { >- if (this.isSorted()) >- return; >- if (this.ranges == null) >- return; >- //System.err.println("Do sorting: "+this.ranges.length); >- >- // Bubble sort >- // Why? -- In many cases, >- // this.ranges has few elements. >- for (int i = this.ranges.length-4; i >= 0; i -= 2) { >- for (int j = 0; j <= i; j += 2) { >- if (this.ranges[j] > this.ranges[j+2] >- || this.ranges[j] == this.ranges[j+2] && this.ranges[j+1] > this.ranges[j+3]) { >- int tmp; >- tmp = this.ranges[j+2]; >- this.ranges[j+2] = this.ranges[j]; >- this.ranges[j] = tmp; >- tmp = this.ranges[j+3]; >- this.ranges[j+3] = this.ranges[j+1]; >- this.ranges[j+1] = tmp; >- } >- } >- } >- this.setSorted(true); >- } >- >- /** >- * this.ranges is sorted. >- */ >- protected void compactRanges() { >- boolean DEBUG = false; >- if (this.ranges == null || this.ranges.length <= 2) >- return; >- if (this.isCompacted()) >- return; >- int base = 0; // Index of writing point >- int target = 0; // Index of processing point >- >- while (target < this.ranges.length) { >- if (base != target) { >- this.ranges[base] = this.ranges[target++]; >- this.ranges[base+1] = this.ranges[target++]; >- } else >- target += 2; >- int baseend = this.ranges[base+1]; >- while (target < this.ranges.length) { >- if (baseend+1 < this.ranges[target]) >- break; >- if (baseend+1 == this.ranges[target]) { >- if (DEBUG) >- System.err.println("Token#compactRanges(): Compaction: ["+this.ranges[base] >- +", "+this.ranges[base+1] >- +"], ["+this.ranges[target] >- +", "+this.ranges[target+1] >- +"] -> ["+this.ranges[base] >- +", "+this.ranges[target+1] >- +"]"); >- this.ranges[base+1] = this.ranges[target+1]; >- baseend = this.ranges[base+1]; >- target += 2; >- } else if (baseend >= this.ranges[target+1]) { >- if (DEBUG) >- System.err.println("Token#compactRanges(): Compaction: ["+this.ranges[base] >- +", "+this.ranges[base+1] >- +"], ["+this.ranges[target] >- +", "+this.ranges[target+1] >- +"] -> ["+this.ranges[base] >- +", "+this.ranges[base+1] >- +"]"); >- target += 2; >- } else if (baseend < this.ranges[target+1]) { >- if (DEBUG) >- System.err.println("Token#compactRanges(): Compaction: ["+this.ranges[base] >- +", "+this.ranges[base+1] >- +"], ["+this.ranges[target] >- +", "+this.ranges[target+1] >- +"] -> ["+this.ranges[base] >- +", "+this.ranges[target+1] >- +"]"); >- this.ranges[base+1] = this.ranges[target+1]; >- baseend = this.ranges[base+1]; >- target += 2; >- } else { >- throw new RuntimeException("Token#compactRanges(): Internel Error: [" >- +this.ranges[base] >- +","+this.ranges[base+1] >- +"] ["+this.ranges[target] >- +","+this.ranges[target+1]+"]"); >- } >- } // while >- base += 2; >- } >- >- if (base != this.ranges.length) { >- int[] result = new int[base]; >- System.arraycopy(this.ranges, 0, result, 0, base); >- this.ranges = result; >- } >- this.setCompacted(); >- } >- >- protected void mergeRanges(Token token) { >- RangeToken tok = (RangeToken)token; >- this.sortRanges(); >- tok.sortRanges(); >- if (tok.ranges == null) >- return; >- this.icaseCache = null; >- this.setSorted(true); >- if (this.ranges == null) { >- this.ranges = new int[tok.ranges.length]; >- System.arraycopy(tok.ranges, 0, this.ranges, 0, tok.ranges.length); >- return; >- } >- int[] result = new int[this.ranges.length+tok.ranges.length]; >- for (int i = 0, j = 0, k = 0; i < this.ranges.length || j < tok.ranges.length;) { >- if (i >= this.ranges.length) { >- result[k++] = tok.ranges[j++]; >- result[k++] = tok.ranges[j++]; >- } else if (j >= tok.ranges.length) { >- result[k++] = this.ranges[i++]; >- result[k++] = this.ranges[i++]; >- } else if (tok.ranges[j] < this.ranges[i] >- || tok.ranges[j] == this.ranges[i] && tok.ranges[j+1] < this.ranges[i+1]) { >- result[k++] = tok.ranges[j++]; >- result[k++] = tok.ranges[j++]; >- } else { >- result[k++] = this.ranges[i++]; >- result[k++] = this.ranges[i++]; >- } >- } >- this.ranges = result; >- } >- >- protected void subtractRanges(Token token) { >- if (token.type == NRANGE) { >- this.intersectRanges(token); >- return; >- } >- RangeToken tok = (RangeToken)token; >- if (tok.ranges == null || this.ranges == null) >- return; >- this.icaseCache = null; >- this.sortRanges(); >- this.compactRanges(); >- tok.sortRanges(); >- tok.compactRanges(); >- >- //System.err.println("Token#substractRanges(): Entry: "+this.ranges.length+", "+tok.ranges.length); >- >- int[] result = new int[this.ranges.length+tok.ranges.length]; >- int wp = 0, src = 0, sub = 0; >- while (src < this.ranges.length && sub < tok.ranges.length) { >- int srcbegin = this.ranges[src]; >- int srcend = this.ranges[src+1]; >- int subbegin = tok.ranges[sub]; >- int subend = tok.ranges[sub+1]; >- if (srcend < subbegin) { // Not overlapped >- // src: o-----o >- // sub: o-----o >- // res: o-----o >- // Reuse sub >- result[wp++] = this.ranges[src++]; >- result[wp++] = this.ranges[src++]; >- } else if (srcend >= subbegin >- && srcbegin <= subend) { // Overlapped >- // src: o--------o >- // sub: o----o >- // sub: o----o >- // sub: o----o >- // sub: o------------o >- if (subbegin <= srcbegin && srcend <= subend) { >- // src: o--------o >- // sub: o------------o >- // res: empty >- // Reuse sub >- src += 2; >- } else if (subbegin <= srcbegin) { >- // src: o--------o >- // sub: o----o >- // res: o-----o >- // Reuse src(=res) >- this.ranges[src] = subend+1; >- sub += 2; >- } else if (srcend <= subend) { >- // src: o--------o >- // sub: o----o >- // res: o-----o >- // Reuse sub >- result[wp++] = srcbegin; >- result[wp++] = subbegin-1; >- src += 2; >- } else { >- // src: o--------o >- // sub: o----o >- // res: o-o o-o >- // Reuse src(=right res) >- result[wp++] = srcbegin; >- result[wp++] = subbegin-1; >- this.ranges[src] = subend+1; >- sub += 2; >- } >- } else if (subend < srcbegin) { >- // Not overlapped >- // src: o-----o >- // sub: o----o >- sub += 2; >- } else { >- throw new RuntimeException("Token#subtractRanges(): Internal Error: ["+this.ranges[src] >- +","+this.ranges[src+1] >- +"] - ["+tok.ranges[sub] >- +","+tok.ranges[sub+1] >- +"]"); >- } >- } >- while (src < this.ranges.length) { >- result[wp++] = this.ranges[src++]; >- result[wp++] = this.ranges[src++]; >- } >- this.ranges = new int[wp]; >- System.arraycopy(result, 0, this.ranges, 0, wp); >- // this.ranges is sorted and compacted. >- } >- >- /** >- * @param tok Ignore whether it is NRANGE or not. >- */ >- protected void intersectRanges(Token token) { >- RangeToken tok = (RangeToken)token; >- if (tok.ranges == null || this.ranges == null) >- return; >- this.icaseCache = null; >- this.sortRanges(); >- this.compactRanges(); >- tok.sortRanges(); >- tok.compactRanges(); >- >- int[] result = new int[this.ranges.length+tok.ranges.length]; >- int wp = 0, src1 = 0, src2 = 0; >- while (src1 < this.ranges.length && src2 < tok.ranges.length) { >- int src1begin = this.ranges[src1]; >- int src1end = this.ranges[src1+1]; >- int src2begin = tok.ranges[src2]; >- int src2end = tok.ranges[src2+1]; >- if (src1end < src2begin) { // Not overlapped >- // src1: o-----o >- // src2: o-----o >- // res: empty >- // Reuse src2 >- src1 += 2; >- } else if (src1end >= src2begin >- && src1begin <= src2end) { // Overlapped >- // src1: o--------o >- // src2: o----o >- // src2: o----o >- // src2: o----o >- // src2: o------------o >- if (src2begin <= src2begin && src1end <= src2end) { >- // src1: o--------o >- // src2: o------------o >- // res: o--------o >- // Reuse src2 >- result[wp++] = src1begin; >- result[wp++] = src1end; >- src1 += 2; >- } else if (src2begin <= src1begin) { >- // src1: o--------o >- // src2: o----o >- // res: o--o >- // Reuse the rest of src1 >- result[wp++] = src1begin; >- result[wp++] = src2end; >- this.ranges[src1] = src2end+1; >- src2 += 2; >- } else if (src1end <= src2end) { >- // src1: o--------o >- // src2: o----o >- // res: o--o >- // Reuse src2 >- result[wp++] = src2begin; >- result[wp++] = src1end; >- src1 += 2; >- } else { >- // src1: o--------o >- // src2: o----o >- // res: o----o >- // Reuse the rest of src1 >- result[wp++] = src2begin; >- result[wp++] = src2end; >- this.ranges[src1] = src2end+1; >- } >- } else if (src2end < src1begin) { >- // Not overlapped >- // src1: o-----o >- // src2: o----o >- src2 += 2; >- } else { >- throw new RuntimeException("Token#intersectRanges(): Internal Error: [" >- +this.ranges[src1] >- +","+this.ranges[src1+1] >- +"] & ["+tok.ranges[src2] >- +","+tok.ranges[src2+1] >- +"]"); >- } >- } >- while (src1 < this.ranges.length) { >- result[wp++] = this.ranges[src1++]; >- result[wp++] = this.ranges[src1++]; >- } >- this.ranges = new int[wp]; >- System.arraycopy(result, 0, this.ranges, 0, wp); >- // this.ranges is sorted and compacted. >- } >- >- /** >- * for RANGE: Creates complement. >- * for NRANGE: Creates the same meaning RANGE. >- */ >- static Token complementRanges(Token token) { >- if (token.type != RANGE && token.type != NRANGE) >- throw new IllegalArgumentException("Token#complementRanges(): must be RANGE: "+token.type); >- RangeToken tok = (RangeToken)token; >- tok.sortRanges(); >- tok.compactRanges(); >- int len = tok.ranges.length+2; >- if (tok.ranges[0] == 0) >- len -= 2; >- int last = tok.ranges[tok.ranges.length-1]; >- if (last == UTF16_MAX) >- len -= 2; >- RangeToken ret = Token.createRange(); >- ret.ranges = new int[len]; >- int wp = 0; >- if (tok.ranges[0] > 0) { >- ret.ranges[wp++] = 0; >- ret.ranges[wp++] = tok.ranges[0]-1; >- } >- for (int i = 1; i < tok.ranges.length-2; i += 2) { >- ret.ranges[wp++] = tok.ranges[i]+1; >- ret.ranges[wp++] = tok.ranges[i+1]-1; >- } >- if (last != UTF16_MAX) { >- ret.ranges[wp++] = last+1; >- ret.ranges[wp] = UTF16_MAX; >- } >- ret.setCompacted(); >- return ret; >- } >- >- synchronized RangeToken getCaseInsensitiveToken() { >- if (this.icaseCache != null) >- return this.icaseCache; >- >- RangeToken uppers = this.type == Token.RANGE ? Token.createRange() : Token.createNRange(); >- for (int i = 0; i < this.ranges.length; i += 2) { >- for (int ch = this.ranges[i]; ch <= this.ranges[i+1]; ch ++) { >- if (ch > 0xffff) >- uppers.addRange(ch, ch); >- else { >- char uch = Character.toUpperCase((char)ch); >- uppers.addRange(uch, uch); >- } >- } >- } >- RangeToken lowers = this.type == Token.RANGE ? Token.createRange() : Token.createNRange(); >- for (int i = 0; i < uppers.ranges.length; i += 2) { >- for (int ch = uppers.ranges[i]; ch <= uppers.ranges[i+1]; ch ++) { >- if (ch > 0xffff) >- lowers.addRange(ch, ch); >- else { >- char uch = Character.toUpperCase((char)ch); >- lowers.addRange(uch, uch); >- } >- } >- } >- lowers.mergeRanges(uppers); >- lowers.mergeRanges(this); >- lowers.compactRanges(); >- >- this.icaseCache = lowers; >- return lowers; >- } >- >- void dumpRanges() { >- System.err.print("RANGE: "); >- if (this.ranges == null) >- System.err.println(" NULL"); >- for (int i = 0; i < this.ranges.length; i += 2) { >- System.err.print("["+this.ranges[i]+","+this.ranges[i+1]+"] "); >- } >- System.err.println(""); >- } >- >- boolean match(int ch) { >- if (this.map == null) this.createMap(); >- boolean ret; >- if (this.type == RANGE) { >- if (ch < MAPSIZE) >- return (this.map[ch/32] & (1<<(ch&0x1f))) != 0; >- ret = false; >- for (int i = this.nonMapIndex; i < this.ranges.length; i += 2) { >- if (this.ranges[i] <= ch && ch <= this.ranges[i+1]) >- return true; >- } >- } else { >- if (ch < MAPSIZE) >- return (this.map[ch/32] & (1<<(ch&0x1f))) == 0; >- ret = true; >- for (int i = this.nonMapIndex; i < this.ranges.length; i += 2) { >- if (this.ranges[i] <= ch && ch <= this.ranges[i+1]) >- return false; >- } >- } >- return ret; >- } >- >- private static final int MAPSIZE = 256; >- private void createMap() { >- int asize = MAPSIZE/32; // 32 is the number of bits in `int'. >- this.map = new int[asize]; >- this.nonMapIndex = this.ranges.length; >- for (int i = 0; i < asize; i ++) this.map[i] = 0; >- for (int i = 0; i < this.ranges.length; i += 2) { >- int s = this.ranges[i]; >- int e = this.ranges[i+1]; >- if (s < MAPSIZE) { >- for (int j = s; j <= e && j < MAPSIZE; j ++) >- this.map[j/32] |= 1<<(j&0x1f); // s&0x1f : 0-31 >- } else { >- this.nonMapIndex = i; >- break; >- } >- if (e >= MAPSIZE) { >- this.nonMapIndex = i; >- break; >- } >- } >- //for (int i = 0; i < asize; i ++) System.err.println("Map: "+Integer.toString(this.map[i], 16)); >- } >- >- public String toString(int options) { >- String ret; >- if (this.type == RANGE) { >- if (this == Token.token_dot) >- ret = "."; >- else if (this == Token.token_0to9) >- ret = "\\d"; >- else if (this == Token.token_wordchars) >- ret = "\\w"; >- else if (this == Token.token_spaces) >- ret = "\\s"; >- else { >- StringBuffer sb = new StringBuffer(); >- sb.append("["); >- for (int i = 0; i < this.ranges.length; i += 2) { >- if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(","); >- if (this.ranges[i] == this.ranges[i+1]) { >- sb.append(escapeCharInCharClass(this.ranges[i])); >- } else { >- sb.append(escapeCharInCharClass(this.ranges[i])); >- sb.append('-'); >- sb.append(escapeCharInCharClass(this.ranges[i+1])); >- } >- } >- sb.append("]"); >- ret = sb.toString(); >- } >- } else { >- if (this == Token.token_not_0to9) >- ret = "\\D"; >- else if (this == Token.token_not_wordchars) >- ret = "\\W"; >- else if (this == Token.token_not_spaces) >- ret = "\\S"; >- else { >- StringBuffer sb = new StringBuffer(); >- sb.append("[^"); >- for (int i = 0; i < this.ranges.length; i += 2) { >- if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(","); >- if (this.ranges[i] == this.ranges[i+1]) { >- sb.append(escapeCharInCharClass(this.ranges[i])); >- } else { >- sb.append(escapeCharInCharClass(this.ranges[i])); >- sb.append('-'); >- sb.append(escapeCharInCharClass(this.ranges[i+1])); >- } >- } >- sb.append("]"); >- ret = sb.toString(); >- } >- } >- return ret; >- } >- >- private static String escapeCharInCharClass(int ch) { >- String ret; >- switch (ch) { >- case '[': case ']': case '-': case '^': >- case ',': case '\\': >- ret = "\\"+(char)ch; >- break; >- case '\f': ret = "\\f"; break; >- case '\n': ret = "\\n"; break; >- case '\r': ret = "\\r"; break; >- case '\t': ret = "\\t"; break; >- case 0x1b: ret = "\\e"; break; >- //case 0x0b: ret = "\\v"; break; >- default: >- if (ch < 0x20) { >- String pre = "0"+Integer.toHexString(ch); >- ret = "\\x"+pre.substring(pre.length()-2, pre.length()); >- } else if (ch >= 0x10000) { >- String pre = "0"+Integer.toHexString(ch); >- ret = "\\v"+pre.substring(pre.length()-6, pre.length()); >- } else >- ret = ""+(char)ch; >- } >- return ret; >- } >- >-} >- >- static class RegexParser { >- static final int T_CHAR = 0; >- static final int T_EOF = 1; >- static final int T_OR = 2; // '|' >- static final int T_STAR = 3; // '*' >- static final int T_PLUS = 4; // '+' >- static final int T_QUESTION = 5; // '?' >- static final int T_LPAREN = 6; // '(' >- static final int T_RPAREN = 7; // ')' >- static final int T_DOT = 8; // '.' >- static final int T_LBRACKET = 9; // '[' >- static final int T_BACKSOLIDUS = 10; // '\' >- static final int T_CARET = 11; // '^' >- static final int T_DOLLAR = 12; // '$' >- static final int T_LPAREN2 = 13; // '(?:' >- static final int T_LOOKAHEAD = 14; // '(?=' >- static final int T_NEGATIVELOOKAHEAD = 15; // '(?!' >- static final int T_LOOKBEHIND = 16; // '(?<=' >- static final int T_NEGATIVELOOKBEHIND = 17; // '(?<!' >- static final int T_INDEPENDENT = 18; // '(?>' >- static final int T_SET_OPERATIONS = 19; // '(?[' >- static final int T_POSIX_CHARCLASS_START = 20; // '[:' in a character class >- static final int T_COMMENT = 21; // '(?#' >- static final int T_MODIFIERS = 22; // '(?' [\-,a-z,A-Z] >- static final int T_CONDITION = 23; // '(?(' >- static final int T_XMLSCHEMA_CC_SUBTRACTION = 24; // '-[' in a character class >- >- static class ReferencePosition { >- int refNumber; >- int position; >- ReferencePosition(int n, int pos) { >- this.refNumber = n; >- this.position = pos; >- } >- } >- >- int offset; >- String regex; >- int regexlen; >- int options; >- ResourceBundle resources; >- int chardata; >- int nexttoken; >- static protected final int S_NORMAL = 0; >- static protected final int S_INBRACKETS = 1; >- static protected final int S_INXBRACKETS = 2; >- int context = S_NORMAL; >- int parennumber = 1; >- boolean hasBackReferences; >- Vector references = null; >- >- public RegexParser() { >- //this.setLocale(Locale.getDefault()); >- } >- public RegexParser(Locale locale) { >- //this.setLocale(locale); >- } >- >- public void setLocale(Locale locale) { >- } >- >- final ParseException ex(String key, int loc) { >- return new ParseException(EcorePlugin.INSTANCE.getString(key), loc); >- } >- >- private final boolean isSet(int flag) { >- return (this.options & flag) == flag; >- } >- >- synchronized Token parse(String regex, int options) throws ParseException { >- this.options = options; >- this.offset = 0; >- this.setContext(S_NORMAL); >- this.parennumber = 1; >- this.hasBackReferences = false; >- this.regex = regex; >- if (this.isSet(RegularExpression.EXTENDED_COMMENT)) >- this.regex = REUtil.stripExtendedComment(this.regex); >- this.regexlen = this.regex.length(); >- >- >- this.next(); >- Token ret = this.parseRegex(); >- if (this.offset != this.regexlen) >- throw ex("parser.parse.1", this.offset); >- if (this.references != null) { >- for (int i = 0; i < this.references.size(); i ++) { >- ReferencePosition position = (ReferencePosition)this.references.elementAt(i); >- if (this.parennumber <= position.refNumber) >- throw ex("parser.parse.2", position.position); >- } >- this.references.removeAllElements(); >- } >- return ret; >- } >- >- /* >- public RegularExpression createRegex(String regex, int options) throws ParseException { >- Token tok = this.parse(regex, options); >- return new RegularExpression(regex, tok, this.parennumber, this.hasBackReferences, options); >- } >- */ >- >- protected final void setContext(int con) { >- this.context = con; >- } >- >- final int read() { >- return this.nexttoken; >- } >- >- final void next() { >- if (this.offset >= this.regexlen) { >- this.chardata = -1; >- this.nexttoken = T_EOF; >- return; >- } >- >- int ret; >- int ch = this.regex.charAt(this.offset++); >- this.chardata = ch; >- >- if (this.context == S_INBRACKETS) { >- // In a character class, this.chardata has one character, that is to say, >- // a pair of surrogates is composed and stored to this.chardata. >- switch (ch) { >- case '\\': >- ret = T_BACKSOLIDUS; >- if (this.offset >= this.regexlen) >- throw ex("parser.next.1", this.offset-1); >- this.chardata = this.regex.charAt(this.offset++); >- break; >- >- case '-': >- if (this.isSet(RegularExpression.XMLSCHEMA_MODE) >- && this.offset < this.regexlen && this.regex.charAt(this.offset) == '[') { >- this.offset++; >- ret = T_XMLSCHEMA_CC_SUBTRACTION; >- } else >- ret = T_CHAR; >- break; >- >- case '[': >- if (!this.isSet(RegularExpression.XMLSCHEMA_MODE) >- && this.offset < this.regexlen && this.regex.charAt(this.offset) == ':') { >- this.offset++; >- ret = T_POSIX_CHARCLASS_START; >- break; >- } // Through down >- default: >- if (REUtil.isHighSurrogate(ch) && this.offset < this.regexlen) { >- int low = this.regex.charAt(this.offset); >- if (REUtil.isLowSurrogate(low)) { >- this.chardata = REUtil.composeFromSurrogates(ch, low); >- this.offset ++; >- } >- } >- ret = T_CHAR; >- } >- this.nexttoken = ret; >- return; >- } >- >- switch (ch) { >- case '|': ret = T_OR; break; >- case '*': ret = T_STAR; break; >- case '+': ret = T_PLUS; break; >- case '?': ret = T_QUESTION; break; >- case ')': ret = T_RPAREN; break; >- case '.': ret = T_DOT; break; >- case '[': ret = T_LBRACKET; break; >- case '^': ret = T_CARET; break; >- case '$': ret = T_DOLLAR; break; >- case '(': >- ret = T_LPAREN; >- if (this.offset >= this.regexlen) >- break; >- if (this.regex.charAt(this.offset) != '?') >- break; >- if (++this.offset >= this.regexlen) >- throw ex("parser.next.2", this.offset-1); >- ch = this.regex.charAt(this.offset++); >- switch (ch) { >- case ':': ret = T_LPAREN2; break; >- case '=': ret = T_LOOKAHEAD; break; >- case '!': ret = T_NEGATIVELOOKAHEAD; break; >- case '[': ret = T_SET_OPERATIONS; break; >- case '>': ret = T_INDEPENDENT; break; >- case '<': >- if (this.offset >= this.regexlen) >- throw ex("parser.next.2", this.offset-3); >- ch = this.regex.charAt(this.offset++); >- if (ch == '=') { >- ret = T_LOOKBEHIND; >- } else if (ch == '!') { >- ret = T_NEGATIVELOOKBEHIND; >- } else >- throw ex("parser.next.3", this.offset-3); >- break; >- case '#': >- while (this.offset < this.regexlen) { >- ch = this.regex.charAt(this.offset++); >- if (ch == ')') break; >- } >- if (ch != ')') >- throw ex("parser.next.4", this.offset-1); >- ret = T_COMMENT; >- break; >- default: >- if (ch == '-' || 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z') {// Options >- this.offset --; >- ret = T_MODIFIERS; >- break; >- } else if (ch == '(') { // conditional >- ret = T_CONDITION; // this.offsets points the next of '('. >- break; >- } >- throw ex("parser.next.2", this.offset-2); >- } >- break; >- >- case '\\': >- ret = T_BACKSOLIDUS; >- if (this.offset >= this.regexlen) >- throw ex("parser.next.1", this.offset-1); >- this.chardata = this.regex.charAt(this.offset++); >- break; >- >- default: >- ret = T_CHAR; >- } >- this.nexttoken = ret; >- } >- >- /** >- * regex ::= term (`|` term)* >- * term ::= factor+ >- * factor ::= ('^' | '$' | '\A' | '\Z' | '\z' | '\b' | '\B' | '\<' | '\>' >- * | atom (('*' | '+' | '?' | minmax ) '?'? )?) >- * | '(?=' regex ')' | '(?!' regex ')' | '(?<=' regex ')' | '(?<!' regex ')' >- * atom ::= char | '.' | range | '(' regex ')' | '(?:' regex ')' | '\' [0-9] >- * | '\w' | '\W' | '\d' | '\D' | '\s' | '\S' | category-block >- */ >- Token parseRegex() throws ParseException { >- Token tok = this.parseTerm(); >- Token parent = null; >- while (this.read() == T_OR) { >- this.next(); // '|' >- if (parent == null) { >- parent = Token.createUnion(); >- parent.addChild(tok); >- tok = parent; >- } >- tok.addChild(this.parseTerm()); >- } >- return tok; >- } >- >- /** >- * term ::= factor+ >- */ >- Token parseTerm() throws ParseException { >- int ch = this.read(); >- if (ch == T_OR || ch == T_RPAREN || ch == T_EOF) { >- return Token.createEmpty(); >- } else { >- Token tok = this.parseFactor(); >- Token concat = null; >- while ((ch = this.read()) != T_OR && ch != T_RPAREN && ch != T_EOF) { >- if (concat == null) { >- concat = Token.createConcat(); >- concat.addChild(tok); >- tok = concat; >- } >- concat.addChild(this.parseFactor()); >- //tok = Token.createConcat(tok, this.parseFactor()); >- } >- return tok; >- } >- } >- >- // ---------------------------------------------------------------- >- >- Token processCaret() throws ParseException { >- this.next(); >- return Token.token_linebeginning; >- } >- Token processDollar() throws ParseException { >- this.next(); >- return Token.token_lineend; >- } >- Token processLookahead() throws ParseException { >- this.next(); >- Token tok = Token.createLook(Token.LOOKAHEAD, this.parseRegex()); >- if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1); >- this.next(); // ')' >- return tok; >- } >- Token processNegativelookahead() throws ParseException { >- this.next(); >- Token tok = Token.createLook(Token.NEGATIVELOOKAHEAD, this.parseRegex()); >- if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1); >- this.next(); // ')' >- return tok; >- } >- Token processLookbehind() throws ParseException { >- this.next(); >- Token tok = Token.createLook(Token.LOOKBEHIND, this.parseRegex()); >- if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1); >- this.next(); // ')' >- return tok; >- } >- Token processNegativelookbehind() throws ParseException { >- this.next(); >- Token tok = Token.createLook(Token.NEGATIVELOOKBEHIND, this.parseRegex()); >- if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1); >- this.next(); // ')' >- return tok; >- } >- Token processBacksolidus_A() throws ParseException { >- this.next(); >- return Token.token_stringbeginning; >- } >- Token processBacksolidus_Z() throws ParseException { >- this.next(); >- return Token.token_stringend2; >- } >- Token processBacksolidus_z() throws ParseException { >- this.next(); >- return Token.token_stringend; >- } >- Token processBacksolidus_b() throws ParseException { >- this.next(); >- return Token.token_wordedge; >- } >- Token processBacksolidus_B() throws ParseException { >- this.next(); >- return Token.token_not_wordedge; >- } >- Token processBacksolidus_lt() throws ParseException { >- this.next(); >- return Token.token_wordbeginning; >- } >- Token processBacksolidus_gt() throws ParseException { >- this.next(); >- return Token.token_wordend; >- } >- Token processStar(Token tok) throws ParseException { >- this.next(); >- if (this.read() == T_QUESTION) { >- this.next(); >- return Token.createNGClosure(tok); >- } else >- return Token.createClosure(tok); >- } >- Token processPlus(Token tok) throws ParseException { >- // X+ -> XX* >- this.next(); >- if (this.read() == T_QUESTION) { >- this.next(); >- return Token.createConcat(tok, Token.createNGClosure(tok)); >- } else >- return Token.createConcat(tok, Token.createClosure(tok)); >- } >- Token processQuestion(Token tok) throws ParseException { >- // X? -> X| >- this.next(); >- Token par = Token.createUnion(); >- if (this.read() == T_QUESTION) { >- this.next(); >- par.addChild(Token.createEmpty()); >- par.addChild(tok); >- } else { >- par.addChild(tok); >- par.addChild(Token.createEmpty()); >- } >- return par; >- } >- boolean checkQuestion(int off) { >- return off < this.regexlen && this.regex.charAt(off) == '?'; >- } >- Token processParen() throws ParseException { >- this.next(); >- int p = this.parennumber++; >- Token tok = Token.createParen(this.parseRegex(), p); >- if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1); >- this.next(); // Skips ')' >- return tok; >- } >- Token processParen2() throws ParseException { >- this.next(); >- Token tok = Token.createParen(this.parseRegex(), 0); >- if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1); >- this.next(); // Skips ')' >- return tok; >- } >- Token processCondition() throws ParseException { >- // this.offset points the next of '(' >- if (this.offset+1 >= this.regexlen) throw ex("parser.factor.4", this.offset); >- // Parses a condition. >- int refno = -1; >- Token condition = null; >- int ch = this.regex.charAt(this.offset); >- if ('1' <= ch && ch <= '9') { >- refno = ch-'0'; >- this.hasBackReferences = true; >- if (this.references == null) this.references = new Vector(); >- this.references.addElement(new ReferencePosition(refno, this.offset)); >- this.offset ++; >- if (this.regex.charAt(this.offset) != ')') throw ex("parser.factor.1", this.offset); >- this.offset ++; >- } else { >- if (ch == '?') this.offset --; // Points '('. >- this.next(); >- condition = this.parseFactor(); >- switch (condition.type) { >- case Token.LOOKAHEAD: >- case Token.NEGATIVELOOKAHEAD: >- case Token.LOOKBEHIND: >- case Token.NEGATIVELOOKBEHIND: >- break; >- case Token.ANCHOR: >- if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1); >- break; >- default: >- throw ex("parser.factor.5", this.offset); >- } >- } >- // Parses yes/no-patterns. >- this.next(); >- Token yesPattern = this.parseRegex(); >- Token noPattern = null; >- if (yesPattern.type == Token.UNION) { >- if (yesPattern.size() != 2) throw ex("parser.factor.6", this.offset); >- noPattern = yesPattern.getChild(1); >- yesPattern = yesPattern.getChild(0); >- } >- if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1); >- this.next(); >- return Token.createCondition(refno, condition, yesPattern, noPattern); >- } >- Token processModifiers() throws ParseException { >- // this.offset points the next of '?'. >- // modifiers ::= [imsw]* ('-' [imsw]*)? ':' >- int add = 0, mask = 0, ch = -1; >- while (this.offset < this.regexlen) { >- ch = this.regex.charAt(this.offset); >- int v = REUtil.getOptionValue(ch); >- if (v == 0) break; // '-' or ':'? >- add |= v; >- this.offset ++; >- } >- if (this.offset >= this.regexlen) throw ex("parser.factor.2", this.offset-1); >- if (ch == '-') { >- this.offset ++; >- while (this.offset < this.regexlen) { >- ch = this.regex.charAt(this.offset); >- int v = REUtil.getOptionValue(ch); >- if (v == 0) break; // ':'? >- mask |= v; >- this.offset ++; >- } >- if (this.offset >= this.regexlen) throw ex("parser.factor.2", this.offset-1); >- } >- Token tok; >- if (ch == ':') { >- this.offset ++; >- this.next(); >- tok = Token.createModifierGroup(this.parseRegex(), add, mask); >- if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1); >- this.next(); >- } else if (ch == ')') { // such as (?-i) >- this.offset ++; >- this.next(); >- tok = Token.createModifierGroup(this.parseRegex(), add, mask); >- } else >- throw ex("parser.factor.3", this.offset); >- >- return tok; >- } >- Token processIndependent() throws ParseException { >- this.next(); >- Token tok = Token.createLook(Token.INDEPENDENT, this.parseRegex()); >- if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1); >- this.next(); // Skips ')' >- return tok; >- } >- Token processBacksolidus_c() throws ParseException { >- int ch2; // Must be in 0x0040-0x005f >- if (this.offset >= this.regexlen >- || ((ch2 = this.regex.charAt(this.offset++)) & 0xffe0) != 0x0040) >- throw ex("parser.atom.1", this.offset-1); >- this.next(); >- return Token.createChar(ch2-0x40); >- } >- Token processBacksolidus_C() throws ParseException { >- throw ex("parser.process.1", this.offset); >- } >- Token processBacksolidus_i() throws ParseException { >- Token tok = Token.createChar('i'); >- this.next(); >- return tok; >- } >- Token processBacksolidus_I() throws ParseException { >- throw ex("parser.process.1", this.offset); >- } >- Token processBacksolidus_g() throws ParseException { >- this.next(); >- return Token.getGraphemePattern(); >- } >- Token processBacksolidus_X() throws ParseException { >- this.next(); >- return Token.getCombiningCharacterSequence(); >- } >- Token processBackreference() throws ParseException { >- int refnum = this.chardata-'0'; >- Token tok = Token.createBackReference(refnum); >- this.hasBackReferences = true; >- if (this.references == null) this.references = new Vector(); >- this.references.addElement(new ReferencePosition(refnum, this.offset-2)); >- this.next(); >- return tok; >- } >- >- // ---------------------------------------------------------------- >- >- /** >- * factor ::= ('^' | '$' | '\A' | '\Z' | '\z' | '\b' | '\B' | '\<' | '\>' >- * | atom (('*' | '+' | '?' | minmax ) '?'? )?) >- * | '(?=' regex ')' | '(?!' regex ')' | '(?<=' regex ')' | '(?<!' regex ')' >- * | '(?#' [^)]* ')' >- * minmax ::= '{' min (',' max?)? '}' >- * min ::= [0-9]+ >- * max ::= [0-9]+ >- */ >- Token parseFactor() throws ParseException { >- int ch = this.read(); >- Token tok; >- switch (ch) { >- case T_CARET: return this.processCaret(); >- case T_DOLLAR: return this.processDollar(); >- case T_LOOKAHEAD: return this.processLookahead(); >- case T_NEGATIVELOOKAHEAD: return this.processNegativelookahead(); >- case T_LOOKBEHIND: return this.processLookbehind(); >- case T_NEGATIVELOOKBEHIND: return this.processNegativelookbehind(); >- >- case T_COMMENT: >- this.next(); >- return Token.createEmpty(); >- >- case T_BACKSOLIDUS: >- switch (this.chardata) { >- case 'A': return this.processBacksolidus_A(); >- case 'Z': return this.processBacksolidus_Z(); >- case 'z': return this.processBacksolidus_z(); >- case 'b': return this.processBacksolidus_b(); >- case 'B': return this.processBacksolidus_B(); >- case '<': return this.processBacksolidus_lt(); >- case '>': return this.processBacksolidus_gt(); >- } >- // through down >- } >- tok = this.parseAtom(); >- ch = this.read(); >- switch (ch) { >- case T_STAR: return this.processStar(tok); >- case T_PLUS: return this.processPlus(tok); >- case T_QUESTION: return this.processQuestion(tok); >- case T_CHAR: >- if (this.chardata == '{' && this.offset < this.regexlen) { >- >- int off = this.offset; // this.offset -> next of '{' >- int min = 0, max = -1; >- >- if ((ch = this.regex.charAt(off++)) >= '0' && ch <= '9') { >- >- min = ch -'0'; >- while (off < this.regexlen >- && (ch = this.regex.charAt(off++)) >= '0' && ch <= '9') { >- min = min*10 +ch-'0'; >- if (min < 0) >- throw ex("parser.quantifier.5", this.offset); >- } >- } >- else { >- throw ex("parser.quantifier.1", this.offset); >- } >- >- max = min; >- if (ch == ',') { >- >- if (off >= this.regexlen) { >- throw ex("parser.quantifier.3", this.offset); >- } >- else if ((ch = this.regex.charAt(off++)) >= '0' && ch <= '9') { >- >- max = ch -'0'; // {min,max} >- while (off < this.regexlen >- && (ch = this.regex.charAt(off++)) >= '0' >- && ch <= '9') { >- max = max*10 +ch-'0'; >- if (max < 0) >- throw ex("parser.quantifier.5", this.offset); >- } >- >- if (min > max) >- throw ex("parser.quantifier.4", this.offset); >- } >- else { // assume {min,} >- max = -1; >- } >- } >- >- if (ch != '}') >- throw ex("parser.quantifier.2", this.offset); >- >- if (this.checkQuestion(off)) { // off -> next of '}' >- tok = Token.createNGClosure(tok); >- this.offset = off+1; >- } else { >- tok = Token.createClosure(tok); >- this.offset = off; >- } >- >- tok.setMin(min); >- tok.setMax(max); >- //System.err.println("CLOSURE: "+min+", "+max); >- this.next(); >- } >- } >- return tok; >- } >- >- /** >- * atom ::= char | '.' | char-class | '(' regex ')' | '(?:' regex ')' | '\' [0-9] >- * | '\w' | '\W' | '\d' | '\D' | '\s' | '\S' | category-block >- * | '(?>' regex ')' >- * char ::= '\\' | '\' [efnrt] | bmp-code | character-1 >- */ >- Token parseAtom() throws ParseException { >- int ch = this.read(); >- Token tok = null; >- switch (ch) { >- case T_LPAREN: return this.processParen(); >- case T_LPAREN2: return this.processParen2(); // '(?:' >- case T_CONDITION: return this.processCondition(); // '(?(' >- case T_MODIFIERS: return this.processModifiers(); // (?modifiers ... ) >- case T_INDEPENDENT: return this.processIndependent(); >- case T_DOT: >- this.next(); // Skips '.' >- tok = Token.token_dot; >- break; >- >- /** >- * char-class ::= '[' ( '^'? range ','?)+ ']' >- * range ::= '\d' | '\w' | '\s' | category-block | range-char >- * | range-char '-' range-char >- * range-char ::= '\[' | '\]' | '\\' | '\' [,-efnrtv] | bmp-code | character-2 >- * bmp-char ::= '\' 'u' [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] >- */ >- case T_LBRACKET: return this.parseCharacterClass(true); >- case T_SET_OPERATIONS: return this.parseSetOperations(); >- >- case T_BACKSOLIDUS: >- switch (this.chardata) { >- case 'd': case 'D': >- case 'w': case 'W': >- case 's': case 'S': >- tok = this.getTokenForShorthand(this.chardata); >- this.next(); >- return tok; >- >- case 'e': case 'f': case 'n': case 'r': >- case 't': case 'u': case 'v': case 'x': >- { >- int ch2 = this.decodeEscaped(); >- if (ch2 < 0x10000) { >- tok = Token.createChar(ch2); >- } else { >- tok = Token.createString(REUtil.decomposeToSurrogates(ch2)); >- } >- } >- break; >- >- case 'c': return this.processBacksolidus_c(); >- case 'C': return this.processBacksolidus_C(); >- case 'i': return this.processBacksolidus_i(); >- case 'I': return this.processBacksolidus_I(); >- case 'g': return this.processBacksolidus_g(); >- case 'X': return this.processBacksolidus_X(); >- case '1': case '2': case '3': case '4': >- case '5': case '6': case '7': case '8': case '9': >- return this.processBackreference(); >- >- case 'P': >- case 'p': >- int pstart = this.offset; >- tok = processBacksolidus_pP(this.chardata); >- if (tok == null) throw this.ex("parser.atom.5", pstart); >- break; >- >- default: >- tok = Token.createChar(this.chardata); >- } >- this.next(); >- break; >- >- case T_CHAR: >- if (this.chardata == ']' || this.chardata == '{' || this.chardata == '}') >- throw this.ex("parser.atom.4", this.offset-1); >- tok = Token.createChar(this.chardata); >- int high = this.chardata; >- this.next(); >- if (REUtil.isHighSurrogate(high) >- && this.read() == T_CHAR && REUtil.isLowSurrogate(this.chardata)) { >- char[] sur = new char[2]; >- sur[0] = (char)high; >- sur[1] = (char)this.chardata; >- tok = Token.createParen(Token.createString(new String(sur)), 0); >- this.next(); >- } >- break; >- >- default: >- throw this.ex("parser.atom.4", this.offset-1); >- } >- return tok; >- } >- >- protected RangeToken processBacksolidus_pP(int c) throws ParseException { >- >- this.next(); >- if (this.read() != T_CHAR || this.chardata != '{') >- throw this.ex("parser.atom.2", this.offset-1); >- >- // handle category escape >- boolean positive = c == 'p'; >- int namestart = this.offset; >- int nameend = this.regex.indexOf('}', namestart); >- >- if (nameend < 0) >- throw this.ex("parser.atom.3", this.offset); >- >- String pname = this.regex.substring(namestart, nameend); >- this.offset = nameend+1; >- >- return Token.getRange(pname, positive, this.isSet(RegularExpression.XMLSCHEMA_MODE)); >- } >- >- int processCIinCharacterClass(RangeToken tok, int c) { >- return this.decodeEscaped(); >- } >- >- /** >- * char-class ::= '[' ( '^'? range ','?)+ ']' >- * range ::= '\d' | '\w' | '\s' | category-block | range-char >- * | range-char '-' range-char >- * range-char ::= '\[' | '\]' | '\\' | '\' [,-efnrtv] | bmp-code | character-2 >- * bmp-code ::= '\' 'u' [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] >- */ >- protected RangeToken parseCharacterClass(boolean useNrange) throws ParseException { >- this.setContext(S_INBRACKETS); >- this.next(); // '[' >- boolean nrange = false; >- RangeToken base = null; >- RangeToken tok; >- if (this.read() == T_CHAR && this.chardata == '^') { >- nrange = true; >- this.next(); // '^' >- if (useNrange) { >- tok = Token.createNRange(); >- } else { >- base = Token.createRange(); >- base.addRange(0, Token.UTF16_MAX); >- tok = Token.createRange(); >- } >- } else { >- tok = Token.createRange(); >- } >- int type; >- boolean firstloop = true; >- while ((type = this.read()) != T_EOF) { >- if (type == T_CHAR && this.chardata == ']' && !firstloop) >- break; >- firstloop = false; >- int c = this.chardata; >- boolean end = false; >- if (type == T_BACKSOLIDUS) { >- switch (c) { >- case 'd': case 'D': >- case 'w': case 'W': >- case 's': case 'S': >- tok.mergeRanges(this.getTokenForShorthand(c)); >- end = true; >- break; >- >- case 'i': case 'I': >- case 'c': case 'C': >- c = this.processCIinCharacterClass(tok, c); >- if (c < 0) end = true; >- break; >- >- case 'p': >- case 'P': >- int pstart = this.offset; >- RangeToken tok2 = this.processBacksolidus_pP(c); >- if (tok2 == null) throw this.ex("parser.atom.5", pstart); >- tok.mergeRanges(tok2); >- end = true; >- break; >- >- default: >- c = this.decodeEscaped(); >- } // \ + c >- } // backsolidus >- // POSIX Character class such as [:alnum:] >- else if (type == T_POSIX_CHARCLASS_START) { >- int nameend = this.regex.indexOf(':', this.offset); >- if (nameend < 0) throw this.ex("parser.cc.1", this.offset); >- boolean positive = true; >- if (this.regex.charAt(this.offset) == '^') { >- this.offset ++; >- positive = false; >- } >- String name = this.regex.substring(this.offset, nameend); >- RangeToken range = Token.getRange(name, positive, >- this.isSet(RegularExpression.XMLSCHEMA_MODE)); >- if (range == null) throw this.ex("parser.cc.3", this.offset); >- tok.mergeRanges(range); >- end = true; >- if (nameend+1 >= this.regexlen || this.regex.charAt(nameend+1) != ']') >- throw this.ex("parser.cc.1", nameend); >- this.offset = nameend+2; >- } >- this.next(); >- if (!end) { // if not shorthands... >- if (this.read() != T_CHAR || this.chardata != '-') { // Here is no '-'. >- tok.addRange(c, c); >- } else { >- this.next(); // Skips '-' >- if ((type = this.read()) == T_EOF) throw this.ex("parser.cc.2", this.offset); >- if (type == T_CHAR && this.chardata == ']') { >- tok.addRange(c, c); >- tok.addRange('-', '-'); >- } else { >- int rangeend = this.chardata; >- if (type == T_BACKSOLIDUS) >- rangeend = this.decodeEscaped(); >- this.next(); >- tok.addRange(c, rangeend); >- } >- } >- } >- if (this.isSet(RegularExpression.SPECIAL_COMMA) >- && this.read() == T_CHAR && this.chardata == ',') >- this.next(); >- } >- if (this.read() == T_EOF) >- throw this.ex("parser.cc.2", this.offset); >- if (!useNrange && nrange) { >- base.subtractRanges(tok); >- tok = base; >- } >- tok.sortRanges(); >- tok.compactRanges(); >- //tok.dumpRanges(); >- /* >- if (this.isSet(RegularExpression.IGNORE_CASE)) >- tok = RangeToken.createCaseInsensitiveToken(tok); >- */ >- this.setContext(S_NORMAL); >- this.next(); // Skips ']' >- >- return tok; >- } >- >- /** >- * '(?[' ... ']' (('-' | '+' | '&') '[' ... ']')? ')' >- */ >- protected RangeToken parseSetOperations() throws ParseException { >- RangeToken tok = this.parseCharacterClass(false); >- int type; >- while ((type = this.read()) != T_RPAREN) { >- int ch = this.chardata; >- if (type == T_CHAR && (ch == '-' || ch == '&') >- || type == T_PLUS) { >- this.next(); >- if (this.read() != T_LBRACKET) throw ex("parser.ope.1", this.offset-1); >- RangeToken t2 = this.parseCharacterClass(false); >- if (type == T_PLUS) >- tok.mergeRanges(t2); >- else if (ch == '-') >- tok.subtractRanges(t2); >- else if (ch == '&') >- tok.intersectRanges(t2); >- else >- throw new RuntimeException("ASSERT"); >- } else { >- throw ex("parser.ope.2", this.offset-1); >- } >- } >- this.next(); >- return tok; >- } >- >- Token getTokenForShorthand(int ch) { >- Token tok; >- switch (ch) { >- case 'd': >- tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) >- ? Token.getRange("Nd", true) : Token.token_0to9; >- break; >- case 'D': >- tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) >- ? Token.getRange("Nd", false) : Token.token_not_0to9; >- break; >- case 'w': >- tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) >- ? Token.getRange("IsWord", true) : Token.token_wordchars; >- break; >- case 'W': >- tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) >- ? Token.getRange("IsWord", false) : Token.token_not_wordchars; >- break; >- case 's': >- tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) >- ? Token.getRange("IsSpace", true) : Token.token_spaces; >- break; >- case 'S': >- tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) >- ? Token.getRange("IsSpace", false) : Token.token_not_spaces; >- break; >- >- default: >- throw new RuntimeException("Internal Error: shorthands: \\u"+Integer.toString(ch, 16)); >- } >- return tok; >- } >- >- /** >- */ >- int decodeEscaped() throws ParseException { >- if (this.read() != T_BACKSOLIDUS) throw ex("parser.next.1", this.offset-1); >- int c = this.chardata; >- switch (c) { >- case 'e': c = 0x1b; break; // ESCAPE U+001B >- case 'f': c = '\f'; break; // FORM FEED U+000C >- case 'n': c = '\n'; break; // LINE FEED U+000A >- case 'r': c = '\r'; break; // CRRIAGE RETURN U+000D >- case 't': c = '\t'; break; // HORIZONTAL TABULATION U+0009 >- //case 'v': c = 0x0b; break; // VERTICAL TABULATION U+000B >- case 'x': >- this.next(); >- if (this.read() != T_CHAR) throw ex("parser.descape.1", this.offset-1); >- if (this.chardata == '{') { >- int v1 = 0; >- int uv = 0; >- do { >- this.next(); >- if (this.read() != T_CHAR) throw ex("parser.descape.1", this.offset-1); >- if ((v1 = hexChar(this.chardata)) < 0) >- break; >- if (uv > uv*16) throw ex("parser.descape.2", this.offset-1); >- uv = uv*16+v1; >- } while (true); >- if (this.chardata != '}') throw ex("parser.descape.3", this.offset-1); >- if (uv > Token.UTF16_MAX) throw ex("parser.descape.4", this.offset-1); >- c = uv; >- } else { >- int v1 = 0; >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- int uv = v1; >- this.next(); >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- uv = uv*16+v1; >- c = uv; >- } >- break; >- >- case 'u': >- int v1 = 0; >- this.next(); >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- int uv = v1; >- this.next(); >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- uv = uv*16+v1; >- this.next(); >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- uv = uv*16+v1; >- this.next(); >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- uv = uv*16+v1; >- c = uv; >- break; >- >- case 'v': >- this.next(); >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- uv = v1; >- this.next(); >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- uv = uv*16+v1; >- this.next(); >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- uv = uv*16+v1; >- this.next(); >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- uv = uv*16+v1; >- this.next(); >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- uv = uv*16+v1; >- this.next(); >- if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0) >- throw ex("parser.descape.1", this.offset-1); >- uv = uv*16+v1; >- if (uv > Token.UTF16_MAX) throw ex("parser.descappe.4", this.offset-1); >- c = uv; >- break; >- case 'A': >- case 'Z': >- case 'z': >- throw ex("parser.descape.5", this.offset-2); >- default: >- } >- return c; >- } >- >- static private final int hexChar(int ch) { >- if (ch < '0') return -1; >- if (ch > 'f') return -1; >- if (ch <= '9') return ch-'0'; >- if (ch < 'A') return -1; >- if (ch <= 'F') return ch-'A'+10; >- if (ch < 'a') return -1; >- return ch-'a'+10; >- } >- } >- >- >- static class Token implements java.io.Serializable { >- static final boolean COUNTTOKENS = true; >- static int tokens = 0; >- >- static final int CHAR = 0; // Literal char >- static final int DOT = 11; // . >- static final int CONCAT = 1; // XY >- static final int UNION = 2; // X|Y|Z >- static final int CLOSURE = 3; // X* >- static final int RANGE = 4; // [a-zA-Z] etc. >- static final int NRANGE = 5; // [^a-zA-Z] etc. >- static final int PAREN = 6; // (X) or (?:X) >- static final int EMPTY = 7; // >- static final int ANCHOR = 8; // ^ $ \b \B \< \> \A \Z \z >- static final int NONGREEDYCLOSURE = 9; // *? +? >- static final int STRING = 10; // strings >- static final int BACKREFERENCE = 12; // back references >- static final int LOOKAHEAD = 20; // (?=...) >- static final int NEGATIVELOOKAHEAD = 21; // (?!...) >- static final int LOOKBEHIND = 22; // (?<=...) >- static final int NEGATIVELOOKBEHIND = 23; // (?<!...) >- static final int INDEPENDENT = 24; // (?>...) >- static final int MODIFIERGROUP = 25; // (?ims-ims:...) >- static final int CONDITION = 26; // (?(...)yes|no) >- >- static final int UTF16_MAX = 0x10ffff; >- >- int type; >- >- static Token token_dot; >- static Token token_0to9; >- static Token token_wordchars; >- static Token token_not_0to9; >- static Token token_not_wordchars; >- static Token token_spaces; >- static Token token_not_spaces; >- static Token token_empty; >- static Token token_linebeginning; >- static Token token_linebeginning2; >- static Token token_lineend; >- static Token token_stringbeginning; >- static Token token_stringend; >- static Token token_stringend2; >- static Token token_wordedge; >- static Token token_not_wordedge; >- static Token token_wordbeginning; >- static Token token_wordend; >- static { >- Token.token_empty = new Token(Token.EMPTY); >- >- Token.token_linebeginning = Token.createAnchor('^'); >- Token.token_linebeginning2 = Token.createAnchor('@'); >- Token.token_lineend = Token.createAnchor('$'); >- Token.token_stringbeginning = Token.createAnchor('A'); >- Token.token_stringend = Token.createAnchor('z'); >- Token.token_stringend2 = Token.createAnchor('Z'); >- Token.token_wordedge = Token.createAnchor('b'); >- Token.token_not_wordedge = Token.createAnchor('B'); >- Token.token_wordbeginning = Token.createAnchor('<'); >- Token.token_wordend = Token.createAnchor('>'); >- >- Token.token_dot = new Token(Token.DOT); >- >- Token.token_0to9 = Token.createRange(); >- Token.token_0to9.addRange('0', '9'); >- Token.token_wordchars = Token.createRange(); >- Token.token_wordchars.addRange('0', '9'); >- Token.token_wordchars.addRange('A', 'Z'); >- Token.token_wordchars.addRange('_', '_'); >- Token.token_wordchars.addRange('a', 'z'); >- Token.token_spaces = Token.createRange(); >- Token.token_spaces.addRange('\t', '\t'); >- Token.token_spaces.addRange('\n', '\n'); >- Token.token_spaces.addRange('\f', '\f'); >- Token.token_spaces.addRange('\r', '\r'); >- Token.token_spaces.addRange(' ', ' '); >- >- Token.token_not_0to9 = Token.complementRanges(Token.token_0to9); >- Token.token_not_wordchars = Token.complementRanges(Token.token_wordchars); >- Token.token_not_spaces = Token.complementRanges(Token.token_spaces); >- } >- >- static Token.ParenToken createLook(int type, Token child) { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.ParenToken(type, child, 0); >- } >- static Token.ParenToken createParen(Token child, int pnumber) { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.ParenToken(Token.PAREN, child, pnumber); >- } >- static Token.ClosureToken createClosure(Token tok) { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.ClosureToken(Token.CLOSURE, tok); >- } >- static Token.ClosureToken createNGClosure(Token tok) { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.ClosureToken(Token.NONGREEDYCLOSURE, tok); >- } >- static Token.ConcatToken createConcat(Token tok1, Token tok2) { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.ConcatToken(tok1, tok2); >- } >- static Token.UnionToken createConcat() { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.UnionToken(Token.CONCAT); // *** It is not a bug. >- } >- static Token.UnionToken createUnion() { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.UnionToken(Token.UNION); >- } >- static Token createEmpty() { >- return Token.token_empty; >- } >- static RangeToken createRange() { >- if (COUNTTOKENS) Token.tokens ++; >- return new RangeToken(Token.RANGE); >- } >- static RangeToken createNRange() { >- if (COUNTTOKENS) Token.tokens ++; >- return new RangeToken(Token.NRANGE); >- } >- static Token.CharToken createChar(int ch) { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.CharToken(Token.CHAR, ch); >- } >- static private Token.CharToken createAnchor(int ch) { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.CharToken(Token.ANCHOR, ch); >- } >- static Token.StringToken createBackReference(int refno) { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.StringToken(Token.BACKREFERENCE, null, refno); >- } >- static Token.StringToken createString(String str) { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.StringToken(Token.STRING, str, 0); >- } >- static Token.ModifierToken createModifierGroup(Token child, int add, int mask) { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.ModifierToken(child, add, mask); >- } >- static Token.ConditionToken createCondition(int refno, Token condition, >- Token yespat, Token nopat) { >- if (COUNTTOKENS) Token.tokens ++; >- return new Token.ConditionToken(refno, condition, yespat, nopat); >- } >- >- protected Token(int type) { >- this.type = type; >- } >- >- /** >- * A number of children. >- */ >- int size() { >- return 0; >- } >- Token getChild(int index) { >- return null; >- } >- void addChild(Token tok) { >- throw new RuntimeException("Not supported."); >- } >- >- // for RANGE or NRANGE >- protected void addRange(int start, int end) { >- throw new RuntimeException("Not supported."); >- } >- protected void sortRanges() { >- throw new RuntimeException("Not supported."); >- } >- protected void compactRanges() { >- throw new RuntimeException("Not supported."); >- } >- protected void mergeRanges(Token tok) { >- throw new RuntimeException("Not supported."); >- } >- protected void subtractRanges(Token tok) { >- throw new RuntimeException("Not supported."); >- } >- protected void intersectRanges(Token tok) { >- throw new RuntimeException("Not supported."); >- } >- static Token complementRanges(Token tok) { >- return RangeToken.complementRanges(tok); >- } >- >- >- void setMin(int min) { // for CLOSURE >- } >- void setMax(int max) { // for CLOSURE >- } >- int getMin() { // for CLOSURE >- return -1; >- } >- int getMax() { // for CLOSURE >- return -1; >- } >- int getReferenceNumber() { // for STRING >- return 0; >- } >- String getString() { // for STRING >- return null; >- } >- >- int getParenNumber() { >- return 0; >- } >- int getChar() { >- return -1; >- } >- >- public String toString() { >- return this.toString(0); >- } >- public String toString(int options) { >- return this.type == Token.DOT ? "." : ""; >- } >- >- /** >- * How many characters are needed? >- */ >- final int getMinLength() { >- switch (this.type) { >- case CONCAT: >- int sum = 0; >- for (int i = 0; i < this.size(); i ++) >- sum += this.getChild(i).getMinLength(); >- return sum; >- >- case CONDITION: >- case UNION: >- if (this.size() == 0) >- return 0; >- int ret = this.getChild(0).getMinLength(); >- for (int i = 1; i < this.size(); i ++) { >- int min = this.getChild(i).getMinLength(); >- if (min < ret) ret = min; >- } >- return ret; >- >- case CLOSURE: >- case NONGREEDYCLOSURE: >- if (this.getMin() >= 0) >- return this.getMin() * this.getChild(0).getMinLength(); >- return 0; >- >- case EMPTY: >- case ANCHOR: >- return 0; >- >- case DOT: >- case CHAR: >- case RANGE: >- case NRANGE: >- return 1; >- >- case INDEPENDENT: >- case PAREN: >- case MODIFIERGROUP: >- return this.getChild(0).getMinLength(); >- >- case BACKREFERENCE: >- return 0; // ******* >- >- case STRING: >- return this.getString().length(); >- >- case LOOKAHEAD: >- case NEGATIVELOOKAHEAD: >- case LOOKBEHIND: >- case NEGATIVELOOKBEHIND: >- return 0; // ***** Really? >- >- default: >- throw new RuntimeException("Token#getMinLength(): Invalid Type: "+this.type); >- } >- } >- >- final int getMaxLength() { >- switch (this.type) { >- case CONCAT: >- int sum = 0; >- for (int i = 0; i < this.size(); i ++) { >- int d = this.getChild(i).getMaxLength(); >- if (d < 0) return -1; >- sum += d; >- } >- return sum; >- >- case CONDITION: >- case UNION: >- if (this.size() == 0) >- return 0; >- int ret = this.getChild(0).getMaxLength(); >- for (int i = 1; ret >= 0 && i < this.size(); i ++) { >- int max = this.getChild(i).getMaxLength(); >- if (max < 0) { // infinity >- ret = -1; >- break; >- } >- if (max > ret) ret = max; >- } >- return ret; >- >- case CLOSURE: >- case NONGREEDYCLOSURE: >- if (this.getMax() >= 0) >- // When this.child.getMaxLength() < 0, >- // this returns minus value >- return this.getMax() * this.getChild(0).getMaxLength(); >- return -1; >- >- case EMPTY: >- case ANCHOR: >- return 0; >- >- case CHAR: >- return 1; >- case DOT: >- case RANGE: >- case NRANGE: >- return 2; >- >- case INDEPENDENT: >- case PAREN: >- case MODIFIERGROUP: >- return this.getChild(0).getMaxLength(); >- >- case BACKREFERENCE: >- return -1; // ****** >- >- case STRING: >- return this.getString().length(); >- >- case LOOKAHEAD: >- case NEGATIVELOOKAHEAD: >- case LOOKBEHIND: >- case NEGATIVELOOKBEHIND: >- return 0; // ***** Really? >- >- default: >- throw new RuntimeException("Token#getMaxLength(): Invalid Type: "+this.type); >- } >- } >- >- static final int FC_CONTINUE = 0; >- static final int FC_TERMINAL = 1; >- static final int FC_ANY = 2; >- private static final boolean isSet(int options, int flag) { >- return (options & flag) == flag; >- } >- final int analyzeFirstCharacter(RangeToken result, int options) { >- switch (this.type) { >- case CONCAT: >- int ret = FC_CONTINUE; >- for (int i = 0; i < this.size(); i ++) >- if ((ret = this.getChild(i).analyzeFirstCharacter(result, options)) != FC_CONTINUE) >- break; >- return ret; >- >- case UNION: >- if (this.size() == 0) >- return FC_CONTINUE; >- /* >- * a|b|c -> FC_TERMINAL >- * a|.|c -> FC_ANY >- * a|b| -> FC_CONTINUE >- */ >- int ret2 = FC_CONTINUE; >- boolean hasEmpty = false; >- for (int i = 0; i < this.size(); i ++) { >- ret2 = this.getChild(i).analyzeFirstCharacter(result, options); >- if (ret2 == FC_ANY) >- break; >- else if (ret2 == FC_CONTINUE) >- hasEmpty = true; >- } >- return hasEmpty ? FC_CONTINUE : ret2; >- >- case CONDITION: >- int ret3 = this.getChild(0).analyzeFirstCharacter(result, options); >- if (this.size() == 1) return FC_CONTINUE; >- if (ret3 == FC_ANY) return ret3; >- int ret4 = this.getChild(1).analyzeFirstCharacter(result, options); >- if (ret4 == FC_ANY) return ret4; >- return ret3 == FC_CONTINUE || ret4 == FC_CONTINUE ? FC_CONTINUE : FC_TERMINAL; >- >- case CLOSURE: >- case NONGREEDYCLOSURE: >- this.getChild(0).analyzeFirstCharacter(result, options); >- return FC_CONTINUE; >- >- case EMPTY: >- case ANCHOR: >- return FC_CONTINUE; >- >- case CHAR: >- int ch = this.getChar(); >- result.addRange(ch, ch); >- if (ch < 0x10000 && isSet(options, RegularExpression.IGNORE_CASE)) { >- ch = Character.toUpperCase((char)ch); >- result.addRange(ch, ch); >- ch = Character.toLowerCase((char)ch); >- result.addRange(ch, ch); >- } >- return FC_TERMINAL; >- >- case DOT: // **** >- if (isSet(options, RegularExpression.SINGLE_LINE)) { >- return FC_CONTINUE; // **** We can not optimize. >- } else { >- return FC_CONTINUE; >- /* >- result.addRange(0, RegularExpression.LINE_FEED-1); >- result.addRange(RegularExpression.LINE_FEED+1, RegularExpression.CARRIAGE_RETURN-1); >- result.addRange(RegularExpression.CARRIAGE_RETURN+1, >- RegularExpression.LINE_SEPARATOR-1); >- result.addRange(RegularExpression.PARAGRAPH_SEPARATOR+1, UTF16_MAX); >- return 1; >- */ >- } >- >- case RANGE: >- if (isSet(options, RegularExpression.IGNORE_CASE)) { >- result.mergeRanges(((RangeToken)this).getCaseInsensitiveToken()); >- } else { >- result.mergeRanges(this); >- } >- return FC_TERMINAL; >- >- case NRANGE: // **** >- if (isSet(options, RegularExpression.IGNORE_CASE)) { >- result.mergeRanges(Token.complementRanges(((RangeToken)this).getCaseInsensitiveToken())); >- } else { >- result.mergeRanges(Token.complementRanges(this)); >- } >- return FC_TERMINAL; >- >- case INDEPENDENT: >- case PAREN: >- return this.getChild(0).analyzeFirstCharacter(result, options); >- >- case MODIFIERGROUP: >- options |= ((ModifierToken)this).getOptions(); >- options &= ~((ModifierToken)this).getOptionsMask(); >- return this.getChild(0).analyzeFirstCharacter(result, options); >- >- case BACKREFERENCE: >- result.addRange(0, UTF16_MAX); // **** We can not optimize. >- return FC_ANY; >- >- case STRING: >- int cha = this.getString().charAt(0); >- int ch2; >- if (REUtil.isHighSurrogate(cha) >- && this.getString().length() >= 2 >- && REUtil.isLowSurrogate((ch2 = this.getString().charAt(1)))) >- cha = REUtil.composeFromSurrogates(cha, ch2); >- result.addRange(cha, cha); >- if (cha < 0x10000 && isSet(options, RegularExpression.IGNORE_CASE)) { >- cha = Character.toUpperCase((char)cha); >- result.addRange(cha, cha); >- cha = Character.toLowerCase((char)cha); >- result.addRange(cha, cha); >- } >- return FC_TERMINAL; >- >- case LOOKAHEAD: >- case NEGATIVELOOKAHEAD: >- case LOOKBEHIND: >- case NEGATIVELOOKBEHIND: >- return FC_CONTINUE; >- >- default: >- throw new RuntimeException("Token#analyzeHeadCharacter(): Invalid Type: "+this.type); >- } >- } >- >- private final boolean isShorterThan(Token tok) { >- if (tok == null) return false; >- /* >- int mylength; >- if (this.type == STRING) mylength = this.getString().length(); >- else if (this.type == CHAR) mylength = this.getChar() >= 0x10000 ? 2 : 1; >- else throw new RuntimeException("Internal Error: Illegal type: "+this.type); >- int otherlength; >- if (tok.type == STRING) otherlength = tok.getString().length(); >- else if (tok.type == CHAR) otherlength = tok.getChar() >= 0x10000 ? 2 : 1; >- else throw new RuntimeException("Internal Error: Illegal type: "+tok.type); >- */ >- int mylength; >- if (this.type == STRING) mylength = this.getString().length(); >- else throw new RuntimeException("Internal Error: Illegal type: "+this.type); >- int otherlength; >- if (tok.type == STRING) otherlength = tok.getString().length(); >- else throw new RuntimeException("Internal Error: Illegal type: "+tok.type); >- return mylength < otherlength; >- } >- >- static class FixedStringContainer { >- Token token = null; >- int options = 0; >- FixedStringContainer() { >- } >- } >- >- final void findFixedString(FixedStringContainer container, int options) { >- switch (this.type) { >- case CONCAT: >- Token prevToken = null; >- int prevOptions = 0; >- for (int i = 0; i < this.size(); i ++) { >- this.getChild(i).findFixedString(container, options); >- if (prevToken == null || prevToken.isShorterThan(container.token)) { >- prevToken = container.token; >- prevOptions = container.options; >- } >- } >- container.token = prevToken; >- container.options = prevOptions; >- return; >- >- case UNION: >- case CLOSURE: >- case NONGREEDYCLOSURE: >- case EMPTY: >- case ANCHOR: >- case RANGE: >- case DOT: >- case NRANGE: >- case BACKREFERENCE: >- case LOOKAHEAD: >- case NEGATIVELOOKAHEAD: >- case LOOKBEHIND: >- case NEGATIVELOOKBEHIND: >- case CONDITION: >- container.token = null; >- return; >- >- case CHAR: // Ignore CHAR tokens. >- container.token = null; // ** >- return; // ** >- >- case STRING: >- container.token = this; >- container.options = options; >- return; >- >- case INDEPENDENT: >- case PAREN: >- this.getChild(0).findFixedString(container, options); >- return; >- >- case MODIFIERGROUP: >- options |= ((ModifierToken)this).getOptions(); >- options &= ~((ModifierToken)this).getOptionsMask(); >- this.getChild(0).findFixedString(container, options); >- return; >- >- default: >- throw new RuntimeException("Token#findFixedString(): Invalid Type: "+this.type); >- } >- } >- >- boolean match(int ch) { >- throw new RuntimeException("NFAArrow#match(): Internal error: "+this.type); >- } >- >- // ------------------------------------------------------ >- private final static Hashtable categories = new Hashtable(); >- private final static Hashtable categories2 = new Hashtable(); >- private static final String[] categoryNames = { >- "Cn", "Lu", "Ll", "Lt", "Lm", "Lo", "Mn", "Me", "Mc", "Nd", >- "Nl", "No", "Zs", "Zl", "Zp", "Cc", "Cf", null, "Co", "Cs", >- "Pd", "Ps", "Pe", "Pc", "Po", "Sm", "Sc", "Sk", "So", // 28 >- "Pi", "Pf", // 29, 30 >- "L", "M", "N", "Z", "C", "P", "S", // 31-37 >- }; >- >- // Schema Rec. {Datatypes} - Punctuation >- static final int CHAR_INIT_QUOTE = 29; // Pi - initial quote >- static final int CHAR_FINAL_QUOTE = 30; // Pf - final quote >- static final int CHAR_LETTER = 31; >- static final int CHAR_MARK = 32; >- static final int CHAR_NUMBER = 33; >- static final int CHAR_SEPARATOR = 34; >- static final int CHAR_OTHER = 35; >- static final int CHAR_PUNCTUATION = 36; >- static final int CHAR_SYMBOL = 37; >- >- //blockNames in UNICODE 3.1 that supported by XML Schema REC >- private static final String[] blockNames = { >- /*0000..007F;*/ "Basic Latin", >- /*0080..00FF;*/ "Latin-1 Supplement", >- /*0100..017F;*/ "Latin Extended-A", >- /*0180..024F;*/ "Latin Extended-B", >- /*0250..02AF;*/ "IPA Extensions", >- /*02B0..02FF;*/ "Spacing Modifier Letters", >- /*0300..036F;*/ "Combining Diacritical Marks", >- /*0370..03FF;*/ "Greek", >- /*0400..04FF;*/ "Cyrillic", >- /*0530..058F;*/ "Armenian", >- /*0590..05FF;*/ "Hebrew", >- /*0600..06FF;*/ "Arabic", >- /*0700..074F;*/ "Syriac", >- /*0780..07BF;*/ "Thaana", >- /*0900..097F;*/ "Devanagari", >- /*0980..09FF;*/ "Bengali", >- /*0A00..0A7F;*/ "Gurmukhi", >- /*0A80..0AFF;*/ "Gujarati", >- /*0B00..0B7F;*/ "Oriya", >- /*0B80..0BFF;*/ "Tamil", >- /*0C00..0C7F;*/ "Telugu", >- /*0C80..0CFF;*/ "Kannada", >- /*0D00..0D7F;*/ "Malayalam", >- /*0D80..0DFF;*/ "Sinhala", >- /*0E00..0E7F;*/ "Thai", >- /*0E80..0EFF;*/ "Lao", >- /*0F00..0FFF;*/ "Tibetan", >- /*1000..109F;*/ "Myanmar", >- /*10A0..10FF;*/ "Georgian", >- /*1100..11FF;*/ "Hangul Jamo", >- /*1200..137F;*/ "Ethiopic", >- /*13A0..13FF;*/ "Cherokee", >- /*1400..167F;*/ "Unified Canadian Aboriginal Syllabics", >- /*1680..169F;*/ "Ogham", >- /*16A0..16FF;*/ "Runic", >- /*1780..17FF;*/ "Khmer", >- /*1800..18AF;*/ "Mongolian", >- /*1E00..1EFF;*/ "Latin Extended Additional", >- /*1F00..1FFF;*/ "Greek Extended", >- /*2000..206F;*/ "General Punctuation", >- /*2070..209F;*/ "Superscripts and Subscripts", >- /*20A0..20CF;*/ "Currency Symbols", >- /*20D0..20FF;*/ "Combining Marks for Symbols", >- /*2100..214F;*/ "Letterlike Symbols", >- /*2150..218F;*/ "Number Forms", >- /*2190..21FF;*/ "Arrows", >- /*2200..22FF;*/ "Mathematical Operators", >- /*2300..23FF;*/ "Miscellaneous Technical", >- /*2400..243F;*/ "Control Pictures", >- /*2440..245F;*/ "Optical Character Recognition", >- /*2460..24FF;*/ "Enclosed Alphanumerics", >- /*2500..257F;*/ "Box Drawing", >- /*2580..259F;*/ "Block Elements", >- /*25A0..25FF;*/ "Geometric Shapes", >- /*2600..26FF;*/ "Miscellaneous Symbols", >- /*2700..27BF;*/ "Dingbats", >- /*2800..28FF;*/ "Braille Patterns", >- /*2E80..2EFF;*/ "CJK Radicals Supplement", >- /*2F00..2FDF;*/ "Kangxi Radicals", >- /*2FF0..2FFF;*/ "Ideographic Description Characters", >- /*3000..303F;*/ "CJK Symbols and Punctuation", >- /*3040..309F;*/ "Hiragana", >- /*30A0..30FF;*/ "Katakana", >- /*3100..312F;*/ "Bopomofo", >- /*3130..318F;*/ "Hangul Compatibility Jamo", >- /*3190..319F;*/ "Kanbun", >- /*31A0..31BF;*/ "Bopomofo Extended", >- /*3200..32FF;*/ "Enclosed CJK Letters and Months", >- /*3300..33FF;*/ "CJK Compatibility", >- /*3400..4DB5;*/ "CJK Unified Ideographs Extension A", >- /*4E00..9FFF;*/ "CJK Unified Ideographs", >- /*A000..A48F;*/ "Yi Syllables", >- /*A490..A4CF;*/ "Yi Radicals", >- /*AC00..D7A3;*/ "Hangul Syllables", >- /*E000..F8FF;*/ "Private Use", >- /*F900..FAFF;*/ "CJK Compatibility Ideographs", >- /*FB00..FB4F;*/ "Alphabetic Presentation Forms", >- /*FB50..FDFF;*/ "Arabic Presentation Forms-A", >- /*FE20..FE2F;*/ "Combining Half Marks", >- /*FE30..FE4F;*/ "CJK Compatibility Forms", >- /*FE50..FE6F;*/ "Small Form Variants", >- /*FE70..FEFE;*/ "Arabic Presentation Forms-B", >- /*FEFF..FEFF;*/ "Specials", >- /*FF00..FFEF;*/ "Halfwidth and Fullwidth Forms", >- //missing Specials add manually >- /*10300..1032F;*/ "Old Italic", // 84 >- /*10330..1034F;*/ "Gothic", >- /*10400..1044F;*/ "Deseret", >- /*1D000..1D0FF;*/ "Byzantine Musical Symbols", >- /*1D100..1D1FF;*/ "Musical Symbols", >- /*1D400..1D7FF;*/ "Mathematical Alphanumeric Symbols", >- /*20000..2A6D6;*/ "CJK Unified Ideographs Extension B", >- /*2F800..2FA1F;*/ "CJK Compatibility Ideographs Supplement", >- /*E0000..E007F;*/ "Tags", >- //missing 2 private use add manually >- >- }; >- //ADD THOSE MANUALLY >- //F0000..FFFFD; "Private Use", >- //100000..10FFFD; "Private Use" >- //FFF0..FFFD; "Specials", >- static final String blockRanges = >- "\u0000\u007F\u0080\u00FF\u0100\u017F\u0180\u024F\u0250\u02AF\u02B0\u02FF\u0300\u036F" >- +"\u0370\u03FF\u0400\u04FF\u0530\u058F\u0590\u05FF\u0600\u06FF\u0700\u074F\u0780\u07BF" >- +"\u0900\u097F\u0980\u09FF\u0A00\u0A7F\u0A80\u0AFF\u0B00\u0B7F\u0B80\u0BFF\u0C00\u0C7F\u0C80\u0CFF" >- +"\u0D00\u0D7F\u0D80\u0DFF\u0E00\u0E7F\u0E80\u0EFF\u0F00\u0FFF\u1000\u109F\u10A0\u10FF\u1100\u11FF" >- +"\u1200\u137F\u13A0\u13FF\u1400\u167F\u1680\u169F\u16A0\u16FF\u1780\u17FF\u1800\u18AF\u1E00\u1EFF" >- +"\u1F00\u1FFF\u2000\u206F\u2070\u209F\u20A0\u20CF\u20D0\u20FF\u2100\u214F\u2150\u218F\u2190\u21FF\u2200\u22FF" >- +"\u2300\u23FF\u2400\u243F\u2440\u245F\u2460\u24FF\u2500\u257F\u2580\u259F\u25A0\u25FF\u2600\u26FF\u2700\u27BF" >- +"\u2800\u28FF\u2E80\u2EFF\u2F00\u2FDF\u2FF0\u2FFF\u3000\u303F\u3040\u309F\u30A0\u30FF\u3100\u312F\u3130\u318F" >- +"\u3190\u319F\u31A0\u31BF\u3200\u32FF\u3300\u33FF\u3400\u4DB5\u4E00\u9FFF\uA000\uA48F\uA490\uA4CF" >- +"\uAC00\uD7A3\uE000\uF8FF\uF900\uFAFF\uFB00\uFB4F\uFB50\uFDFF" >- +"\uFE20\uFE2F\uFE30\uFE4F\uFE50\uFE6F\uFE70\uFEFE\uFEFF\uFEFF\uFF00\uFFEF"; >- static final int[] nonBMPBlockRanges = { >- 0x10300, 0x1032F, // 84 >- 0x10330, 0x1034F, >- 0x10400, 0x1044F, >- 0x1D000, 0x1D0FF, >- 0x1D100, 0x1D1FF, >- 0x1D400, 0x1D7FF, >- 0x20000, 0x2A6D6, >- 0x2F800, 0x2FA1F, >- 0xE0000, 0xE007F >- }; >- private static final int NONBMP_BLOCK_START = 84; >- >- static protected RangeToken getRange(String name, boolean positive) { >- if (Token.categories.size() == 0) { >- synchronized (Token.categories) { >- Token[] ranges = new Token[Token.categoryNames.length]; >- for (int i = 0; i < ranges.length; i ++) { >- ranges[i] = Token.createRange(); >- } >- int type; >- for (int i = 0; i < 0x10000; i ++) { >- type = Character.getType((char)i); >- if (type == Character.START_PUNCTUATION || >- type == Character.END_PUNCTUATION) { >- //build table of Pi values >- if (i == 0x00AB || i == 0x2018 || i == 0x201B || i == 0x201C || >- i == 0x201F || i == 0x2039) { >- type = CHAR_INIT_QUOTE; >- } >- //build table of Pf values >- if (i == 0x00BB || i == 0x2019 || i == 0x201D || i == 0x203A ) { >- type = CHAR_FINAL_QUOTE; >- } >- } >- ranges[type].addRange(i, i); >- switch (type) { >- case Character.UPPERCASE_LETTER: >- case Character.LOWERCASE_LETTER: >- case Character.TITLECASE_LETTER: >- case Character.MODIFIER_LETTER: >- case Character.OTHER_LETTER: >- type = CHAR_LETTER; >- break; >- case Character.NON_SPACING_MARK: >- case Character.COMBINING_SPACING_MARK: >- case Character.ENCLOSING_MARK: >- type = CHAR_MARK; >- break; >- case Character.DECIMAL_DIGIT_NUMBER: >- case Character.LETTER_NUMBER: >- case Character.OTHER_NUMBER: >- type = CHAR_NUMBER; >- break; >- case Character.SPACE_SEPARATOR: >- case Character.LINE_SEPARATOR: >- case Character.PARAGRAPH_SEPARATOR: >- type = CHAR_SEPARATOR; >- break; >- case Character.CONTROL: >- case Character.FORMAT: >- case Character.SURROGATE: >- case Character.PRIVATE_USE: >- case Character.UNASSIGNED: >- type = CHAR_OTHER; >- break; >- case Character.CONNECTOR_PUNCTUATION: >- case Character.DASH_PUNCTUATION: >- case Character.START_PUNCTUATION: >- case Character.END_PUNCTUATION: >- case CHAR_INIT_QUOTE: >- case CHAR_FINAL_QUOTE: >- case Character.OTHER_PUNCTUATION: >- type = CHAR_PUNCTUATION; >- break; >- case Character.MATH_SYMBOL: >- case Character.CURRENCY_SYMBOL: >- case Character.MODIFIER_SYMBOL: >- case Character.OTHER_SYMBOL: >- type = CHAR_SYMBOL; >- break; >- default: >- throw new RuntimeException("org.apache.xerces.utils.regex.Token#getRange(): Unknown Unicode category: "+type); >- } >- ranges[type].addRange(i, i); >- } // for all characters >- ranges[Character.UNASSIGNED].addRange(0x10000, Token.UTF16_MAX); >- >- for (int i = 0; i < ranges.length; i ++) { >- if (Token.categoryNames[i] != null) { >- if (i == Character.UNASSIGNED) { // Unassigned >- ranges[i].addRange(0x10000, Token.UTF16_MAX); >- } >- Token.categories.put(Token.categoryNames[i], ranges[i]); >- Token.categories2.put(Token.categoryNames[i], >- Token.complementRanges(ranges[i])); >- } >- } >- //REVISIT: do we really need to support block names as in Unicode 3.1 >- // or we can just create all the names in IsBLOCKNAME format (XML Schema REC)? >- // >- StringBuffer buffer = new StringBuffer(50); >- for (int i = 0; i < Token.blockNames.length; i ++) { >- Token r1 = Token.createRange(); >- int location; >- if (i < NONBMP_BLOCK_START) { >- location = i*2; >- int rstart = Token.blockRanges.charAt(location); >- int rend = Token.blockRanges.charAt(location+1); >- //DEBUGING >- //System.out.println(n+" " +Integer.toHexString(rstart) >- // +"-"+ Integer.toHexString(rend)); >- r1.addRange(rstart, rend); >- } else { >- location = (i - NONBMP_BLOCK_START) * 2; >- r1.addRange(Token.nonBMPBlockRanges[location], >- Token.nonBMPBlockRanges[location + 1]); >- } >- String n = Token.blockNames[i]; >- if (n.equals("Specials")) >- r1.addRange(0xfff0, 0xfffd); >- if (n.equals("Private Use")) { >- r1.addRange(0xF0000,0xFFFFD); >- r1.addRange(0x100000,0x10FFFD); >- } >- Token.categories.put(n, r1); >- Token.categories2.put(n, Token.complementRanges(r1)); >- buffer.setLength(0); >- buffer.append("Is"); >- if (n.indexOf(' ') >= 0) { >- for (int ci = 0; ci < n.length(); ci ++) >- if (n.charAt(ci) != ' ') buffer.append(n.charAt(ci)); >- } >- else { >- buffer.append(n); >- } >- Token.setAlias(buffer.toString(), n, true); >- } >- >- // TR#18 1.2 >- Token.setAlias("ASSIGNED", "Cn", false); >- Token.setAlias("UNASSIGNED", "Cn", true); >- Token all = Token.createRange(); >- all.addRange(0, Token.UTF16_MAX); >- Token.categories.put("ALL", all); >- Token.categories2.put("ALL", Token.complementRanges(all)); >- Token.registerNonXS("ASSIGNED"); >- Token.registerNonXS("UNASSIGNED"); >- Token.registerNonXS("ALL"); >- >- Token isalpha = Token.createRange(); >- isalpha.mergeRanges(ranges[Character.UPPERCASE_LETTER]); // Lu >- isalpha.mergeRanges(ranges[Character.LOWERCASE_LETTER]); // Ll >- isalpha.mergeRanges(ranges[Character.OTHER_LETTER]); // Lo >- Token.categories.put("IsAlpha", isalpha); >- Token.categories2.put("IsAlpha", Token.complementRanges(isalpha)); >- Token.registerNonXS("IsAlpha"); >- >- Token isalnum = Token.createRange(); >- isalnum.mergeRanges(isalpha); // Lu Ll Lo >- isalnum.mergeRanges(ranges[Character.DECIMAL_DIGIT_NUMBER]); // Nd >- Token.categories.put("IsAlnum", isalnum); >- Token.categories2.put("IsAlnum", Token.complementRanges(isalnum)); >- Token.registerNonXS("IsAlnum"); >- >- Token isspace = Token.createRange(); >- isspace.mergeRanges(Token.token_spaces); >- isspace.mergeRanges(ranges[CHAR_SEPARATOR]); // Z >- Token.categories.put("IsSpace", isspace); >- Token.categories2.put("IsSpace", Token.complementRanges(isspace)); >- Token.registerNonXS("IsSpace"); >- >- Token isword = Token.createRange(); >- isword.mergeRanges(isalnum); // Lu Ll Lo Nd >- isword.addRange('_', '_'); >- Token.categories.put("IsWord", isword); >- Token.categories2.put("IsWord", Token.complementRanges(isword)); >- Token.registerNonXS("IsWord"); >- >- Token isascii = Token.createRange(); >- isascii.addRange(0, 127); >- Token.categories.put("IsASCII", isascii); >- Token.categories2.put("IsASCII", Token.complementRanges(isascii)); >- Token.registerNonXS("IsASCII"); >- >- Token isnotgraph = Token.createRange(); >- isnotgraph.mergeRanges(ranges[CHAR_OTHER]); >- isnotgraph.addRange(' ', ' '); >- Token.categories.put("IsGraph", Token.complementRanges(isnotgraph)); >- Token.categories2.put("IsGraph", isnotgraph); >- Token.registerNonXS("IsGraph"); >- >- Token isxdigit = Token.createRange(); >- isxdigit.addRange('0', '9'); >- isxdigit.addRange('A', 'F'); >- isxdigit.addRange('a', 'f'); >- Token.categories.put("IsXDigit", Token.complementRanges(isxdigit)); >- Token.categories2.put("IsXDigit", isxdigit); >- Token.registerNonXS("IsXDigit"); >- >- Token.setAlias("IsDigit", "Nd", true); >- Token.setAlias("IsUpper", "Lu", true); >- Token.setAlias("IsLower", "Ll", true); >- Token.setAlias("IsCntrl", "C", true); >- Token.setAlias("IsPrint", "C", false); >- Token.setAlias("IsPunct", "P", true); >- Token.registerNonXS("IsDigit"); >- Token.registerNonXS("IsUpper"); >- Token.registerNonXS("IsLower"); >- Token.registerNonXS("IsCntrl"); >- Token.registerNonXS("IsPrint"); >- Token.registerNonXS("IsPunct"); >- >- Token.setAlias("alpha", "IsAlpha", true); >- Token.setAlias("alnum", "IsAlnum", true); >- Token.setAlias("ascii", "IsASCII", true); >- Token.setAlias("cntrl", "IsCntrl", true); >- Token.setAlias("digit", "IsDigit", true); >- Token.setAlias("graph", "IsGraph", true); >- Token.setAlias("lower", "IsLower", true); >- Token.setAlias("print", "IsPrint", true); >- Token.setAlias("punct", "IsPunct", true); >- Token.setAlias("space", "IsSpace", true); >- Token.setAlias("upper", "IsUpper", true); >- Token.setAlias("word", "IsWord", true); // Perl extension >- Token.setAlias("xdigit", "IsXDigit", true); >- Token.registerNonXS("alpha"); >- Token.registerNonXS("alnum"); >- Token.registerNonXS("ascii"); >- Token.registerNonXS("cntrl"); >- Token.registerNonXS("digit"); >- Token.registerNonXS("graph"); >- Token.registerNonXS("lower"); >- Token.registerNonXS("print"); >- Token.registerNonXS("punct"); >- Token.registerNonXS("space"); >- Token.registerNonXS("upper"); >- Token.registerNonXS("word"); >- Token.registerNonXS("xdigit"); >- } // synchronized >- } // if null >- RangeToken tok = positive ? (RangeToken)Token.categories.get(name) >- : (RangeToken)Token.categories2.get(name); >- //if (tok == null) System.out.println(name); >- return tok; >- } >- static protected RangeToken getRange(String name, boolean positive, boolean xs) { >- RangeToken range = Token.getRange(name, positive); >- if (xs && range != null && Token.isRegisterNonXS(name)) >- range = null; >- return range; >- } >- >- static Hashtable nonxs = null; >- /** >- * This method is called by only getRange(). >- * So this method need not MT-safe. >- */ >- static protected void registerNonXS(String name) { >- if (Token.nonxs == null) >- Token.nonxs = new Hashtable(); >- Token.nonxs.put(name, name); >- } >- static protected boolean isRegisterNonXS(String name) { >- if (Token.nonxs == null) >- return false; >- //DEBUG >- //System.err.println("isRegisterNonXS: "+name); >- return Token.nonxs.containsKey(name); >- } >- >- private static void setAlias(String newName, String name, boolean positive) { >- Token t1 = (Token)Token.categories.get(name); >- Token t2 = (Token)Token.categories2.get(name); >- if (positive) { >- Token.categories.put(newName, t1); >- Token.categories2.put(newName, t2); >- } else { >- Token.categories2.put(newName, t1); >- Token.categories.put(newName, t2); >- } >- } >- >- // ------------------------------------------------------ >- >- static final String viramaString = >- "\u094D"// ;DEVANAGARI SIGN VIRAMA;Mn;9;ON;;;;;N;;;;; >- +"\u09CD"//;BENGALI SIGN VIRAMA;Mn;9;ON;;;;;N;;;;; >- +"\u0A4D"//;GURMUKHI SIGN VIRAMA;Mn;9;ON;;;;;N;;;;; >- +"\u0ACD"//;GUJARATI SIGN VIRAMA;Mn;9;ON;;;;;N;;;;; >- +"\u0B4D"//;ORIYA SIGN VIRAMA;Mn;9;ON;;;;;N;;;;; >- +"\u0BCD"//;TAMIL SIGN VIRAMA;Mn;9;ON;;;;;N;;;;; >- +"\u0C4D"//;TELUGU SIGN VIRAMA;Mn;9;ON;;;;;N;;;;; >- +"\u0CCD"//;KANNADA SIGN VIRAMA;Mn;9;ON;;;;;N;;;;; >- +"\u0D4D"//;MALAYALAM SIGN VIRAMA;Mn;9;ON;;;;;N;;;;; >- +"\u0E3A"//;THAI CHARACTER PHINTHU;Mn;9;ON;;;;;N;THAI VOWEL SIGN PHINTHU;;;; >- +"\u0F84";//;TIBETAN MARK HALANTA;Mn;9;ON;;;;;N;TIBETAN VIRAMA;;;; >- >- static private Token token_grapheme = null; >- static synchronized Token getGraphemePattern() { >- if (Token.token_grapheme != null) >- return Token.token_grapheme; >- >- Token base_char = Token.createRange(); // [{ASSIGNED}]-[{M},{C}] >- base_char.mergeRanges(Token.getRange("ASSIGNED", true)); >- base_char.subtractRanges(Token.getRange("M", true)); >- base_char.subtractRanges(Token.getRange("C", true)); >- >- Token virama = Token.createRange(); >- for (int i = 0; i < Token.viramaString.length(); i ++) { >- virama.addRange(i, i); >- } >- >- Token combiner_wo_virama = Token.createRange(); >- combiner_wo_virama.mergeRanges(Token.getRange("M", true)); >- combiner_wo_virama.addRange(0x1160, 0x11ff); // hangul_medial and hangul_final >- combiner_wo_virama.addRange(0xff9e, 0xff9f); // extras >- >- Token left = Token.createUnion(); // base_char? >- left.addChild(base_char); >- left.addChild(Token.token_empty); >- >- Token foo = Token.createUnion(); >- foo.addChild(Token.createConcat(virama, Token.getRange("L", true))); >- foo.addChild(combiner_wo_virama); >- >- foo = Token.createClosure(foo); >- >- foo = Token.createConcat(left, foo); >- >- Token.token_grapheme = foo; >- return Token.token_grapheme; >- } >- >- /** >- * Combing Character Sequence in Perl 5.6. >- */ >- static private Token token_ccs = null; >- static synchronized Token getCombiningCharacterSequence() { >- if (Token.token_ccs != null) >- return Token.token_ccs; >- >- Token foo = Token.createClosure(Token.getRange("M", true)); // \pM* >- foo = Token.createConcat(Token.getRange("M", false), foo); // \PM + \pM* >- Token.token_ccs = foo; >- return Token.token_ccs; >- } >- >- // ------------------------------------------------------ >- >- // ------------------------------------------------------ >- /** >- * This class represents a node in parse tree. >- */ >- static class StringToken extends Token implements java.io.Serializable { >- String string; >- int refNumber; >- >- StringToken(int type, String str, int n) { >- super(type); >- this.string = str; >- this.refNumber = n; >- } >- >- int getReferenceNumber() { // for STRING >- return this.refNumber; >- } >- String getString() { // for STRING >- return this.string; >- } >- >- public String toString(int options) { >- if (this.type == BACKREFERENCE) >- return "\\"+this.refNumber; >- else >- return REUtil.quoteMeta(this.string); >- } >- } >- >- /** >- * This class represents a node in parse tree. >- */ >- static class ConcatToken extends Token implements java.io.Serializable { >- Token child; >- Token child2; >- >- ConcatToken(Token t1, Token t2) { >- super(Token.CONCAT); >- this.child = t1; >- this.child2 = t2; >- } >- >- int size() { >- return 2; >- } >- Token getChild(int index) { >- return index == 0 ? this.child : this.child2; >- } >- >- public String toString(int options) { >- String ret; >- if (this.child2.type == CLOSURE && this.child2.getChild(0) == this.child) { >- ret = this.child.toString(options)+"+"; >- } else if (this.child2.type == NONGREEDYCLOSURE && this.child2.getChild(0) == this.child) { >- ret = this.child.toString(options)+"+?"; >- } else >- ret = this.child.toString(options)+this.child2.toString(options); >- return ret; >- } >- } >- >- /** >- * This class represents a node in parse tree. >- */ >- static class CharToken extends Token implements java.io.Serializable { >- int chardata; >- >- CharToken(int type, int ch) { >- super(type); >- this.chardata = ch; >- } >- >- int getChar() { >- return this.chardata; >- } >- >- public String toString(int options) { >- String ret; >- switch (this.type) { >- case CHAR: >- switch (this.chardata) { >- case '|': case '*': case '+': case '?': >- case '(': case ')': case '.': case '[': >- case '{': case '\\': >- ret = "\\"+(char)this.chardata; >- break; >- case '\f': ret = "\\f"; break; >- case '\n': ret = "\\n"; break; >- case '\r': ret = "\\r"; break; >- case '\t': ret = "\\t"; break; >- case 0x1b: ret = "\\e"; break; >- //case 0x0b: ret = "\\v"; break; >- default: >- if (this.chardata >= 0x10000) { >- String pre = "0"+Integer.toHexString(this.chardata); >- ret = "\\v"+pre.substring(pre.length()-6, pre.length()); >- } else >- ret = ""+(char)this.chardata; >- } >- break; >- >- case ANCHOR: >- if (this == Token.token_linebeginning || this == Token.token_lineend) >- ret = ""+(char)this.chardata; >- else >- ret = "\\"+(char)this.chardata; >- break; >- >- default: >- ret = null; >- } >- return ret; >- } >- >- boolean match(int ch) { >- if (this.type == CHAR) { >- return ch == this.chardata; >- } else >- throw new RuntimeException("NFAArrow#match(): Internal error: "+this.type); >- } >- } >- >- /** >- * This class represents a node in parse tree. >- */ >- static class ClosureToken extends Token implements java.io.Serializable { >- int min; >- int max; >- Token child; >- >- ClosureToken(int type, Token tok) { >- super(type); >- this.child = tok; >- this.setMin(-1); >- this.setMax(-1); >- } >- >- int size() { >- return 1; >- } >- Token getChild(int index) { >- return this.child; >- } >- >- final void setMin(int min) { >- this.min = min; >- } >- final void setMax(int max) { >- this.max = max; >- } >- final int getMin() { >- return this.min; >- } >- final int getMax() { >- return this.max; >- } >- >- public String toString(int options) { >- String ret; >- if (this.type == CLOSURE) { >- if (this.getMin() < 0 && this.getMax() < 0) { >- ret = this.child.toString(options)+"*"; >- } else if (this.getMin() == this.getMax()) { >- ret = this.child.toString(options)+"{"+this.getMin()+"}"; >- } else if (this.getMin() >= 0 && this.getMax() >= 0) { >- ret = this.child.toString(options)+"{"+this.getMin()+","+this.getMax()+"}"; >- } else if (this.getMin() >= 0 && this.getMax() < 0) { >- ret = this.child.toString(options)+"{"+this.getMin()+",}"; >- } else >- throw new RuntimeException("Token#toString(): CLOSURE " >- +this.getMin()+", "+this.getMax()); >- } else { >- if (this.getMin() < 0 && this.getMax() < 0) { >- ret = this.child.toString(options)+"*?"; >- } else if (this.getMin() == this.getMax()) { >- ret = this.child.toString(options)+"{"+this.getMin()+"}?"; >- } else if (this.getMin() >= 0 && this.getMax() >= 0) { >- ret = this.child.toString(options)+"{"+this.getMin()+","+this.getMax()+"}?"; >- } else if (this.getMin() >= 0 && this.getMax() < 0) { >- ret = this.child.toString(options)+"{"+this.getMin()+",}?"; >- } else >- throw new RuntimeException("Token#toString(): NONGREEDYCLOSURE " >- + this.getMin() + ", " + this.getMax()); >- } >- return ret; >- } >- } >- >- /** >- * This class represents a node in parse tree. >- */ >- static class ParenToken extends Token implements java.io.Serializable >- { >- Token child; >- >- int parennumber; >- >- ParenToken(int type, Token tok, int paren) >- { >- super(type); >- this.child = tok; >- this.parennumber = paren; >- } >- >- int size() >- { >- return 1; >- } >- >- Token getChild(int index) >- { >- return this.child; >- } >- >- int getParenNumber() >- { >- return this.parennumber; >- } >- >- public String toString(int options) >- { >- String ret = null; >- switch (this.type) >- { >- case PAREN: >- if (this.parennumber == 0) >- { >- ret = "(?:" + this.child.toString(options) + ")"; >- } >- else >- { >- ret = "(" + this.child.toString(options) + ")"; >- } >- break; >- >- case LOOKAHEAD: >- ret = "(?=" + this.child.toString(options) + ")"; >- break; >- case NEGATIVELOOKAHEAD: >- ret = "(?!" + this.child.toString(options) + ")"; >- break; >- case LOOKBEHIND: >- ret = "(?<=" + this.child.toString(options) + ")"; >- break; >- case NEGATIVELOOKBEHIND: >- ret = "(?<!" + this.child.toString(options) + ")"; >- break; >- case INDEPENDENT: >- ret = "(?>" + this.child.toString(options) + ")"; >- break; >- } >- return ret; >- } >- } >- >- /** >- * (?(condition)yes-pattern|no-pattern) >- */ >- static class ConditionToken extends Token implements java.io.Serializable >- { >- int refNumber; >- >- Token condition; >- >- Token yes; >- >- Token no; >- >- ConditionToken(int refno, Token cond, Token yespat, Token nopat) >- { >- super(Token.CONDITION); >- this.refNumber = refno; >- this.condition = cond; >- this.yes = yespat; >- this.no = nopat; >- } >- >- int size() >- { >- return this.no == null ? 1 : 2; >- } >- >- Token getChild(int index) >- { >- if (index == 0) >- return this.yes; >- if (index == 1) >- return this.no; >- throw new RuntimeException("Internal Error: " + index); >- } >- >- public String toString(int options) >- { >- String ret; >- if (refNumber > 0) >- { >- ret = "(?(" + refNumber + ")"; >- } >- else if (this.condition.type == Token.ANCHOR) >- { >- ret = "(?(" + this.condition + ")"; >- } >- else >- { >- ret = "(?" + this.condition; >- } >- >- if (this.no == null) >- { >- ret += this.yes + ")"; >- } >- else >- { >- ret += this.yes + "|" + this.no + ")"; >- } >- return ret; >- } >- } >- >- /** >- * (ims-ims: .... ) >- */ >- static class ModifierToken extends Token implements java.io.Serializable >- { >- Token child; >- >- int add; >- >- int mask; >- >- ModifierToken(Token tok, int add, int mask) >- { >- super(Token.MODIFIERGROUP); >- this.child = tok; >- this.add = add; >- this.mask = mask; >- } >- >- int size() >- { >- return 1; >- } >- >- Token getChild(int index) >- { >- return this.child; >- } >- >- int getOptions() >- { >- return this.add; >- } >- >- int getOptionsMask() >- { >- return this.mask; >- } >- >- public String toString(int options) >- { >- return "(?" + (this.add == 0 ? "" : REUtil.createOptionString(this.add)) >- + (this.mask == 0 ? "" : REUtil.createOptionString(this.mask)) + ":" + this.child.toString(options) + ")"; >- } >- } >- >- /** >- * This class represents a node in parse tree. >- * for UNION or CONCAT. >- */ >- static class UnionToken extends Token implements java.io.Serializable >- { >- Vector children; >- >- UnionToken(int type) >- { >- super(type); >- } >- >- void addChild(Token tok) >- { >- if (tok == null) >- return; >- if (this.children == null) >- this.children = new Vector(); >- if (this.type == UNION) >- { >- this.children.addElement(tok); >- return; >- } >- // This is CONCAT, and new child is CONCAT. >- if (tok.type == CONCAT) >- { >- for (int i = 0; i < tok.size(); i++) >- this.addChild(tok.getChild(i)); // Recursion >- return; >- } >- int size = this.children.size(); >- if (size == 0) >- { >- this.children.addElement(tok); >- return; >- } >- Token previous = (Token)this.children.elementAt(size - 1); >- if (!((previous.type == CHAR || previous.type == STRING) && (tok.type == CHAR || tok.type == STRING))) >- { >- this.children.addElement(tok); >- return; >- } >- >- //System.err.println("Merge '"+previous+"' and '"+tok+"'."); >- >- StringBuffer buffer; >- int nextMaxLength = (tok.type == CHAR ? 2 : tok.getString().length()); >- if (previous.type == CHAR) >- { // Replace previous token by STRING >- buffer = new StringBuffer(2 + nextMaxLength); >- int ch = previous.getChar(); >- if (ch >= 0x10000) >- buffer.append(REUtil.decomposeToSurrogates(ch)); >- else >- buffer.append((char)ch); >- previous = Token.createString(null); >- this.children.setElementAt(previous, size - 1); >- } >- else >- { // STRING >- buffer = new StringBuffer(previous.getString().length() + nextMaxLength); >- buffer.append(previous.getString()); >- } >- >- if (tok.type == CHAR) >- { >- int ch = tok.getChar(); >- if (ch >= 0x10000) >- buffer.append(REUtil.decomposeToSurrogates(ch)); >- else >- buffer.append((char)ch); >- } >- else >- { >- buffer.append(tok.getString()); >- } >- >- ((StringToken)previous).string = new String(buffer); >- } >- >- int size() >- { >- return this.children == null ? 0 : this.children.size(); >- } >- >- Token getChild(int index) >- { >- return (Token)this.children.elementAt(index); >- } >- >- public String toString(int options) >- { >- String ret; >- if (this.type == CONCAT) >- { >- if (this.children.size() == 2) >- { >- Token ch = this.getChild(0); >- Token ch2 = this.getChild(1); >- if (ch2.type == CLOSURE && ch2.getChild(0) == ch) >- { >- ret = ch.toString(options) + "+"; >- } >- else if (ch2.type == NONGREEDYCLOSURE && ch2.getChild(0) == ch) >- { >- ret = ch.toString(options) + "+?"; >- } >- else >- ret = ch.toString(options) + ch2.toString(options); >- } >- else >- { >- StringBuffer sb = new StringBuffer(); >- for (int i = 0; i < this.children.size(); i++) >- { >- sb.append(((Token)this.children.elementAt(i)).toString(options)); >- } >- ret = new String(sb); >- } >- return ret; >- } >- if (this.children.size() == 2 && this.getChild(1).type == EMPTY) >- { >- ret = this.getChild(0).toString(options) + "?"; >- } >- else if (this.children.size() == 2 && this.getChild(0).type == EMPTY) >- { >- ret = this.getChild(1).toString(options) + "??"; >- } >- else >- { >- StringBuffer sb = new StringBuffer(); >- sb.append(((Token)this.children.elementAt(0)).toString(options)); >- for (int i = 1; i < this.children.size(); i++) >- { >- sb.append('|'); >- sb.append(((Token)this.children.elementAt(i)).toString(options)); >- } >- ret = new String(sb); >- } >- return ret; >- } >- } >- } >- >- /** >- * A regular expression parser for the XML Shema. >- * >- * @author TAMURA Kent <kent@trl.ibm.co.jp> >- * @version $Id: RegEx.java,v 1.8.4.1 2007/08/14 18:18:44 emerks Exp $ >- */ >- static class ParserForXMLSchema extends RegexParser >- { >- >- public ParserForXMLSchema() >- { >- //this.setLocale(Locale.getDefault()); >- } >- >- public ParserForXMLSchema(Locale locale) >- { >- //this.setLocale(locale); >- } >- >- Token processCaret() throws ParseException >- { >- this.next(); >- return Token.createChar('^'); >- } >- >- Token processDollar() throws ParseException >- { >- this.next(); >- return Token.createChar('$'); >- } >- >- Token processLookahead() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processNegativelookahead() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processLookbehind() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processNegativelookbehind() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processBacksolidus_A() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processBacksolidus_Z() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processBacksolidus_z() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processBacksolidus_b() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processBacksolidus_B() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processBacksolidus_lt() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processBacksolidus_gt() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processStar(Token tok) throws ParseException >- { >- this.next(); >- return Token.createClosure(tok); >- } >- >- Token processPlus(Token tok) throws ParseException >- { >- // X+ -> XX* >- this.next(); >- return Token.createConcat(tok, Token.createClosure(tok)); >- } >- >- Token processQuestion(Token tok) throws ParseException >- { >- // X? -> X| >- this.next(); >- Token par = Token.createUnion(); >- par.addChild(tok); >- par.addChild(Token.createEmpty()); >- return par; >- } >- >- boolean checkQuestion(int off) >- { >- return false; >- } >- >- Token processParen() throws ParseException >- { >- this.next(); >- Token tok = Token.createParen(this.parseRegex(), 0); >- if (this.read() != T_RPAREN) >- throw ex("parser.factor.1", this.offset - 1); >- this.next(); // Skips ')' >- return tok; >- } >- >- Token processParen2() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processCondition() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processModifiers() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processIndependent() throws ParseException >- { >- throw ex("parser.process.1", this.offset); >- } >- >- Token processBacksolidus_c() throws ParseException >- { >- this.next(); >- return this.getTokenForShorthand('c'); >- } >- >- Token processBacksolidus_C() throws ParseException >- { >- this.next(); >- return this.getTokenForShorthand('C'); >- } >- >- Token processBacksolidus_i() throws ParseException >- { >- this.next(); >- return this.getTokenForShorthand('i'); >- } >- >- Token processBacksolidus_I() throws ParseException >- { >- this.next(); >- return this.getTokenForShorthand('I'); >- } >- >- Token processBacksolidus_g() throws ParseException >- { >- throw this.ex("parser.process.1", this.offset - 2); >- } >- >- Token processBacksolidus_X() throws ParseException >- { >- throw ex("parser.process.1", this.offset - 2); >- } >- >- Token processBackreference() throws ParseException >- { >- throw ex("parser.process.1", this.offset - 4); >- } >- >- int processCIinCharacterClass(RangeToken tok, int c) >- { >- tok.mergeRanges(this.getTokenForShorthand(c)); >- return -1; >- } >- >- /** >- * Parses a character-class-expression, not a character-class-escape. >- * >- * c-c-expression ::= '[' c-group ']' >- * c-group ::= positive-c-group | negative-c-group | c-c-subtraction >- * positive-c-group ::= (c-range | c-c-escape)+ >- * negative-c-group ::= '^' positive-c-group >- * c-c-subtraction ::= (positive-c-group | negative-c-group) subtraction >- * subtraction ::= '-' c-c-expression >- * c-range ::= single-range | from-to-range >- * single-range ::= multi-c-escape | category-c-escape | block-c-escape | <any XML char> >- * cc-normal-c ::= <any character except [, ], \> >- * from-to-range ::= cc-normal-c '-' cc-normal-c >- * >- * @param useNrage Ignored. >- * @return This returns no NrageToken. >- */ >- protected RangeToken parseCharacterClass(boolean useNrange) throws ParseException >- { >- this.setContext(S_INBRACKETS); >- this.next(); // '[' >- boolean nrange = false; >- RangeToken base = null; >- RangeToken tok; >- if (this.read() == T_CHAR && this.chardata == '^') >- { >- nrange = true; >- this.next(); // '^' >- base = Token.createRange(); >- base.addRange(0, Token.UTF16_MAX); >- tok = Token.createRange(); >- } >- else >- { >- tok = Token.createRange(); >- } >- int type; >- boolean firstloop = true; >- while ((type = this.read()) != T_EOF) >- { // Don't use 'cotinue' for this loop. >- // single-range | from-to-range | subtraction >- if (type == T_CHAR && this.chardata == ']' && !firstloop) >- { >- if (nrange) >- { >- base.subtractRanges(tok); >- tok = base; >- } >- break; >- } >- int c = this.chardata; >- boolean end = false; >- if (type == T_BACKSOLIDUS) >- { >- switch (c) >- { >- case 'd': >- case 'D': >- case 'w': >- case 'W': >- case 's': >- case 'S': >- tok.mergeRanges(this.getTokenForShorthand(c)); >- end = true; >- break; >- >- case 'i': >- case 'I': >- case 'c': >- case 'C': >- c = this.processCIinCharacterClass(tok, c); >- if (c < 0) >- end = true; >- break; >- >- case 'p': >- case 'P': >- int pstart = this.offset; >- RangeToken tok2 = this.processBacksolidus_pP(c); >- if (tok2 == null) >- throw this.ex("parser.atom.5", pstart); >- tok.mergeRanges(tok2); >- end = true; >- break; >- >- default: >- c = this.decodeEscaped(); >- } // \ + c >- } // backsolidus >- else if (type == T_XMLSCHEMA_CC_SUBTRACTION && !firstloop) >- { >- // Subraction >- if (nrange) >- { >- base.subtractRanges(tok); >- tok = base; >- } >- RangeToken range2 = this.parseCharacterClass(false); >- tok.subtractRanges(range2); >- if (this.read() != T_CHAR || this.chardata != ']') >- throw this.ex("parser.cc.5", this.offset); >- break; // Exit this loop >- } >- this.next(); >- if (!end) >- { // if not shorthands... >- if (type == T_CHAR) >- { >- if (c == '[') >- throw this.ex("parser.cc.6", this.offset - 2); >- if (c == ']') >- throw this.ex("parser.cc.7", this.offset - 2); >- if (c == '-' && !firstloop && chardata != ']') >- throw this.ex("parser.cc.8", this.offset - 2); >- } >- if (this.read() != T_CHAR || this.chardata != '-' || c == '-' && firstloop) >- { // Here is no '-'. >- tok.addRange(c, c); >- } >- else >- { // Found '-' >- // Is this '-' is a from-to token?? >- this.next(); // Skips '-' >- if ((type = this.read()) == T_EOF) >- throw this.ex("parser.cc.2", this.offset); >- // c '-' ']' -> '-' is a single-range. >- if (type == T_CHAR && this.chardata == ']') >- { // if - is at the last position of the group >- tok.addRange(c, c); >- tok.addRange('-', '-'); >- } >- else if ((type == T_CHAR && this.chardata == ']') || type == T_XMLSCHEMA_CC_SUBTRACTION) >- { >- throw this.ex("parser.cc.8", this.offset - 1); >- } >- else >- { >- int rangeend = this.chardata; >- if (type == T_CHAR) >- { >- if (rangeend == '[') >- throw this.ex("parser.cc.6", this.offset - 1); >- if (rangeend == ']') >- throw this.ex("parser.cc.7", this.offset - 1); >- if (rangeend == '-') >- throw this.ex("parser.cc.8", this.offset - 1); >- } >- else if (type == T_BACKSOLIDUS) >- rangeend = this.decodeEscaped(); >- this.next(); >- >- if (c > rangeend) >- throw this.ex("parser.ope.3", this.offset - 1); >- tok.addRange(c, rangeend); >- } >- } >- } >- firstloop = false; >- } >- if (this.read() == T_EOF) >- throw this.ex("parser.cc.2", this.offset); >- tok.sortRanges(); >- tok.compactRanges(); >- //tok.dumpRanges(); >- this.setContext(S_NORMAL); >- this.next(); // Skips ']' >- >- return tok; >- } >- >- protected RangeToken parseSetOperations() throws ParseException >- { >- throw this.ex("parser.process.1", this.offset); >- } >- >- Token getTokenForShorthand(int ch) >- { >- switch (ch) >- { >- case 'd': >- return ParserForXMLSchema.getRange("xml:isDigit", true); >- case 'D': >- return ParserForXMLSchema.getRange("xml:isDigit", false); >- case 'w': >- return ParserForXMLSchema.getRange("xml:isWord", true); >- case 'W': >- return ParserForXMLSchema.getRange("xml:isWord", false); >- case 's': >- return ParserForXMLSchema.getRange("xml:isSpace", true); >- case 'S': >- return ParserForXMLSchema.getRange("xml:isSpace", false); >- case 'c': >- return ParserForXMLSchema.getRange("xml:isNameChar", true); >- case 'C': >- return ParserForXMLSchema.getRange("xml:isNameChar", false); >- case 'i': >- return ParserForXMLSchema.getRange("xml:isInitialNameChar", true); >- case 'I': >- return ParserForXMLSchema.getRange("xml:isInitialNameChar", false); >- default: >- throw new RuntimeException("Internal Error: shorthands: \\u" + Integer.toString(ch, 16)); >- } >- } >- >- int decodeEscaped() throws ParseException >- { >- if (this.read() != T_BACKSOLIDUS) >- throw ex("parser.next.1", this.offset - 1); >- int c = this.chardata; >- switch (c) >- { >- case 'n': >- c = '\n'; >- break; // LINE FEED U+000A >- case 'r': >- c = '\r'; >- break; // CRRIAGE RETURN U+000D >- case 't': >- c = '\t'; >- break; // HORIZONTAL TABULATION U+0009 >- case '\\': >- case '|': >- case '.': >- case '^': >- case '-': >- case '?': >- case '*': >- case '+': >- case '{': >- case '}': >- case '(': >- case ')': >- case '[': >- case ']': >- break; // return actucal char >- default: >- throw ex("parser.process.1", this.offset - 2); >- } >- return c; >- } >- >- static private Hashtable ranges = null; >- >- static private Hashtable ranges2 = null; >- >- static synchronized protected RangeToken getRange(String name, boolean positive) >- { >- if (ranges == null) >- { >- ranges = new Hashtable(); >- ranges2 = new Hashtable(); >- >- Token tok = Token.createRange(); >- setupRange(tok, SPACES); >- ranges.put("xml:isSpace", tok); >- ranges2.put("xml:isSpace", Token.complementRanges(tok)); >- >- tok = Token.createRange(); >- setupRange(tok, DIGITS); >- ranges.put("xml:isDigit", tok); >- ranges2.put("xml:isDigit", Token.complementRanges(tok)); >- >- tok = Token.createRange(); >- setupRange(tok, DIGITS); >- ranges.put("xml:isDigit", tok); >- ranges2.put("xml:isDigit", Token.complementRanges(tok)); >- >- tok = Token.createRange(); >- setupRange(tok, LETTERS); >- tok.mergeRanges((Token)ranges.get("xml:isDigit")); >- ranges.put("xml:isWord", tok); >- ranges2.put("xml:isWord", Token.complementRanges(tok)); >- >- tok = Token.createRange(); >- setupRange(tok, NAMECHARS); >- ranges.put("xml:isNameChar", tok); >- ranges2.put("xml:isNameChar", Token.complementRanges(tok)); >- >- tok = Token.createRange(); >- setupRange(tok, LETTERS); >- tok.addRange('_', '_'); >- tok.addRange(':', ':'); >- ranges.put("xml:isInitialNameChar", tok); >- ranges2.put("xml:isInitialNameChar", Token.complementRanges(tok)); >- } >- RangeToken tok = positive ? (RangeToken)ranges.get(name) : (RangeToken)ranges2.get(name); >- return tok; >- } >- >- static void setupRange(Token range, String src) >- { >- int len = src.length(); >- for (int i = 0; i < len; i += 2) >- range.addRange(src.charAt(i), src.charAt(i + 1)); >- } >- >- private static final String SPACES = "\t\n\r\r "; >- >- private static final String NAMECHARS = "\u002d\u002e\u0030\u003a\u0041\u005a\u005f\u005f\u0061\u007a\u00b7\u00b7\u00c0\u00d6" >- + "\u00d8\u00f6\u00f8\u0131\u0134\u013e\u0141\u0148\u014a\u017e\u0180\u01c3\u01cd\u01f0" >- + "\u01f4\u01f5\u01fa\u0217\u0250\u02a8\u02bb\u02c1\u02d0\u02d1\u0300\u0345\u0360\u0361" >- + "\u0386\u038a\u038c\u038c\u038e\u03a1\u03a3\u03ce\u03d0\u03d6\u03da\u03da\u03dc\u03dc" >- + "\u03de\u03de\u03e0\u03e0\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c\u045e\u0481" >- + "\u0483\u0486\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9" >- + "\u0531\u0556\u0559\u0559\u0561\u0586\u0591\u05a1\u05a3\u05b9\u05bb\u05bd\u05bf\u05bf" >- + "\u05c1\u05c2\u05c4\u05c4\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0640\u0652\u0660\u0669" >- + "\u0670\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06d5\u06e8\u06ea\u06ed\u06f0\u06f9" >- + "\u0901\u0903\u0905\u0939\u093c\u094d\u0951\u0954\u0958\u0963\u0966\u096f\u0981\u0983" >- + "\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2\u09b6\u09b9\u09bc\u09bc" >- + "\u09be\u09c4\u09c7\u09c8\u09cb\u09cd\u09d7\u09d7\u09dc\u09dd\u09df\u09e3\u09e6\u09f1" >- + "\u0a02\u0a02\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36" >- + "\u0a38\u0a39\u0a3c\u0a3c\u0a3e\u0a42\u0a47\u0a48\u0a4b\u0a4d\u0a59\u0a5c\u0a5e\u0a5e" >- + "\u0a66\u0a74\u0a81\u0a83\u0a85\u0a8b\u0a8d\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0" >- + "\u0ab2\u0ab3\u0ab5\u0ab9\u0abc\u0ac5\u0ac7\u0ac9\u0acb\u0acd\u0ae0\u0ae0\u0ae6\u0aef" >- + "\u0b01\u0b03\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33\u0b36\u0b39" >- + "\u0b3c\u0b43\u0b47\u0b48\u0b4b\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f\u0b61\u0b66\u0b6f" >- + "\u0b82\u0b83\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f" >- + "\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9\u0bbe\u0bc2\u0bc6\u0bc8\u0bca\u0bcd" >- + "\u0bd7\u0bd7\u0be7\u0bef\u0c01\u0c03\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33" >- + "\u0c35\u0c39\u0c3e\u0c44\u0c46\u0c48\u0c4a\u0c4d\u0c55\u0c56\u0c60\u0c61\u0c66\u0c6f" >- + "\u0c82\u0c83\u0c85\u0c8c\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0cbe\u0cc4" >- + "\u0cc6\u0cc8\u0cca\u0ccd\u0cd5\u0cd6\u0cde\u0cde\u0ce0\u0ce1\u0ce6\u0cef\u0d02\u0d03" >- + "\u0d05\u0d0c\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d3e\u0d43\u0d46\u0d48\u0d4a\u0d4d" >- + "\u0d57\u0d57\u0d60\u0d61\u0d66\u0d6f\u0e01\u0e2e\u0e30\u0e3a\u0e40\u0e4e\u0e50\u0e59" >- + "\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d\u0e94\u0e97\u0e99\u0e9f" >- + "\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead\u0eae\u0eb0\u0eb9\u0ebb\u0ebd" >- + "\u0ec0\u0ec4\u0ec6\u0ec6\u0ec8\u0ecd\u0ed0\u0ed9\u0f18\u0f19\u0f20\u0f29\u0f35\u0f35" >- + "\u0f37\u0f37\u0f39\u0f39\u0f3e\u0f47\u0f49\u0f69\u0f71\u0f84\u0f86\u0f8b\u0f90\u0f95" >- + "\u0f97\u0f97\u0f99\u0fad\u0fb1\u0fb7\u0fb9\u0fb9\u10a0\u10c5\u10d0\u10f6\u1100\u1100" >- + "\u1102\u1103\u1105\u1107\u1109\u1109\u110b\u110c\u110e\u1112\u113c\u113c\u113e\u113e" >- + "\u1140\u1140\u114c\u114c\u114e\u114e\u1150\u1150\u1154\u1155\u1159\u1159\u115f\u1161" >- + "\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116d\u116e\u1172\u1173\u1175\u1175" >- + "\u119e\u119e\u11a8\u11a8\u11ab\u11ab\u11ae\u11af\u11b7\u11b8\u11ba\u11ba\u11bc\u11c2" >- + "\u11eb\u11eb\u11f0\u11f0\u11f9\u11f9\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15\u1f18\u1f1d" >- + "\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b\u1f5d\u1f5d\u1f5f\u1f7d" >- + "\u1f80\u1fb4\u1fb6\u1fbc\u1fbe\u1fbe\u1fc2\u1fc4\u1fc6\u1fcc\u1fd0\u1fd3\u1fd6\u1fdb" >- + "\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc\u20d0\u20dc\u20e1\u20e1\u2126\u2126\u212a\u212b" >- + "\u212e\u212e\u2180\u2182\u3005\u3005\u3007\u3007\u3021\u302f\u3031\u3035\u3041\u3094" >- + "\u3099\u309a\u309d\u309e\u30a1\u30fa\u30fc\u30fe\u3105\u312c\u4e00\u9fa5\uac00\ud7a3" + ""; >- >- private static final String LETTERS = "\u0041\u005a\u0061\u007a\u00c0\u00d6\u00d8\u00f6\u00f8\u0131\u0134\u013e\u0141\u0148" >- + "\u014a\u017e\u0180\u01c3\u01cd\u01f0\u01f4\u01f5\u01fa\u0217\u0250\u02a8\u02bb\u02c1" >- + "\u0386\u0386\u0388\u038a\u038c\u038c\u038e\u03a1\u03a3\u03ce\u03d0\u03d6\u03da\u03da" >- + "\u03dc\u03dc\u03de\u03de\u03e0\u03e0\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c" >- + "\u045e\u0481\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9" >- + "\u0531\u0556\u0559\u0559\u0561\u0586\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0641\u064a" >- + "\u0671\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06d5\u06d5\u06e5\u06e6\u0905\u0939" >- + "\u093d\u093d\u0958\u0961\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2" >- + "\u09b6\u09b9\u09dc\u09dd\u09df\u09e1\u09f0\u09f1\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28" >- + "\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59\u0a5c\u0a5e\u0a5e\u0a72\u0a74" >- + "\u0a85\u0a8b\u0a8d\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0\u0ab2\u0ab3\u0ab5\u0ab9" >- + "\u0abd\u0abd\u0ae0\u0ae0\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33" >- + "\u0b36\u0b39\u0b3d\u0b3d\u0b5c\u0b5d\u0b5f\u0b61\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95" >- + "\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9" >- + "\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33\u0c35\u0c39\u0c60\u0c61\u0c85\u0c8c" >- + "\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0cde\u0cde\u0ce0\u0ce1\u0d05\u0d0c" >- + "\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d60\u0d61\u0e01\u0e2e\u0e30\u0e30\u0e32\u0e33" >- + "\u0e40\u0e45\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d\u0e94\u0e97" >- + "\u0e99\u0e9f\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead\u0eae\u0eb0\u0eb0" >- + "\u0eb2\u0eb3\u0ebd\u0ebd\u0ec0\u0ec4\u0f40\u0f47\u0f49\u0f69\u10a0\u10c5\u10d0\u10f6" >- + "\u1100\u1100\u1102\u1103\u1105\u1107\u1109\u1109\u110b\u110c\u110e\u1112\u113c\u113c" >- + "\u113e\u113e\u1140\u1140\u114c\u114c\u114e\u114e\u1150\u1150\u1154\u1155\u1159\u1159" >- + "\u115f\u1161\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116d\u116e\u1172\u1173" >- + "\u1175\u1175\u119e\u119e\u11a8\u11a8\u11ab\u11ab\u11ae\u11af\u11b7\u11b8\u11ba\u11ba" >- + "\u11bc\u11c2\u11eb\u11eb\u11f0\u11f0\u11f9\u11f9\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15" >- + "\u1f18\u1f1d\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b\u1f5d\u1f5d" >- + "\u1f5f\u1f7d\u1f80\u1fb4\u1fb6\u1fbc\u1fbe\u1fbe\u1fc2\u1fc4\u1fc6\u1fcc\u1fd0\u1fd3" >- + "\u1fd6\u1fdb\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc\u2126\u2126\u212a\u212b\u212e\u212e" >- + "\u2180\u2182\u3007\u3007\u3021\u3029\u3041\u3094\u30a1\u30fa\u3105\u312c\u4e00\u9fa5" + "\uac00\ud7a3"; >- >- private static final String DIGITS = "\u0030\u0039\u0660\u0669\u06F0\u06F9\u0966\u096F\u09E6\u09EF\u0A66\u0A6F\u0AE6\u0AEF" >- + "\u0B66\u0B6F\u0BE7\u0BEF\u0C66\u0C6F\u0CE6\u0CEF\u0D66\u0D6F\u0E50\u0E59\u0ED0\u0ED9" + "\u0F20\u0F29"; >- } >- >-} >\ No newline at end of file >Index: src/org/eclipse/emf/ecore/xml/type/internal/DataValue.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/xml/type/internal/DataValue.java,v >retrieving revision 1.8 >diff -u -r1.8 DataValue.java >--- src/org/eclipse/emf/ecore/xml/type/internal/DataValue.java 12 Jun 2005 13:29:22 -0000 1.8 >+++ src/org/eclipse/emf/ecore/xml/type/internal/DataValue.java 16 Nov 2007 07:20:56 -0000 >@@ -74,10 +74,10 @@ > package org.eclipse.emf.ecore.xml.type.internal; > > >-import java.io.IOException; >+//import java.io.IOException; > import java.io.Serializable; > import java.util.Arrays; >-import java.util.Hashtable; >+import java.util.HashMap; > > /** > * NOTE: this class is for internal use only. >@@ -179,7 +179,7 @@ > public static String encode(byte[] binaryData) { > > // This implementation was changed to not introduce multi line content. >- >+ > if (binaryData == null) > return null; > >@@ -187,7 +187,7 @@ > if (lengthDataBits == 0) { > return ""; > } >- >+ > int fewerThan24bits = lengthDataBits%TWENTYFOURBITGROUP; > int numberTriplets = lengthDataBits/TWENTYFOURBITGROUP; > int numberQuartet = fewerThan24bits != 0 ? numberTriplets+1 : numberTriplets; >@@ -261,7 +261,7 @@ > } > > //encodedData[encodedIndex] = 0xa; >- >+ > return new String(encodedData); > } > >@@ -279,7 +279,7 @@ > char[] base64Data = encoded.toCharArray(); > // remove white spaces > int len = removeWhiteSpace(base64Data); >- >+ > if (len%FOURBYTE != 0) { > return null;//should be divisible by four > } >@@ -361,7 +361,7 @@ > > /** > * remove WhiteSpace from MIME containing encoded Base64 data. >- * >+ * > * @param data the byte array of base64 data (with WS) > * @return the new length > */ >@@ -468,7 +468,7 @@ > } > > /* >- * EncodingMap is a convenience class which handles conversions between >+ * EncodingMap is a convenience class which handles conversions between > * IANA encoding names and Java encoding names, and vice versa. The > * encoding names used in XML instance documents <strong>must</strong> > * be the IANA encoding names specified or one of the aliases for those names >@@ -910,7 +910,7 @@ > * </TD> > * </TR> > * </TABLE> >- * >+ * > * @author TAMURA Kent, IBM > * @author Andy Clark, IBM > */ >@@ -921,10 +921,10 @@ > // > > /** fIANA2JavaMap */ >- protected final static Hashtable fIANA2JavaMap = new Hashtable(); >+ protected final static HashMap fIANA2JavaMap = new HashMap(); > > /** fJava2IANAMap */ >- protected final static Hashtable fJava2IANAMap = new Hashtable(); >+ protected final static HashMap fJava2IANAMap = new HashMap(); > > // > // Static initialization >@@ -992,7 +992,7 @@ > fIANA2JavaMap.put("CP500", "CP500"); > fIANA2JavaMap.put("CSIBM500", "CP500"); > fIANA2JavaMap.put("EBCDIC-CP-CH", "CP500"); >- fIANA2JavaMap.put("EBCDIC-CP-BE", "CP500"); >+ fIANA2JavaMap.put("EBCDIC-CP-BE", "CP500"); > fIANA2JavaMap.put("IBM775", "CP775"); > fIANA2JavaMap.put("CP775", "CP775"); > fIANA2JavaMap.put("CSPC775BALTIC", "CP775"); >@@ -1142,7 +1142,7 @@ > fIANA2JavaMap.put("WINDOWS-1258", "Cp1258"); > fIANA2JavaMap.put("TIS-620", "TIS620"); > >- fIANA2JavaMap.put("ISO-8859-1", "ISO8859_1"); >+ fIANA2JavaMap.put("ISO-8859-1", "ISO8859_1"); > fIANA2JavaMap.put("ISO-IR-100", "ISO8859_1"); > fIANA2JavaMap.put("ISO_8859-1", "ISO8859_1"); > fIANA2JavaMap.put("LATIN1", "ISO8859_1"); >@@ -1151,34 +1151,34 @@ > fIANA2JavaMap.put("IBM819", "ISO8859_1"); > fIANA2JavaMap.put("CP819", "ISO8859_1"); > >- fIANA2JavaMap.put("ISO-8859-2", "ISO8859_2"); >+ fIANA2JavaMap.put("ISO-8859-2", "ISO8859_2"); > fIANA2JavaMap.put("ISO-IR-101", "ISO8859_2"); > fIANA2JavaMap.put("ISO_8859-2", "ISO8859_2"); > fIANA2JavaMap.put("LATIN2", "ISO8859_2"); > fIANA2JavaMap.put("CSISOLATIN2", "ISO8859_2"); > fIANA2JavaMap.put("L2", "ISO8859_2"); > >- fIANA2JavaMap.put("ISO-8859-3", "ISO8859_3"); >+ fIANA2JavaMap.put("ISO-8859-3", "ISO8859_3"); > fIANA2JavaMap.put("ISO-IR-109", "ISO8859_3"); > fIANA2JavaMap.put("ISO_8859-3", "ISO8859_3"); > fIANA2JavaMap.put("LATIN3", "ISO8859_3"); > fIANA2JavaMap.put("CSISOLATIN3", "ISO8859_3"); > fIANA2JavaMap.put("L3", "ISO8859_3"); > >- fIANA2JavaMap.put("ISO-8859-4", "ISO8859_4"); >+ fIANA2JavaMap.put("ISO-8859-4", "ISO8859_4"); > fIANA2JavaMap.put("ISO-IR-110", "ISO8859_4"); > fIANA2JavaMap.put("ISO_8859-4", "ISO8859_4"); > fIANA2JavaMap.put("LATIN4", "ISO8859_4"); > fIANA2JavaMap.put("CSISOLATIN4", "ISO8859_4"); > fIANA2JavaMap.put("L4", "ISO8859_4"); > >- fIANA2JavaMap.put("ISO-8859-5", "ISO8859_5"); >+ fIANA2JavaMap.put("ISO-8859-5", "ISO8859_5"); > fIANA2JavaMap.put("ISO-IR-144", "ISO8859_5"); > fIANA2JavaMap.put("ISO_8859-5", "ISO8859_5"); > fIANA2JavaMap.put("CYRILLIC", "ISO8859_5"); > fIANA2JavaMap.put("CSISOLATINCYRILLIC", "ISO8859_5"); > >- fIANA2JavaMap.put("ISO-8859-6", "ISO8859_6"); >+ fIANA2JavaMap.put("ISO-8859-6", "ISO8859_6"); > fIANA2JavaMap.put("ISO-IR-127", "ISO8859_6"); > fIANA2JavaMap.put("ISO_8859-6", "ISO8859_6"); > fIANA2JavaMap.put("ECMA-114", "ISO8859_6"); >@@ -1186,7 +1186,7 @@ > fIANA2JavaMap.put("ARABIC", "ISO8859_6"); > fIANA2JavaMap.put("CSISOLATINARABIC", "ISO8859_6"); > >- fIANA2JavaMap.put("ISO-8859-7", "ISO8859_7"); >+ fIANA2JavaMap.put("ISO-8859-7", "ISO8859_7"); > fIANA2JavaMap.put("ISO-IR-126", "ISO8859_7"); > fIANA2JavaMap.put("ISO_8859-7", "ISO8859_7"); > fIANA2JavaMap.put("ELOT_928", "ISO8859_7"); >@@ -1195,14 +1195,14 @@ > fIANA2JavaMap.put("CSISOLATINGREEK", "ISO8859_7"); > fIANA2JavaMap.put("GREEK8", "ISO8859_7"); > >- fIANA2JavaMap.put("ISO-8859-8", "ISO8859_8"); >- fIANA2JavaMap.put("ISO-8859-8-I", "ISO8859_8"); // added since this encoding only differs w.r.t. presentation >+ fIANA2JavaMap.put("ISO-8859-8", "ISO8859_8"); >+ fIANA2JavaMap.put("ISO-8859-8-I", "ISO8859_8"); // added since this encoding only differs w.r.t. presentation > fIANA2JavaMap.put("ISO-IR-138", "ISO8859_8"); > fIANA2JavaMap.put("ISO_8859-8", "ISO8859_8"); > fIANA2JavaMap.put("HEBREW", "ISO8859_8"); > fIANA2JavaMap.put("CSISOLATINHEBREW", "ISO8859_8"); > >- fIANA2JavaMap.put("ISO-8859-9", "ISO8859_9"); >+ fIANA2JavaMap.put("ISO-8859-9", "ISO8859_9"); > fIANA2JavaMap.put("ISO-IR-148", "ISO8859_9"); > fIANA2JavaMap.put("ISO_8859-9", "ISO8859_9"); > fIANA2JavaMap.put("LATIN5", "ISO8859_9"); >@@ -1211,7 +1211,7 @@ > > fIANA2JavaMap.put("KOI8-R", "KOI8_R"); > fIANA2JavaMap.put("CSKOI8R", "KOI8_R"); >- fIANA2JavaMap.put("US-ASCII", "ASCII"); >+ fIANA2JavaMap.put("US-ASCII", "ASCII"); > fIANA2JavaMap.put("ISO-IR-6", "ASCII"); > fIANA2JavaMap.put("ANSI_X3.4-1986", "ASCII"); > fIANA2JavaMap.put("ISO_646.IRV:1991", "ASCII"); >@@ -1226,8 +1226,8 @@ > fIANA2JavaMap.put("UTF-16BE", "UnicodeBig"); > fIANA2JavaMap.put("UTF-16LE", "UnicodeLittle"); > >- // support for 1047, as proposed to be added to the >- // IANA registry in >+ // support for 1047, as proposed to be added to the >+ // IANA registry in > // http://lists.w3.org/Archives/Public/ietf-charset/2002JulSep/0049.html > fIANA2JavaMap.put("IBM-1047", "Cp1047"); > fIANA2JavaMap.put("IBM1047", "Cp1047"); >@@ -1284,7 +1284,7 @@ > // REVISIT: > // j:CNS11643 -> EUC-TW? > // ISO-2022-CN? ISO-2022-CN-EXT? >- >+ > // add Java to IANA encoding mappings > //fJava2IANAMap.put("8859_1", "US-ASCII"); // ? > fJava2IANAMap.put("ISO8859_1", "ISO-8859-1"); >@@ -1376,18 +1376,18 @@ > > /** > * Adds an IANA to Java encoding name mapping. >- * >+ * > * @param ianaEncoding The IANA encoding name. > * @param javaEncoding The Java encoding name. > */ >- public static void putIANA2JavaMapping(String ianaEncoding, >+ public static void putIANA2JavaMapping(String ianaEncoding, > String javaEncoding) { > fIANA2JavaMap.put(ianaEncoding, javaEncoding); > } // putIANA2JavaMapping(String,String) > > /** > * Returns the Java encoding name for the specified IANA encoding name. >- * >+ * > * @param ianaEncoding The IANA encoding name. > */ > public static String getIANA2JavaMapping(String ianaEncoding) { >@@ -1396,7 +1396,7 @@ > > /** > * Removes an IANA to Java encoding name mapping. >- * >+ * > * @param ianaEncoding The IANA encoding name. > */ > public static String removeIANA2JavaMapping(String ianaEncoding) { >@@ -1405,18 +1405,18 @@ > > /** > * Adds a Java to IANA encoding name mapping. >- * >+ * > * @param javaEncoding The Java encoding name. > * @param ianaEncoding The IANA encoding name. > */ >- public static void putJava2IANAMapping(String javaEncoding, >+ public static void putJava2IANAMapping(String javaEncoding, > String ianaEncoding) { > fJava2IANAMap.put(javaEncoding, ianaEncoding); > } // putJava2IANAMapping(String,String) > > /** > * Returns the IANA encoding name for the specified Java encoding name. >- * >+ * > * @param javaEncoding The Java encoding name. > */ > public static String getJava2IANAMapping(String javaEncoding) { >@@ -1425,7 +1425,7 @@ > > /** > * Removes a Java to IANA encoding name mapping. >- * >+ * > * @param javaEncoding The Java encoding name. > */ > public static String removeJava2IANAMapping(String javaEncoding) { >@@ -1442,19 +1442,19 @@ > * string and fragment) that may constitute a URI. > * <p> > * Parsing of a URI specification is done according to the URI >-* syntax described in >+* syntax described in > * <a href="http://www.ietf.org/rfc/rfc2396.txt?number=2396">RFC 2396</a>, > * and amended by >-* <a href="http://www.ietf.org/rfc/rfc2732.txt?number=2732">RFC 2732</a>. >+* <a href="http://www.ietf.org/rfc/rfc2732.txt?number=2732">RFC 2732</a>. > * <p> >-* Every absolute URI consists of a scheme, followed by a colon (':'), >-* followed by a scheme-specific part. For URIs that follow the >-* "generic URI" syntax, the scheme-specific part begins with two >-* slashes ("//") and may be followed by an authority segment (comprised >-* of user information, host, and port), path segment, query segment >-* and fragment. Note that RFC 2396 no longer specifies the use of the >-* parameters segment and excludes the "user:password" syntax as part of >-* the authority segment. If "user:password" appears in a URI, the entire >+* Every absolute URI consists of a scheme, followed by a colon (':'), >+* followed by a scheme-specific part. For URIs that follow the >+* "generic URI" syntax, the scheme-specific part begins with two >+* slashes ("//") and may be followed by an authority segment (comprised >+* of user information, host, and port), path segment, query segment >+* and fragment. Note that RFC 2396 no longer specifies the use of the >+* parameters segment and excludes the "user:password" syntax as part of >+* the authority segment. If "user:password" appears in a URI, the entire > * user/password string is stored as userinfo. > * <p> > * For URIs that do not follow the "generic URI" syntax (e.g. mailto), >@@ -1471,7 +1471,7 @@ > * > **********************************************************************/ > public static final class URI implements Serializable { >- >+ > > /******************************************************************* > * MalformedURIExceptions are thrown in the process of building a URI >@@ -1479,7 +1479,7 @@ > * invalid URI specification. > * > ********************************************************************/ >- public static class MalformedURIException extends IOException { >+ public static class MalformedURIException extends IllegalArgumentException { > > /****************************************************************** > * Constructs a <code>MalformedURIException</code> with no specified >@@ -1501,55 +1501,55 @@ > } > > private static final byte [] fgLookupTable = new byte[128]; >- >+ > /** > * Character Classes > */ >- >+ > /** reserved characters ;/?:@&=+$,[] */ > //RFC 2732 added '[' and ']' as reserved characters > private static final int RESERVED_CHARACTERS = 0x01; >- >+ > /** URI punctuation mark characters: -_.!~*'() - these, combined with > alphanumerics, constitute the "unreserved" characters */ > private static final int MARK_CHARACTERS = 0x02; >- >+ > /** scheme can be composed of alphanumerics and these characters: +-. */ > private static final int SCHEME_CHARACTERS = 0x04; >- >+ > /** userinfo can be composed of unreserved, escaped and these > characters: ;:&=+$, */ > private static final int USERINFO_CHARACTERS = 0x08; >- >+ > /** ASCII letter characters */ > private static final int ASCII_ALPHA_CHARACTERS = 0x10; >- >+ > /** ASCII digit characters */ > private static final int ASCII_DIGIT_CHARACTERS = 0x20; >- >+ > /** ASCII hex characters */ > private static final int ASCII_HEX_CHARACTERS = 0x40; >- >+ > /** Path characters */ > private static final int PATH_CHARACTERS = 0x80; > > /** Mask for alpha-numeric characters */ > private static final int MASK_ALPHA_NUMERIC = ASCII_ALPHA_CHARACTERS | ASCII_DIGIT_CHARACTERS; >- >+ > /** Mask for unreserved characters */ > private static final int MASK_UNRESERVED_MASK = MASK_ALPHA_NUMERIC | MARK_CHARACTERS; >- >+ > /** Mask for URI allowable characters except for % */ > private static final int MASK_URI_CHARACTER = MASK_UNRESERVED_MASK | RESERVED_CHARACTERS; >- >+ > /** Mask for scheme characters */ > private static final int MASK_SCHEME_CHARACTER = MASK_ALPHA_NUMERIC | SCHEME_CHARACTERS; >- >+ > /** Mask for userinfo characters */ > private static final int MASK_USERINFO_CHARACTER = MASK_UNRESERVED_MASK | USERINFO_CHARACTERS; >- >+ > /** Mask for path characters */ >- private static final int MASK_PATH_CHARACTER = MASK_UNRESERVED_MASK | PATH_CHARACTERS; >+ private static final int MASK_PATH_CHARACTER = MASK_UNRESERVED_MASK | PATH_CHARACTERS; > > static { > // Add ASCII Digits and ASCII Hex Numbers >@@ -1607,7 +1607,7 @@ > fgLookupTable['+'] |= USERINFO_CHARACTERS; > fgLookupTable['$'] |= USERINFO_CHARACTERS; > fgLookupTable[','] |= USERINFO_CHARACTERS; >- >+ > // Add Path Characters > fgLookupTable[';'] |= PATH_CHARACTERS; > fgLookupTable['/'] |= PATH_CHARACTERS; >@@ -1639,7 +1639,7 @@ > > /** If specified, stores the port for this URI; otherwise -1 */ > private int m_port = -1; >- >+ > /** If specified, stores the registry based authority for this URI; otherwise -1 */ > private String m_regAuthority = null; > >@@ -1857,10 +1857,10 @@ > */ > private void initialize(URI p_base, String p_uriSpec) > throws MalformedURIException { >- >+ > String uriSpec = p_uriSpec; > int uriSpecLen = (uriSpec != null) ? uriSpec.length() : 0; >- >+ > if (p_base == null && uriSpecLen == 0) { > throw new MalformedURIException( > "Cannot initialize URI with empty parameters."); >@@ -1884,8 +1884,8 @@ > int slashIdx = uriSpec.lastIndexOf('/', searchFrom); > int queryIdx = uriSpec.lastIndexOf('?', searchFrom); > int fragmentIdx = uriSpec.lastIndexOf('#', searchFrom); >- >- if (colonIdx < 2 || slashIdx != -1 || >+ >+ if (colonIdx < 2 || slashIdx != -1 || > queryIdx != -1 || fragmentIdx != -1) { > // A standalone base is a valid URI according to spec > if (colonIdx == 0 || (p_base == null && fragmentIdx != 0)) { >@@ -1895,22 +1895,22 @@ > else { > initializeScheme(uriSpec); > index = m_scheme.length()+1; >- >+ > // Neither 'scheme:' or 'scheme:#fragment' are valid URIs. > if (colonIdx == uriSpecLen - 1 || uriSpec.charAt(colonIdx+1) == '#') { >- throw new MalformedURIException("Scheme specific part cannot be empty."); >+ throw new MalformedURIException("Scheme specific part cannot be empty."); > } > } > } > else if (p_base == null && uriSpec.indexOf('#') != 0) { >- throw new MalformedURIException("No scheme found in URI."); >+ throw new MalformedURIException("No scheme found in URI."); > } > > // Two slashes means we may have authority, but definitely means we're either > // matching net_path or abs_path. These two productions are ambiguous in that >- // every net_path (except those containing an IPv6Reference) is an abs_path. >- // RFC 2396 resolves this ambiguity by applying a greedy left most matching rule. >- // Try matching net_path first, and if that fails we don't have authority so >+ // every net_path (except those containing an IPv6Reference) is an abs_path. >+ // RFC 2396 resolves this ambiguity by applying a greedy left most matching rule. >+ // Try matching net_path first, and if that fails we don't have authority so > // then attempt to match abs_path. > // > // net_path = "//" authority [ abs_path ] >@@ -2105,12 +2105,12 @@ > * for this URI from a URI string spec. > * > * @param p_uriSpec the URI specification (cannot be null) >- * >+ * > * @return true if the given string matched server or registry > * based authority > */ > private boolean initializeAuthority(String p_uriSpec) { >- >+ > int index = 0; > int start = 0; > int end = p_uriSpec.length(); >@@ -2131,7 +2131,7 @@ > index++; > } > >- // host is everything up to last ':', or up to >+ // host is everything up to last ':', or up to > // and including ']' if followed by ':'. > String host = null; > start = index; >@@ -2186,7 +2186,7 @@ > } > } > } >- >+ > if (isValidServerBasedAuthority(host, port, userinfo)) { > m_host = host; > m_port = port; >@@ -2203,25 +2203,25 @@ > } > return false; > } >- >+ > /** > * Determines whether the components host, port, and user info > * are valid as a server authority. >- * >+ * > * @param host the host component of authority > * @param port the port number component of authority > * @param userinfo the user info component of authority >- * >+ * > * @return true if the given host, port, and userinfo compose > * a valid server authority > */ > private boolean isValidServerBasedAuthority(String host, int port, String userinfo) { >- >+ > // Check if the host is well formed. > if (!isWellFormedAddress(host)) { > return false; > } >- >+ > // Check that port is well formed if it exists. > // REVISIT: There's no restriction on port value ranges, but > // perform the same check as in setPort to be consistent. Pass >@@ -2229,7 +2229,7 @@ > if (port < -1 || port > 65535) { > return false; > } >- >+ > // Check that userinfo is well formed if it exists. > if (userinfo != null) { > // Userinfo can contain alphanumerics, mark characters, escaped >@@ -2255,22 +2255,22 @@ > } > return true; > } >- >+ > /** > * Determines whether the given string is a registry based authority. >- * >+ * > * @param authority the authority component of a URI >- * >+ * > * @return true if the given string is a registry based authority > */ > private boolean isValidRegistryBasedAuthority(String authority) { > int index = 0; > int end = authority.length(); > char testChar; >- >+ > while (index < end) { > testChar = authority.charAt(index); >- >+ > // check for valid escape sequence > if (testChar == '%') { > if (index+2 >= end || >@@ -2289,7 +2289,7 @@ > } > return true; > } >- >+ > /** > * Initialize the path for this URI from a URI string spec. > * >@@ -2314,13 +2314,13 @@ > if (start < end) { > // RFC 2732 only allows '[' and ']' to appear in the opaque part. > if (getScheme() == null || p_uriSpec.charAt(start) == '/') { >- >+ > // Scan path. > // abs_path = "/" path_segments > // rel_path = rel_segment [ abs_path ] > while (index < end) { > testChar = p_uriSpec.charAt(index); >- >+ > // check for valid escape sequence > if (testChar == '%') { > if (index+2 >= end || >@@ -2344,16 +2344,16 @@ > } > } > else { >- >+ > // Scan opaque part. > // opaque_part = uric_no_slash *uric > while (index < end) { > testChar = p_uriSpec.charAt(index); >- >+ > if (testChar == '?' || testChar == '#') { > break; > } >- >+ > // check for valid escape sequence > if (testChar == '%') { > if (index+2 >= end || >@@ -2366,7 +2366,7 @@ > } > // If the scheme specific part is opaque, it can contain '[' > // and ']'. uric_no_slash wasn't modified by RFC 2732, which >- // I've interpreted as an error in the spec, since the >+ // I've interpreted as an error in the spec, since the > // production should be equivalent to (uric - '/'), and uric > // contains '[' and ']'. - mrglavas > else if (!isURICharacter(testChar)) { >@@ -2452,7 +2452,7 @@ > > if (m_host != null || m_regAuthority != null) { > schemespec.append("//"); >- >+ > // Server based authority. > if (m_host != null) { > >@@ -2460,9 +2460,9 @@ > schemespec.append(m_userinfo); > schemespec.append('@'); > } >- >+ > schemespec.append(m_host); >- >+ > if (m_port != -1) { > schemespec.append(':'); > schemespec.append(m_port); >@@ -2517,10 +2517,10 @@ > public int getPort() { > return m_port; > } >- >+ > /** > * Get the registry based authority for this URI. >- * >+ * > * @return the registry based authority (null if not specified). > */ > public String getRegBasedAuthority() { >@@ -2658,7 +2658,7 @@ > /** > * <p>Set the host for this URI. If null is passed in, the userinfo > * field is also set to null and the port is set to -1.</p> >- * >+ * > * <p>Note: This method overwrites registry based authority if it > * previously existed in this URI.</p> > * >@@ -2707,31 +2707,31 @@ > } > m_port = p_port; > } >- >+ > /** > * <p>Sets the registry based authority for this URI.</p> >- * >+ * > * <p>Note: This method overwrites server based authority > * if it previously existed in this URI.</p> >- * >+ * > * @param authority the registry based authority for this URI >- * >+ * > * @exception MalformedURIException it authority is not a > * well formed registry based authority > */ >- public void setRegBasedAuthority(String authority) >+ public void setRegBasedAuthority(String authority) > throws MalformedURIException { > > if (authority == null) { > m_regAuthority = null; > return; > } >- // reg_name = 1*( unreserved | escaped | "$" | "," | >+ // reg_name = 1*( unreserved | escaped | "$" | "," | > // ";" | ":" | "@" | "&" | "=" | "+" ) > else if (authority.length() < 1 || > !isValidRegistryBasedAuthority(authority) || > authority.indexOf('/') != -1) { >- throw new MalformedURIException("Registry based authority is not well formed."); >+ throw new MalformedURIException("Registry based authority is not well formed."); > } > m_regAuthority = authority; > m_host = null; >@@ -2973,14 +2973,14 @@ > > /** > * Determine whether a string is syntactically capable of representing >- * a valid IPv4 address, IPv6 reference or the domain name of a network host. >+ * a valid IPv4 address, IPv6 reference or the domain name of a network host. > * A valid IPv4 address consists of four decimal digit groups separated by a > * '.'. Each group must consist of one to three digits. See RFC 2732 Section 3, >- * and RFC 2373 Section 2.2, for the definition of IPv6 references. A hostname >- * consists of domain labels (each of which must begin and end with an alphanumeric >+ * and RFC 2373 Section 2.2, for the definition of IPv6 references. A hostname >+ * consists of domain labels (each of which must begin and end with an alphanumeric > * but may contain '-') separated & by a '.'. See RFC 2396 Section 3.2.2. > * >- * @return true if the string is a syntactically valid IPv4 address, >+ * @return true if the string is a syntactically valid IPv4 address, > * IPv6 reference or hostname > */ > public static boolean isWellFormedAddress(String address) { >@@ -2992,15 +2992,15 @@ > if (addrLength == 0) { > return false; > } >- >+ > // Check if the host is a valid IPv6reference. > if (address.startsWith("[")) { > return isWellFormedIPv6Reference(address); > } > > // Cannot start with a '.', '-', or end with a '-'. >- if (address.startsWith(".") || >- address.startsWith("-") || >+ if (address.startsWith(".") || >+ address.startsWith("-") || > address.endsWith("-")) { > return false; > } >@@ -3020,14 +3020,14 @@ > // hostname = *( domainlabel "." ) toplabel [ "." ] > // domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum > // toplabel = alpha | alpha *( alphanum | "-" ) alphanum >- >- // RFC 2396 states that hostnames take the form described in >+ >+ // RFC 2396 states that hostnames take the form described in > // RFC 1034 (Section 3) and RFC 1123 (Section 2.1). According > // to RFC 1034, hostnames are limited to 255 characters. > if (addrLength > 255) { > return false; > } >- >+ > // domain labels can contain alphanumerics and '-" > // but must start and end with an alphanumeric > char testChar; >@@ -3055,12 +3055,12 @@ > } > return true; > } >- >+ > /** >- * <p>Determines whether a string is an IPv4 address as defined by >+ * <p>Determines whether a string is an IPv4 address as defined by > * RFC 2373, and under the further constraint that it must be a 32-bit >- * address. Though not expressed in the grammar, in order to satisfy >- * the 32-bit address constraint, each segment of the address cannot >+ * address. Though not expressed in the grammar, in order to satisfy >+ * the 32-bit address constraint, each segment of the address cannot > * be greater than 255 (8 bits of information).</p> > * > * <p><code>IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT</code></p> >@@ -3068,7 +3068,7 @@ > * @return true if the string is a syntactically valid IPv4 address > */ > public static boolean isWellFormedIPv4Address(String address) { >- >+ > int addrLength = address.length(); > char testChar; > int numDots = 0; >@@ -3078,7 +3078,7 @@ > // any dot separator is preceded and followed by a digit and > // 3) that we find 3 dots > // >- // RFC 2732 amended RFC 2396 by replacing the definition >+ // RFC 2732 amended RFC 2396 by replacing the definition > // of IPv4address with the one defined by RFC 2373. - mrglavas > // > // IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT >@@ -3087,7 +3087,7 @@ > for (int i = 0; i < addrLength; i++) { > testChar = address.charAt(i); > if (testChar == '.') { >- if ((i > 0 && !isDigit(address.charAt(i-1))) || >+ if ((i > 0 && !isDigit(address.charAt(i-1))) || > (i+1 < addrLength && !isDigit(address.charAt(i+1)))) { > return false; > } >@@ -3108,9 +3108,9 @@ > else if (numDigits == 3) { > char first = address.charAt(i-2); > char second = address.charAt(i-1); >- if (!(first < '2' || >- (first == '2' && >- (second < '5' || >+ if (!(first < '2' || >+ (first == '2' && >+ (second < '5' || > (second == '5' && testChar <= '5'))))) { > return false; > } >@@ -3118,17 +3118,17 @@ > } > return (numDots == 3); > } >- >+ > /** > * <p>Determines whether a string is an IPv6 reference as defined >- * by RFC 2732, where IPv6address is defined in RFC 2373. The >+ * by RFC 2732, where IPv6address is defined in RFC 2373. The > * IPv6 address is parsed according to Section 2.2 of RFC 2373, > * with the additional constraint that the address be composed of > * 128 bits of information.</p> > * > * <p><code>IPv6reference = "[" IPv6address "]"</code></p> > * >- * <p>Note: The BNF expressed in RFC 2373 Appendix B does not >+ * <p>Note: The BNF expressed in RFC 2373 Appendix B does not > * accurately describe section 2.2, and was in fact removed from > * RFC 3513, the successor of RFC 2373.</p> > * >@@ -3139,16 +3139,16 @@ > int addrLength = address.length(); > int index = 1; > int end = addrLength-1; >- >+ > // Check if string is a potential match for IPv6reference. >- if (!(addrLength > 2 && address.charAt(0) == '[' >+ if (!(addrLength > 2 && address.charAt(0) == '[' > && address.charAt(end) == ']')) { > return false; > } >- >+ > // Counter for the number of 16-bit sections read in the address. > int [] counter = new int[1]; >- >+ > // Scan hex sequence before possible '::' or IPv4 address. > index = scanHexSequence(address, index, end, counter); > if (index == -1) { >@@ -3158,7 +3158,7 @@ > else if (index == end) { > return (counter[0] == 8); > } >- >+ > if (index+1 < end && address.charAt(index) == ':') { > if (address.charAt(index+1) == ':') { > // '::' represents at least one 16-bit group of zeros. >@@ -3172,34 +3172,34 @@ > } > } > // If the second character wasn't ':', in order to be valid, >- // the remainder of the string must match IPv4Address, >+ // the remainder of the string must match IPv4Address, > // and we must have read exactly 6 16-bit groups. > else { >- return (counter[0] == 6) && >+ return (counter[0] == 6) && > isWellFormedIPv4Address(address.substring(index+1, end)); > } > } > else { > return false; > } >- >+ > // 3. Scan hex sequence after '::'. > int prevCount = counter[0]; > index = scanHexSequence(address, index, end, counter); > > // We've either reached the end of the string, the address ends in >- // an IPv4 address, or it is invalid. scanHexSequence has already >- // made sure that we have the right number of bits. >- return (index == end) || >+ // an IPv4 address, or it is invalid. scanHexSequence has already >+ // made sure that we have the right number of bits. >+ return (index == end) || > (index != -1 && isWellFormedIPv4Address( > address.substring((counter[0] > prevCount) ? index+1 : index, end))); > } >- >+ > /** >- * Helper method for isWellFormedIPv6Reference which scans the >- * hex sequences of an IPv6 address. It returns the index of the >- * next character to scan in the address, or -1 if the string >- * cannot match a valid IPv6 address. >+ * Helper method for isWellFormedIPv6Reference which scans the >+ * hex sequences of an IPv6 address. It returns the index of the >+ * next character to scan in the address, or -1 if the string >+ * cannot match a valid IPv6 address. > * > * @param address the string to be scanned > * @param index the beginning index (inclusive) >@@ -3211,11 +3211,11 @@ > * string cannot match a valid IPv6 address > */ > private static int scanHexSequence (String address, int index, int end, int [] counter) { >- >+ > char testChar; > int numDigits = 0; > int start = index; >- >+ > // Trying to match the following productions: > // hexseq = hex4 *( ":" hex4) > // hex4 = 1*4HEXDIG >@@ -3247,7 +3247,7 @@ > } > } > return (numDigits > 0 && ++counter[0] <= 8) ? end : -1; >- } >+ } > > > /** >@@ -3288,7 +3288,7 @@ > } > > /** >- * Determine whether a char is a URI character (reserved or >+ * Determine whether a char is a URI character (reserved or > * unreserved, not including '%' for escaped octets). > * > * @return true if the char is a URI character, false otherwise >@@ -3314,10 +3314,10 @@ > private static boolean isUserinfoCharacter (char p_char) { > return (p_char <= 'z' && (fgLookupTable[p_char] & MASK_USERINFO_CHARACTER) != 0); > } >- >+ > /** > * Determine whether a char is a path character. >- * >+ * > * @return true if the char is a path character, false otherwise > */ > private static boolean isPathCharacter (char p_char) { >@@ -3363,7 +3363,7 @@ > // > // XML Schema anyURI specific information > // >- >+ > // which ASCII characters need to be escaped > private static boolean gNeedEscaping[] = new boolean[128]; > // the first hex character if a character needs to be escaped >@@ -3423,12 +3423,13 @@ > // get UTF-8 bytes for the remaining sub-string > byte[] bytes = null; > byte b; >- try { >- bytes = anyURI.substring(i).getBytes("UTF-8"); >- } catch (java.io.UnsupportedEncodingException e) { >- // should never happen >- return anyURI; >- } >+// try { >+// bytes = anyURI.substring(i).getBytes(); >+// bytes = anyURI.substring(i).getBytes("UTF-8"); >+// } catch (java.io.UnsupportedEncodingException e) { >+// // should never happen >+// return anyURI; >+// } > len = bytes.length; > > // for each byte >@@ -3509,10 +3510,10 @@ > > /** Pubid character mask. */ > public static final int MASK_PUBID = 0x10; >- >- /** >+ >+ /** > * Content character mask. Special characters are those that can >- * be considered the start of markup, such as '<' and '&'. >+ * be considered the start of markup, such as '<' and '&'. > * The various newline characters are considered special as well. > * All other valid XML characters can be considered content. > * <p> >@@ -3531,10 +3532,10 @@ > // > > static { >- >+ > // Initializing the Character Flag Array > // Code generated by: XMLCharGenerator. >- >+ > CHARS[9] = 35; > CHARS[10] = 19; > CHARS[13] = 19; >@@ -4351,7 +4352,7 @@ > } > return true; > } // isValidName(String):boolean >- >+ > > /* > * from the namespace rec >@@ -4387,7 +4388,7 @@ > * in the XML 1.0 Recommendation > * > * @param nmtoken string to check >- * @return true if nmtoken is a valid Nmtoken >+ * @return true if nmtoken is a valid Nmtoken > */ > public static boolean isValidNmtoken(String nmtoken) { > if (nmtoken.length() == 0) >@@ -4478,13 +4479,13 @@ > public static final boolean isDigit(char ch) { > return ch >= '0' && ch <= '9'; > } >- >+ > // if the character is in the range 0x30 ~ 0x39, return its int value (0~9), > // otherwise, return -1 > public static final int getDigit(char ch) { > return isDigit(ch) ? ch - '0' : -1; > } >- >+ > } // interface TypeValidator > > } >Index: src/org/eclipse/emf/ecore/xml/type/internal/XMLDuration.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/type/internal/XMLDuration.java >diff -N src/org/eclipse/emf/ecore/xml/type/internal/XMLDuration.java >--- src/org/eclipse/emf/ecore/xml/type/internal/XMLDuration.java 6 Sep 2007 18:24:36 -0000 1.4.4.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,400 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2007 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLDuration.java,v 1.4.4.1 2007/09/06 18:24:36 emerks Exp $ >- * >- * --------------------------------------------------------------------- >- * >- * The Apache Software License, Version 1.1 >- * >- * >- * Copyright (c) 1999-2004 The Apache Software Foundation. All rights >- * reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in >- * the documentation and/or other materials provided with the >- * distribution. >- * >- * 3. The end-user documentation included with the redistribution, >- * if any, must include the following acknowledgment: >- * "This product includes software developed by the >- * Apache Software Foundation (http://www.apache.org/)." >- * Alternately, this acknowledgment may appear in the software itself, >- * if and wherever such third-party acknowledgments normally appear. >- * >- * 4. The names "Xerces" and "Apache Software Foundation" must >- * not be used to endorse or promote products derived from this >- * software without prior written permission. For written >- * permission, please contact apache@apache.org. >- * >- * 5. Products derived from this software may not be called "Apache", >- * nor may "Apache" appear in their name, without prior written >- * permission of the Apache Software Foundation. >- * >- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED >- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES >- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR >- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF >- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, >- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT >- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >- * SUCH DAMAGE. >- * ==================================================================== >- * >- * This software consists of voluntary contributions made by many >- * individuals on behalf of the Apache Software Foundation and was >- * originally based on software copyright (c) 1999-2003, International >- * Business Machines, Inc., http://www.apache.org. For more >- * information on the Apache Software Foundation, please see >- * <http://www.apache.org/>. >- */ >-package org.eclipse.emf.ecore.xml.type.internal; >- >-import org.eclipse.emf.ecore.xml.type.InvalidDatatypeValueException; >-import org.eclipse.emf.ecore.xml.type.internal.DataValue.TypeValidator; >- >- >-/** >- * Representation for the <a href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/">W3C XML Schema 1.0</a> >- * duration datatype. >- * >- * NOTE: this class is for internal use only. >- * Later this class will be replaced by JAXP 1.3 javax.xml.datatype.Duration class. >- * This class is based on Apache Xerces2 2.6.2 parser implementation of date/time validation. >- */ >-public final class XMLDuration { >- >- private final String ERROR_MESSAGE="The 'duration' value is invalid: "; >- // order-relation on duration is a partial order. The dates below are used to >- // for comparison of 2 durations, based on the fact that >- // duration x and y is x<=y iff s+x<=s+y >- // see 3.2.6 duration W3C schema datatype specs >- // >- // the dates are in format: {CCYY,MM,DD, H, S, M, MS, timezone} >- private final static int[][] DATETIMES= { >- {1696, 9, 1, 0, 0, 0, 0, 'Z'}, >- {1697, 2, 1, 0, 0, 0, 0, 'Z'}, >- {1903, 3, 1, 0, 0, 0, 0, 'Z'}, >- {1903, 7, 1, 0, 0, 0, 0, 'Z'}}; >- >- private int hashCode = 0; >- >- final int[] dateValue; >- >- final String valueString; >- >- public XMLDuration(String value) >- { >- this.dateValue = parse(value); >- valueString = value; >- } >- >- public boolean equals(Object obj) >- { >- if (!(obj instanceof XMLDuration)) >- return false; >- int[] odata = ((XMLDuration)obj).dateValue; >- return compareDates(dateValue, odata, true) == 0; >- } >- >- public int hashCode() >- { >- if (hashCode == 0) >- { >- int[] temp = addDuration(dateValue, DATETIMES[0], new int[XMLCalendar.TOTAL_SIZE]); >- for (int i=0;i<XMLCalendar.TOTAL_SIZE;i++) >- { >- hashCode^=temp[i]; >- } >- } >- return hashCode; >- } >- >- // the parameters are in compiled form (from getActualValue) >- public static int compare(XMLDuration value1, XMLDuration value2) >- { >- return compareDates(value1.dateValue, value2.dateValue, true); >- }//compare() >- >- >- /** >- * Parses, validates and computes normalized version of duration object >- * >- * @param str The lexical representation of duration object PnYn MnDTnH nMnS >- * @return normalized date representation >- * @exception InvalidDatatypeValueException Invalid lexical representation >- */ >- private int[] parse(String str) throws InvalidDatatypeValueException{ >- int len = str.length(); >- int[] date=new int[XMLCalendar.TOTAL_SIZE]; >- >- int start = 0; >- char c=str.charAt(start++); >- if ( c!='P' && c!='-' ) { >- throw new InvalidDatatypeValueException(ERROR_MESSAGE+str); >- } >- else { >- date[XMLCalendar.utc]=(c=='-')?'-':0; >- if ( c=='-' && str.charAt(start++)!='P' ) { >- throw new InvalidDatatypeValueException(ERROR_MESSAGE+str); >- } >- } >- >- int negate = 1; >- //negative duration >- if ( date[XMLCalendar.utc]=='-' ) { >- negate = -1; >- >- } >- //at least one number and designator must be seen after P >- boolean designator = false; >- >- int endDate = XMLCalendar.indexOf (str, start, len, 'T'); >- if ( endDate == -1 ) { >- endDate = len; >- } >- //find 'Y' >- int end = XMLCalendar.indexOf (str, start, endDate, 'Y'); >- if ( end!=-1 ) { >- //scan year >- date[XMLCalendar.CY]=negate * XMLCalendar.parseInt(str,start,end); >- start = end+1; >- designator = true; >- } >- >- end = XMLCalendar.indexOf (str, start, endDate, 'M'); >- if ( end!=-1 ) { >- //scan month >- date[XMLCalendar.M]=negate * XMLCalendar.parseInt(str,start,end); >- start = end+1; >- designator = true; >- } >- >- end = XMLCalendar.indexOf (str, start, endDate, 'D'); >- if ( end!=-1 ) { >- //scan day >- date[XMLCalendar.D]=negate * XMLCalendar.parseInt(str,start,end); >- start = end+1; >- designator = true; >- } >- >- if ( len == endDate && start!=len ) { >- throw new InvalidDatatypeValueException(ERROR_MESSAGE+str); >- } >- if ( len !=endDate ) { >- >- end = XMLCalendar.indexOf (str, ++start, len, 'H'); >- if ( end!=-1 ) { >- //scan hours >- date[XMLCalendar.h]=negate * XMLCalendar.parseInt(str,start,end); >- start=end+1; >- designator = true; >- } >- >- end = XMLCalendar.indexOf (str, start, len, 'M'); >- if ( end!=-1 ) { >- //scan min >- date[XMLCalendar.m]=negate * XMLCalendar.parseInt(str,start,end); >- start=end+1; >- designator = true; >- } >- >- end = XMLCalendar.indexOf (str, start, len, 'S'); >- if ( end!=-1 ) { >- //scan seconds >- int mlsec = XMLCalendar.indexOf (str, start, end, '.'); >- if ( mlsec >0 ) { >- date[XMLCalendar.s] = negate * XMLCalendar.parseInt (str, start, mlsec); >- date[XMLCalendar.ms] = negate * XMLCalendar.parseInt (str, mlsec+1, end); >- } >- else { >- date[XMLCalendar.s]=negate * XMLCalendar.parseInt(str, start,end); >- } >- start=end+1; >- designator = true; >- } >- // no additional data shouls appear after last item >- // P1Y1M1DT is illigal value as well >- if ( start != len || str.charAt(--start)=='T' ) { >- throw new InvalidDatatypeValueException(ERROR_MESSAGE+str); >- } >- } >- >- if ( !designator ) { >- throw new InvalidDatatypeValueException(ERROR_MESSAGE+str); >- } >- >- return date; >- } >- >- /** >- * Compares 2 given durations. (refer to W3C Schema Datatypes "3.2.6 duration") >- * >- * @param date1 Unnormalized duration >- * @param date2 Unnormalized duration >- * @param strict (min/max)Exclusive strict == true ( LESS_THAN ) or ( GREATER_THAN ) >- * (min/max)Inclusive strict == false (LESS_EQUAL) or (GREATER_EQUAL) >- * @return INDETERMINATE if the order relationship between date1 and date2 is indeterminate. >- * EQUAL if the order relation between date1 and date2 is EQUAL. >- * If the strict parameter is true, return LESS_THAN if date1 is less than date2 and >- * return GREATER_THAN if date1 is greater than date2. >- * If the strict parameter is false, return LESS_THAN if date1 is less than OR equal to date2 and >- * return GREATER_THAN if date1 is greater than OR equal to date2 >- */ >- protected static short compareDates(int[] date1, int[] date2, boolean strict) { >- >- //REVISIT: this is unoptimazed vs of comparing 2 durations >- // Algorithm is described in 3.2.6.2 W3C Schema Datatype specs >- // >- >- //add constA to both durations >- short resultA, resultB= TypeValidator.INDETERMINATE; >- >- //try and see if the objects are equal >- resultA = XMLCalendar.compareOrder (date1, date2); >- if ( resultA == 0 ) { >- return 0; >- } >- >- int[][] result = new int[2][XMLCalendar.TOTAL_SIZE]; >- >- //long comparison algorithm is required >- int[] tempA = addDuration (date1, DATETIMES[0], result[0]); >- int[] tempB = addDuration (date2, DATETIMES[0], result[1]); >- resultA = XMLCalendar.compareOrder(tempA, tempB); >- if ( resultA == TypeValidator.INDETERMINATE ) { >- return TypeValidator.INDETERMINATE; >- } >- >- tempA = addDuration(date1, DATETIMES[1], result[0]); >- tempB = addDuration(date2, DATETIMES[1], result[1]); >- resultB = XMLCalendar.compareOrder(tempA, tempB); >- resultA = compareResults(resultA, resultB, strict); >- if (resultA == TypeValidator.INDETERMINATE) { >- return TypeValidator.INDETERMINATE; >- } >- >- tempA = addDuration(date1, DATETIMES[2], result[0]); >- tempB = addDuration(date2, DATETIMES[2], result[1]); >- resultB = XMLCalendar.compareOrder(tempA, tempB); >- resultA = compareResults(resultA, resultB, strict); >- if (resultA == TypeValidator.INDETERMINATE) { >- return TypeValidator.INDETERMINATE; >- } >- >- tempA = addDuration(date1, DATETIMES[3], result[0]); >- tempB = addDuration(date2, DATETIMES[3], result[1]); >- resultB = XMLCalendar.compareOrder(tempA, tempB); >- resultA = compareResults(resultA, resultB, strict); >- >- return resultA; >- } >- >- private static short compareResults(short resultA, short resultB, boolean strict){ >- >- if ( resultB == TypeValidator.INDETERMINATE ) { >- return TypeValidator.INDETERMINATE; >- } >- else if ( resultA!=resultB && strict ) { >- return TypeValidator.INDETERMINATE; >- } >- else if ( resultA!=resultB && !strict ) { >- if ( resultA!=0 && resultB!=0 ) { >- return TypeValidator.INDETERMINATE; >- } >- else { >- return (resultA!=0)?resultA:resultB; >- } >- } >- return resultA; >- } >- >- private static int[] addDuration(int[] date, int[] addto, int[] duration) { >- >- //REVISIT: some code could be shared between normalize() and this method, >- // however is it worth moving it? The structures are different... >- // >- >- XMLCalendar.resetDateObj(duration); >- //add months (may be modified additionaly below) >- int temp = addto[XMLCalendar.M] + date[XMLCalendar.M]; >- duration[XMLCalendar.M] = XMLCalendar.modulo (temp, 1, 13); >- int carry = XMLCalendar.fQuotient (temp, 1, 13); >- >- //add years (may be modified additionaly below) >- duration[XMLCalendar.CY]=addto[XMLCalendar.CY] + date[XMLCalendar.CY] + carry; >- >- //add milliseconds >- temp = addto[XMLCalendar.ms] + date[XMLCalendar.ms]; >- carry = XMLCalendar.fQuotient(temp, 1000); >- duration[XMLCalendar.ms] = XMLCalendar.mod(temp, 1000, carry); >- >- >- //add seconds >- temp = addto[XMLCalendar.s] + date[XMLCalendar.s]; >- carry = XMLCalendar.fQuotient (temp, 60); >- duration[XMLCalendar.s] = XMLCalendar.mod(temp, 60, carry); >- >- //add minutes >- temp = addto[XMLCalendar.m] +date[XMLCalendar.m] + carry; >- carry = XMLCalendar.fQuotient (temp, 60); >- duration[XMLCalendar.m]= XMLCalendar.mod(temp, 60, carry); >- >- //add hours >- temp = addto[XMLCalendar.h] + date[XMLCalendar.h] + carry; >- carry = XMLCalendar.fQuotient(temp, 24); >- duration[XMLCalendar.h] = XMLCalendar.mod(temp, 24, carry); >- >- >- duration[XMLCalendar.D]=addto[XMLCalendar.D] + date[XMLCalendar.D] + carry; >- >- while ( true ) { >- >- temp=XMLCalendar.maxDayInMonthFor(duration[XMLCalendar.CY], duration[XMLCalendar.M]); >- if ( duration[XMLCalendar.D] < 1 ) { //original duration was negative >- duration[XMLCalendar.D] = duration[XMLCalendar.D] + XMLCalendar.maxDayInMonthFor(duration[XMLCalendar.CY], duration[XMLCalendar.M]-1); >- carry=-1; >- } >- else if ( duration[XMLCalendar.D] > temp ) { >- duration[XMLCalendar.D] = duration[XMLCalendar.D] - temp; >- carry=1; >- } >- else { >- break; >- } >- temp = duration[XMLCalendar.M]+carry; >- duration[XMLCalendar.M] = XMLCalendar.modulo(temp, 1, 13); >- duration[XMLCalendar.CY] = duration[XMLCalendar.CY]+XMLCalendar.fQuotient(temp, 1, 13); >- } >- >- duration[XMLCalendar.utc]='Z'; >- return duration; >- } >- >- public String toString() { >- return valueString; >- } >-} >Index: src/org/eclipse/emf/ecore/impl/EcorePackageImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EcorePackageImpl.java,v >retrieving revision 1.14 >diff -u -r1.14 EcorePackageImpl.java >--- src/org/eclipse/emf/ecore/impl/EcorePackageImpl.java 13 Dec 2005 23:14:06 -0000 1.14 >+++ src/org/eclipse/emf/ecore/impl/EcorePackageImpl.java 16 Nov 2007 07:20:52 -0000 >@@ -16,9 +16,9 @@ > */ > package org.eclipse.emf.ecore.impl; > >- >-import java.math.BigDecimal; >-import java.math.BigInteger; >+//XXX GWT CHANGE >+//import java.math.BigDecimal; >+//import java.math.BigInteger; > import java.util.Date; > import java.util.Map; > >@@ -211,19 +211,20 @@ > */ > private EClass eStringToStringMapEntryEClass = null; > >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType eBigDecimalEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType eBigIntegerEDataType = null; >+//XXX GWT CHANGE No Big-Value >+// /** >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @generated >+// */ >+// private EDataType eBigDecimalEDataType = null; >+// >+// /** >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @generated >+// */ >+// private EDataType eBigIntegerEDataType = null; > > /** > * <!-- begin-user-doc --> >@@ -1275,25 +1276,26 @@ > return (EAttribute)eStringToStringMapEntryEClass.getEStructuralFeatures().get(1); > } > >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getEBigDecimal() >- { >- return eBigDecimalEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getEBigInteger() >- { >- return eBigIntegerEDataType; >- } >+//XXX GWT CHANGE >+// /** >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @generated >+// */ >+// public EDataType getEBigDecimal() >+// { >+// return eBigDecimalEDataType; >+// } >+// >+// /** >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @generated >+// */ >+// public EDataType getEBigInteger() >+// { >+// return eBigIntegerEDataType; >+// } > > /** > * <!-- begin-user-doc --> >@@ -1798,8 +1800,9 @@ > createEAttribute(eStringToStringMapEntryEClass, ESTRING_TO_STRING_MAP_ENTRY__VALUE); > > // Create data types >- eBigDecimalEDataType = createEDataType(EBIG_DECIMAL); >- eBigIntegerEDataType = createEDataType(EBIG_INTEGER); >+//XXX GWT CHANGE No Big-Values >+// eBigDecimalEDataType = createEDataType(EBIG_DECIMAL); >+// eBigIntegerEDataType = createEDataType(EBIG_INTEGER); > eBooleanEDataType = createEDataType(EBOOLEAN); > eBooleanObjectEDataType = createEDataType(EBOOLEAN_OBJECT); > eByteEDataType = createEDataType(EBYTE); >@@ -2062,8 +2065,9 @@ > initEAttribute(getEStringToStringMapEntry_Value(), ecorePackage.getEString(), "value", null, 0, 1, Map.Entry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); > > // Initialize data types >- initEDataType(eBigDecimalEDataType, BigDecimal.class, "EBigDecimal", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(eBigIntegerEDataType, BigInteger.class, "EBigInteger", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >+//XXX GWT CHANGE No Big-Value >+// initEDataType(eBigDecimalEDataType, BigDecimal.class, "EBigDecimal", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >+// initEDataType(eBigIntegerEDataType, BigInteger.class, "EBigInteger", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); > initEDataType(eBooleanEDataType, boolean.class, "EBoolean", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); > initEDataType(eBooleanObjectEDataType, Boolean.class, "EBooleanObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); > initEDataType(eByteEDataType, byte.class, "EByte", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >@@ -2108,20 +2112,21 @@ > protected void createExtendedMetaDataAnnotations() > { > String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; >- addAnnotation >- (eBigDecimalEDataType, >- source, >- new String[] >- { >- "baseType", "http://www.w3.org/2001/XMLSchema#decimal" >- }); >- addAnnotation >- (eBigIntegerEDataType, >- source, >- new String[] >- { >- "baseType", "http://www.w3.org/2001/XMLSchema#integer" >- }); >+//XXX GWT CHANGE No Big-Values >+// addAnnotation >+// (eBigDecimalEDataType, >+// source, >+// new String[] >+// { >+// "baseType", "http://www.w3.org/2001/XMLSchema#decimal" >+// }); >+// addAnnotation >+// (eBigIntegerEDataType, >+// source, >+// new String[] >+// { >+// "baseType", "http://www.w3.org/2001/XMLSchema#integer" >+// }); > addAnnotation > (eBooleanEDataType, > source, >Index: src/org/eclipse/emf/ecore/impl/EStructuralFeatureImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EStructuralFeatureImpl.java,v >retrieving revision 1.22.2.2 >diff -u -r1.22.2.2 EStructuralFeatureImpl.java >--- src/org/eclipse/emf/ecore/impl/EStructuralFeatureImpl.java 27 Apr 2007 16:43:25 -0000 1.22.2.2 >+++ src/org/eclipse/emf/ecore/impl/EStructuralFeatureImpl.java 16 Nov 2007 07:20:52 -0000 >@@ -2041,10 +2041,11 @@ > > protected void validate(Object object) > { >- if (!dataClass.isInstance(object)) >- { >- throw new ClassCastException("The value of type '" + object.getClass() + "' must be of type '" + dataClass + "'"); >- } >+//FIXME GWT CHANGE No isInstance check >+// if (!dataClass.isInstance(object)) >+// { >+// throw new ClassCastException("The value of type '" + Util.getClassNameAsString(object) + "' must be of type '" + dataClass + "'"); >+// } > } > } > >@@ -2190,10 +2191,11 @@ > > protected void validate(Object object) > { >- if (!dataClass.isInstance(object)) >- { >- throw new ClassCastException("The value of type '" + object.getClass() + "' must be of type '" + dataClass + "'"); >- } >+//FIXME GWT CHANGE No Reflection >+// if (!dataClass.isInstance(object)) >+// { >+// throw new ClassCastException("The value of type '" + Util.getClassNameAsString(object) + "' must be of type '" + dataClass + "'"); >+// } > } > } > >Index: src/org/eclipse/emf/ecore/impl/EPackageImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EPackageImpl.java,v >retrieving revision 1.30 >diff -u -r1.30 EPackageImpl.java >--- src/org/eclipse/emf/ecore/impl/EPackageImpl.java 21 Aug 2006 15:34:04 -0000 1.30 >+++ src/org/eclipse/emf/ecore/impl/EPackageImpl.java 16 Nov 2007 07:20:51 -0000 >@@ -16,8 +16,8 @@ > */ > package org.eclipse.emf.ecore.impl; > >- >-import java.lang.reflect.Method; >+//XXX GWT CHANGE No reflection >+//import java.lang.reflect.Method; > import java.util.Collection; > import java.util.HashMap; > import java.util.Iterator; >@@ -678,20 +678,23 @@ > Resource resource = eResource(); > if (resource == null) > { >- if (resourceFactory == null) >- { >- try >- { >- resourceFactory = (Resource.Factory)CommonPlugin.loadClass("org.eclipse.emf.ecore.xmi", "org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl").newInstance(); >- } >- catch (Throwable exception) >- { >- resourceFactory = new ResourceFactoryImpl(); >- } >- } >- URI actualURI = URI.createURI(uri); >- resource = resourceFactory.createResource(actualURI); >- resource.getContents().add(this); >+ System.err.println("EPackageImpl#createResource(String) is not implemented in GWT"); >+ throw new UnsupportedOperationException(); >+//FIXME GWT CHANGE No Reflection >+// if (resourceFactory == null) >+// { >+// try >+// { >+// resourceFactory = (Resource.Factory)CommonPlugin.loadClass("org.eclipse.emf.ecore.xmi", "org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl").newInstance(); >+// } >+// catch (Throwable exception) >+// { >+// resourceFactory = new ResourceFactoryImpl(); >+// } >+// } >+// URI actualURI = URI.createURI(uri); >+// resource = resourceFactory.createResource(actualURI); >+// resource.getContents().add(this); > } > return resource; > } >@@ -1424,23 +1427,25 @@ > > protected void fixEEnumLiterals(EEnum eEnum) > { >- Class enumClass = eEnum.getInstanceClass(); >- >- try >- { >- Method getter = enumClass.getMethod("get", new Class[] { Integer.TYPE }); >- >- for (Iterator i = eEnum.getELiterals().iterator(); i.hasNext(); ) >- { >- EEnumLiteral eEnumLiteral = (EEnumLiteral)i.next(); >- Enumerator instance = (Enumerator)getter.invoke(null, new Object[] { new Integer(eEnumLiteral.getValue()) }); >- eEnumLiteral.setInstance(instance); >- } >- } >- catch (Exception e) >- { >- // Do nothing >- } >+ throw new UnsupportedOperationException(); >+//XXX GWT CHANGE No Reflection >+// Class enumClass = eEnum.getInstanceClass(); >+// >+// try >+// { >+// Method getter = enumClass.getMethod("get", new Class[] { Integer.TYPE }); >+// >+// for (Iterator i = eEnum.getELiterals().iterator(); i.hasNext(); ) >+// { >+// EEnumLiteral eEnumLiteral = (EEnumLiteral)i.next(); >+// Enumerator instance = (Enumerator)getter.invoke(null, new Object[] { new Integer(eEnumLiteral.getValue()) }); >+// eEnumLiteral.setInstance(instance); >+// } >+// } >+// catch (Exception e) >+// { >+// // Do nothing >+// } > } > > protected BasicExtendedMetaData.EPackageExtendedMetaData ePackageExtendedMetaData; >Index: src/org/eclipse/emf/ecore/impl/EcoreFactoryImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EcoreFactoryImpl.java,v >retrieving revision 1.12 >diff -u -r1.12 EcoreFactoryImpl.java >--- src/org/eclipse/emf/ecore/impl/EcoreFactoryImpl.java 13 Dec 2005 23:14:49 -0000 1.12 >+++ src/org/eclipse/emf/ecore/impl/EcoreFactoryImpl.java 16 Nov 2007 07:20:52 -0000 >@@ -16,10 +16,10 @@ > */ > package org.eclipse.emf.ecore.impl; > >- >-import java.math.BigDecimal; >-import java.math.BigInteger; >-import java.text.ParseException; >+//XXX GWT CHANGE No Big-Values >+//import java.math.BigDecimal; >+//import java.math.BigInteger; >+//import java.text.ParseException; > import java.util.Date; > import java.util.Map; > >@@ -112,10 +112,11 @@ > { > switch (eDataType.getClassifierID()) > { >- case EcorePackage.EBIG_DECIMAL: >- return createEBigDecimalFromString(eDataType, initialValue); >- case EcorePackage.EBIG_INTEGER: >- return createEBigIntegerFromString(eDataType, initialValue); >+//XXX GWT CHANGE BigInteger and Decimal not available >+// case EcorePackage.EBIG_DECIMAL: >+// return createEBigDecimalFromString(eDataType, initialValue); >+// case EcorePackage.EBIG_INTEGER: >+// return createEBigIntegerFromString(eDataType, initialValue); > case EcorePackage.EBOOLEAN: > return createEBooleanFromString(eDataType, initialValue); > case EcorePackage.EBOOLEAN_OBJECT: >@@ -172,10 +173,11 @@ > { > switch (eDataType.getClassifierID()) > { >- case EcorePackage.EBIG_DECIMAL: >- return convertEBigDecimalToString(eDataType, instanceValue); >- case EcorePackage.EBIG_INTEGER: >- return convertEBigIntegerToString(eDataType, instanceValue); >+//XXX GWT CHANGE BigInteger and Decimal not available >+// case EcorePackage.EBIG_DECIMAL: >+// return convertEBigDecimalToString(eDataType, instanceValue); >+// case EcorePackage.EBIG_INTEGER: >+// return convertEBigIntegerToString(eDataType, instanceValue); > case EcorePackage.EBOOLEAN: > return convertEBooleanToString(eDataType, instanceValue); > case EcorePackage.EBOOLEAN_OBJECT: >@@ -442,7 +444,8 @@ > { > return EDATE_FORMATS[i].parse(initialValue); > } >- catch (ParseException parseException) >+//XXX GWT CHANGE gwt-widgets is through IllegalArgument Exception >+ catch (IllegalArgumentException parseException) > { > exception = parseException; > } >@@ -549,15 +552,16 @@ > return eStringToStringMapEntry; > } > >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public BigDecimal createEBigDecimalFromString(EDataType eDataType, String initialValue) >- { >- return initialValue == null ? null : new BigDecimal(initialValue); >- } >+//XXX GWT CHANGE No BigDecimal >+// /** >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @generated NOT >+// */ >+// public BigDecimal createEBigDecimalFromString(EDataType eDataType, String initialValue) >+// { >+// return initialValue == null ? null : new BigDecimal(initialValue); >+// } > > /** > * <!-- begin-user-doc --> >@@ -569,15 +573,16 @@ > return instanceValue == null ? null : instanceValue.toString(); > } > >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public BigInteger createEBigIntegerFromString(EDataType eDataType, String initialValue) >- { >- return initialValue == null ? null : new BigInteger(initialValue); >- } >+//XXX GWT CHANGE No BigDecimal >+// /** >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @generated NOT >+// */ >+// public BigInteger createEBigIntegerFromString(EDataType eDataType, String initialValue) >+// { >+// return initialValue == null ? null : new BigInteger(initialValue); >+// } > > /** > * <!-- begin-user-doc --> >@@ -957,8 +962,8 @@ > */ > public Class createEJavaClassFromString(EDataType metaObject, String initialValue) > { >- try >- { >+// try >+// { > if (initialValue == null) return null; > else if ("boolean".equals(initialValue)) return boolean.class; > else if ("byte".equals(initialValue)) return byte.class; >@@ -968,12 +973,13 @@ > else if ("int".equals(initialValue)) return int.class; > else if ("long".equals(initialValue)) return long.class; > else if ("short".equals(initialValue)) return short.class; >- else return Class.forName(initialValue); >- } >- catch (ClassNotFoundException e) >- { >- throw new WrappedException(e); >- } >+// else return Class.forName(initialValue); >+ else throw new UnsupportedOperationException(); >+// } >+// catch (ClassNotFoundException e) >+// { >+// throw new WrappedException(e); >+// } > } > > /** >Index: src/org/eclipse/emf/ecore/impl/EClassifierImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EClassifierImpl.java,v >retrieving revision 1.20 >diff -u -r1.20 EClassifierImpl.java >--- src/org/eclipse/emf/ecore/impl/EClassifierImpl.java 7 May 2006 12:03:41 -0000 1.20 >+++ src/org/eclipse/emf/ecore/impl/EClassifierImpl.java 16 Nov 2007 07:20:50 -0000 >@@ -147,6 +147,7 @@ > */ > public boolean isInstance(Object object) > { >+//FIXME GWT CHANGE Integer.TYPE, .. > if (object != null) > { > Class instanceClass = getInstanceClass(); >@@ -154,42 +155,44 @@ > { > if (instanceClass.isPrimitive()) > { >- if (instanceClass == Boolean.TYPE) >+ if (instanceClass == boolean.class) > { > return object instanceof Boolean; > } >- else if (instanceClass == Integer.TYPE) >+ else if (instanceClass == int.class) > { > return object instanceof Integer; > } >- else if (instanceClass == Float.TYPE) >+ else if (instanceClass == float.class) > { > return object instanceof Float; > } >- else if (instanceClass == Byte.TYPE) >+ else if (instanceClass == byte.class) > { > return object instanceof Byte; > } >- else if (instanceClass == Character.TYPE) >+ else if (instanceClass == char.class) > { > return object instanceof Character; > } >- else if (instanceClass == Double.TYPE) >+ else if (instanceClass == double.class) > { > return object instanceof Double; > } >- else if (instanceClass == Short.TYPE) >+ else if (instanceClass == short.class) > { > return object instanceof Short; > } >- else if (instanceClass == Long.TYPE) >+ else if (instanceClass == long.class) > { > return object instanceof Long; > } > } > else > { >- return instanceClass.isInstance(object); >+//FIXME GWT CHANGE No isInstance available >+// return instanceClass.isInstance(object); >+ return true; > } > } > else if (object instanceof EObject) >@@ -267,7 +270,8 @@ > instanceClassName = generatedInstanceClassName; > generatedInstanceClassName = null; > } >- setInstanceClassNameGen(value == null ? null : value.intern()); >+ //FIXME GWT CHANGE String.intern not available >+ setInstanceClassNameGen(value == null ? null : value); > if (instanceClass != null) > { > setInstanceClassGen(null); >@@ -313,18 +317,18 @@ > { > if (instanceClass == null && (instanceClassName != null || generatedInstanceClassName != null)) > { >- try >- { >+// try >+// { > setInstanceClassGen(getClassForName(getInstanceClassName())); >- } >- catch (ClassNotFoundException e) >- { >- Class primitiveClass = getPrimitiveOrArrayClass(); >- if (primitiveClass != null) >- setInstanceClassGen(primitiveClass); >- else >- throw new WrappedException(e); >- } >+// } >+// catch (ClassNotFoundException e) >+// { >+// Class primitiveClass = getPrimitiveOrArrayClass(); >+// if (primitiveClass != null) >+// setInstanceClassGen(primitiveClass); >+// else >+// throw new WrappedException(e); >+// } > } > return getInstanceClassGen(); > } >@@ -335,10 +339,12 @@ > * used. Since the package may be model-specific code in another plug-in, its class loader may be able to see classes > * that Ecore's can't. > */ >- protected Class getClassForName(String name) throws ClassNotFoundException >+ protected Class getClassForName(String name) /*throws ClassNotFoundException*/ > { > EPackage p = getEPackage(); >- return p != null ? Class.forName(name, true, p.getClass().getClassLoader()) : Class.forName(name); >+//FIXME GWT CHANGE When is this called >+// return p != null ? Class.forName(name, true, p.getClass().getClassLoader()) : Class.forName(name); >+ throw new UnsupportedOperationException(); > } > > protected Class getPrimitiveOrArrayClass() >@@ -371,30 +377,31 @@ > result.append(componentClassName); > result.append(';'); > } >- try >- { >+//FIXME GWT CHANGE No dynamic loading >+// try >+// { > return getClassForName(result.toString()); >- } >- catch (ClassNotFoundException e) {} >+// } >+// catch (ClassNotFoundException e) {} > } > else > { > if (className.equals("boolean")) >- return java.lang.Boolean.TYPE; >+ return boolean.class; > else if (className.equals("byte")) >- return java.lang.Byte.TYPE; >+ return byte.class; > else if (className.equals("char")) >- return java.lang.Character.TYPE; >+ return char.class; > else if (className.equals("double")) >- return java.lang.Double.TYPE; >+ return double.class; > else if (className.equals("float")) >- return java.lang.Float.TYPE; >+ return float.class; > else if (className.equals("int")) >- return java.lang.Integer.TYPE; >+ return int.class; > else if (className.equals("long")) >- return java.lang.Long.TYPE; >+ return long.class; > else if (className.equals("short")) >- return java.lang.Short.TYPE; >+ return short.class; > } > return null; > } >@@ -408,29 +415,30 @@ > > public void setInstanceClass(Class value) > { >- if (value == null) >- { >- setInstanceClassNameGen(null); >- } >- else if (value.isArray()) >- { >- String indices = "[]"; >- for (Class component = value.getComponentType(); ; component = component.getComponentType()) >- { >- if (!component.isArray()) >- { >- setInstanceClassNameGen((component.getName() + indices).intern()); >- break; >- } >- indices += "[]"; >- } >- } >- else >- { >- setInstanceClassNameGen(value.getName().intern()); >- } >- >- setInstanceClassGen(value); >+//FIXME GWT CHANGE Is this really needed >+// if (value == null) >+// { >+// setInstanceClassNameGen(null); >+// } >+// else if (value.isArray()) >+// { >+// String indices = "[]"; >+// for (Class component = value.getComponentType(); ; component = component.getComponentType()) >+// { >+// if (!component.isArray()) >+// { >+// setInstanceClassNameGen((component.getName() + indices).intern()); >+// break; >+// } >+// indices += "[]"; >+// } >+// } >+// else >+// { >+// setInstanceClassNameGen(value.getName().intern()); >+// } >+// >+// setInstanceClassGen(value); > } > > /** >Index: src/org/eclipse/emf/ecore/impl/EFactoryImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EFactoryImpl.java,v >retrieving revision 1.20 >diff -u -r1.20 EFactoryImpl.java >--- src/org/eclipse/emf/ecore/impl/EFactoryImpl.java 20 Apr 2006 18:57:05 -0000 1.20 >+++ src/org/eclipse/emf/ecore/impl/EFactoryImpl.java 16 Nov 2007 07:20:50 -0000 >@@ -16,14 +16,14 @@ > */ > package org.eclipse.emf.ecore.impl; > >- >-import java.lang.reflect.Constructor; >-import java.lang.reflect.InvocationTargetException; >-import java.lang.reflect.Method; >-import java.text.DateFormat; >-import java.text.FieldPosition; >-import java.text.ParseException; >-import java.text.SimpleDateFormat; >+//XXX GWT CHANGE REFLECTION NOT AVAILABLE >+//import java.lang.reflect.Constructor; >+//import java.lang.reflect.InvocationTargetException; >+//import java.lang.reflect.Method; >+//import java.text.DateFormat; >+//import java.text.FieldPosition; >+//import java.text.ParseException; >+//import java.text.SimpleDateFormat; > import java.util.ArrayList; > import java.util.Collection; > import java.util.Date; >@@ -45,6 +45,8 @@ > import org.eclipse.emf.ecore.util.ExtendedMetaData; > import org.eclipse.emf.ecore.util.InternalEList; > import org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil; >+//XXX GWT CHANGE use gwt-widget SimpleDateFormat >+import org.gwtwidgets.client.util.SimpleDateFormat; > > > /** >@@ -347,77 +349,81 @@ > { > return EDATE_FORMATS[i].parse(stringValue); > } >- catch (ParseException parseException) >+//XXX GWT CHANGE gwtwidgets format throws an IllegalArgumentException >+ catch (IllegalArgumentException parseException) > { > } > } > throw new IllegalArgumentException("The value '" + stringValue + "' is not a date formatted string of the form yyyy-MM-dd'T'HH:mm:ss'.'SSSZ or a valid subset thereof"); > } > >- Class stringClass = String.class; >- Class[] signature = { stringClass }; >- >- Constructor ctor = null; >- try >- { >- ctor = c.getConstructor(signature); >- } >- catch (NoSuchMethodException e) >- { >- } >- Exception formatException = null; >- try >- { >- if (ctor != null) >- { >- Object[] ctorArgs = {stringValue}; >- return ctor.newInstance(ctorArgs); >- } >- } >- catch (InstantiationException e) >- { >- formatException = e; >- } >- catch (InvocationTargetException e) >- { >- formatException = e; >- } >- catch (IllegalAccessException e) >- { >- formatException = e; >- } >- >- Method valueOf = null; >- try >- { >- valueOf = c.getMethod("valueOf", signature); >- } >- catch (NoSuchMethodException e) >- { >- } >+//FIXME GWT CHANGE No reflection available >+ throw new IllegalArgumentException("Reflection is not available"); > >- try >- { >- if (valueOf != null) >- { >- Object[] valueOfArgs = {stringValue}; >- return valueOf.invoke(null, valueOfArgs); >- } >- } >- catch (IllegalArgumentException e) >- { >- formatException = e; >- } >- catch (InvocationTargetException e) >- { >- formatException = e; >- } >- catch (IllegalAccessException e) >- { >- formatException = e; >- } >- String exceptionString = (formatException != null) ? formatException.toString() : ""; >- throw new IllegalArgumentException("The value '" + stringValue + "' is invalid. " + exceptionString); >+// Class stringClass = String.class; >+// Class[] signature = { stringClass }; >+// >+// Constructor ctor = null; >+// try >+// { >+// ctor = c.getConstructor(signature); >+// } >+// catch (NoSuchMethodException e) >+// { >+// } >+// Exception formatException = null; >+// try >+// { >+// if (ctor != null) >+// { >+// Object[] ctorArgs = {stringValue}; >+// return ctor.newInstance(ctorArgs); >+// } >+// } >+// catch (InstantiationException e) >+// { >+// formatException = e; >+// } >+// catch (InvocationTargetException e) >+// { >+// formatException = e; >+// } >+// catch (IllegalAccessException e) >+// { >+// formatException = e; >+// } >+// >+// Method valueOf = null; >+// try >+// { >+// valueOf = c.getMethod("valueOf", signature); >+// } >+// catch (NoSuchMethodException e) >+// { >+// } >+// >+// try >+// { >+// if (valueOf != null) >+// { >+// Object[] valueOfArgs = {stringValue}; >+// return valueOf.invoke(null, valueOfArgs); >+// } >+// } >+// catch (IllegalArgumentException e) >+// { >+// formatException = e; >+// } >+// catch (InvocationTargetException e) >+// { >+// formatException = e; >+// } >+// catch (IllegalAccessException e) >+// { >+// formatException = e; >+// } >+// String exceptionString = (formatException != null) ? formatException.toString() : ""; >+// throw new IllegalArgumentException("The value '" + stringValue + "' is invalid. " + exceptionString); > } > > /** >@@ -555,18 +561,19 @@ > super(pattern); > } > >- public synchronized Date parse(String source) throws ParseException >+//XXX GWT No Exception because gwtwidget is only throwing ParseException >+ public synchronized Date parse(String source) > { > return super.parse(source); > } >- >- public synchronized StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) >- { >- return super.format(date, toAppendTo, fieldPosition); >- } >+//FIXME Not available >+// public synchronized StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) >+// { >+// return super.format(date, toAppendTo, fieldPosition); >+// } > } > >- protected static final DateFormat [] EDATE_FORMATS = >+ protected static final SimpleDateFormat [] EDATE_FORMATS = > { > new SafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSSZ"), > new SafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS"), >Index: src/org/eclipse/emf/ecore/impl/EEnumImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EEnumImpl.java,v >retrieving revision 1.16 >diff -u -r1.16 EEnumImpl.java >--- src/org/eclipse/emf/ecore/impl/EEnumImpl.java 21 Aug 2006 15:30:00 -0000 1.16 >+++ src/org/eclipse/emf/ecore/impl/EEnumImpl.java 16 Nov 2007 07:20:50 -0000 >@@ -102,7 +102,9 @@ > Class instanceClass = getInstanceClass(); > if (instanceClass != null) > { >- return instanceClass.isInstance(object); >+ throw new UnsupportedOperationException(); >+//FIXME GWT CHANGE >+// return instanceClass.isInstance(object); > } > else > { >Index: src/org/eclipse/emf/ecore/impl/EDataTypeImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EDataTypeImpl.java,v >retrieving revision 1.10 >diff -u -r1.10 EDataTypeImpl.java >--- src/org/eclipse/emf/ecore/impl/EDataTypeImpl.java 2 Dec 2005 12:16:44 -0000 1.10 >+++ src/org/eclipse/emf/ecore/impl/EDataTypeImpl.java 16 Nov 2007 07:20:50 -0000 >@@ -88,19 +88,20 @@ > defaultValue = null; > if (instanceClass != null && instanceClass.isPrimitive()) > { >- if (instanceClass == Boolean.TYPE) >+//XXX GWT CHANGE No Integer.TYPE, ... >+ if (instanceClass == boolean.class) > defaultValue = Boolean.FALSE; >- else if (instanceClass == Integer.TYPE) >+ else if (instanceClass == int.class) > defaultValue = new Integer(0); >- else if (instanceClass == Float.TYPE) >+ else if (instanceClass == float.class) > defaultValue = new Float(0.0F); >- else if (instanceClass == Double.TYPE) >+ else if (instanceClass == double.class) > defaultValue = new Double(0.0); >- else if (instanceClass == Long.TYPE) >+ else if (instanceClass == long.class) > defaultValue = new Long(0); >- else if (instanceClass == Short.TYPE) >+ else if (instanceClass == short.class) > defaultValue = new Short((short)0); >- else if (instanceClass == Byte.TYPE) >+ else if (instanceClass == byte.class) > defaultValue = new Byte((byte)0); > else // if (instanceClass == Character.TYPE) > defaultValue = new Character('\u0000'); >Index: src/org/eclipse/emf/ecore/impl/EPackageRegistryImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EPackageRegistryImpl.java,v >retrieving revision 1.10 >diff -u -r1.10 EPackageRegistryImpl.java >--- src/org/eclipse/emf/ecore/impl/EPackageRegistryImpl.java 8 May 2006 21:21:50 -0000 1.10 >+++ src/org/eclipse/emf/ecore/impl/EPackageRegistryImpl.java 16 Nov 2007 07:20:51 -0000 >@@ -22,7 +22,6 @@ > import java.util.Iterator; > import java.util.Map; > import java.util.Set; >-import java.util.WeakHashMap; > > import org.eclipse.emf.common.EMFPlugin; > import org.eclipse.emf.ecore.EFactory; >@@ -43,7 +42,9 @@ > { > try > { >- String className = System.getProperty("org.eclipse.emf.ecore.EPackage.Registry.INSTANCE"); >+//FIXME GWT CHANGE >+// String className = System.getProperty("org.eclipse.emf.ecore.EPackage.Registry.INSTANCE"); >+ String className = null; > if (className == null) > { > if (EcorePlugin.getDefaultRegistryImplementation() != null) >@@ -61,7 +62,8 @@ > } > else > { >- return (EPackage.Registry)Class.forName(className).newInstance(); >+ throw new UnsupportedOperationException(); >+// return (EPackage.Registry)Class.forName(className).newInstance(); > } > } > catch (Exception exception) >@@ -200,44 +202,49 @@ > /** > * A map from class loader to its associated registry. > */ >- protected static Map classLoaderToRegistryMap = new WeakHashMap(); >+//XXX GWT CHANGE No WeakHashMap available >+ protected static Map classLoaderToRegistryMap = new HashMap(); > > /** > * Returns the package registry associated with the given class loader. > * @param classLoader the class loader. > * @return the package registry associated with the given class loader. > */ >- public static synchronized EPackage.Registry getRegistry(ClassLoader classLoader) >- { >- EPackage.Registry result = (EPackage.Registry)classLoaderToRegistryMap.get(classLoader); >- if (result == null) >- { >- if (classLoader == null) >- { >- result = null; >- } >- else >- { >- result = new EPackageRegistryImpl(getRegistry(classLoader.getParent())); >- classLoaderToRegistryMap.put(classLoader, result); >- } >- } >- return result; >- } >+//FIXME GWT CHANGE No ClassLoaders >+// public static synchronized EPackage.Registry getRegistry(ClassLoader classLoader) >+// { >+// EPackage.Registry result = (EPackage.Registry)classLoaderToRegistryMap.get(classLoader); >+// if (result == null) >+// { >+// if (classLoader == null) >+// { >+// result = null; >+// } >+// else >+// { >+// result = new EPackageRegistryImpl(getRegistry(classLoader.getParent())); >+// classLoaderToRegistryMap.put(classLoader, result); >+// } >+// } >+// return result; >+// } > > /** > * A package registry implementation that delegates to a class loader specific registry. > */ > public static class Delegator implements EPackage.Registry > { >- protected EPackage.Registry delegateRegistry(ClassLoader classLoader) >- { >- return getRegistry(classLoader); >- } >+//FIXME GWT CHANGE No ClassLoader >+// protected EPackage.Registry delegateRegistry(ClassLoader classLoader) >+// { >+// return getRegistry(classLoader); >+// } > > protected EPackage.Registry delegateRegistry() > { >- return delegateRegistry(Thread.currentThread().getContextClassLoader()); >+//FIXME GWT CHANGE No Thread things available >+ throw new UnsupportedOperationException(); >+// return delegateRegistry(Thread.currentThread().getContextClassLoader()); > } > > public EPackage getEPackage(String key) >@@ -284,40 +291,42 @@ > } > else > { >- String valueClassName = valueClass.getName(); >- >- // Find the uppermost classloader in the hierarchy that can load the class. >- // >- ClassLoader result = Thread.currentThread().getContextClassLoader(); >- for (ClassLoader classLoader = result.getParent(); classLoader != null; classLoader = classLoader.getParent()) >- { >- try >- { >- Class loadedClass = classLoader.loadClass(valueClassName); >- if (loadedClass == valueClass) >- { >- result = classLoader; >- } >- else >- { >- // The class address was not equal, so we don't want this classloader, >- // but instead want the last result that was able to load the class. >- // >- break; >- } >- } >- catch (ClassNotFoundException exception) >- { >- // We can't find the class, so we don't want this classloader, >- // but instead want the last result that was able to load the class. >- // >- break; >- } >- } >- >+//FIXME GWT CHANGE No ClassLoaders available >+// String valueClassName = valueClass.getName(); >+// >+// // Find the uppermost classloader in the hierarchy that can load the class. >+// // >+// ClassLoader result = Thread.currentThread().getContextClassLoader(); >+// for (ClassLoader classLoader = result.getParent(); classLoader != null; classLoader = classLoader.getParent()) >+// { >+// try >+// { >+// Class loadedClass = classLoader.loadClass(valueClassName); >+// if (loadedClass == valueClass) >+// { >+// result = classLoader; >+// } >+// else >+// { >+// // The class address was not equal, so we don't want this classloader, >+// // but instead want the last result that was able to load the class. >+// // >+// break; >+// } >+// } >+// catch (ClassNotFoundException exception) >+// { >+// // We can't find the class, so we don't want this classloader, >+// // but instead want the last result that was able to load the class. >+// // >+// break; >+// } >+// } >+// > // Register with the upper most classloader that's able to load the class. > // >- return delegateRegistry(result).put(key, value); >+// return delegateRegistry(result).put(key, value); >+ throw new UnsupportedOperationException(); > } > } > >Index: src/org/eclipse/emf/ecore/xml/namespace/util/XMLNamespaceValidator.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/namespace/util/XMLNamespaceValidator.java >diff -N src/org/eclipse/emf/ecore/xml/namespace/util/XMLNamespaceValidator.java >--- src/org/eclipse/emf/ecore/xml/namespace/util/XMLNamespaceValidator.java 3 May 2006 19:30:32 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,225 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLNamespaceValidator.java,v 1.3 2006/05/03 19:30:32 davidms Exp $ >- */ >-package org.eclipse.emf.ecore.xml.namespace.util; >- >-import java.util.List; >-import java.util.Map; >- >-import org.eclipse.emf.common.util.BasicDiagnostic; >-import org.eclipse.emf.common.util.Diagnostic; >-import org.eclipse.emf.common.util.DiagnosticChain; >- >-import org.eclipse.emf.ecore.EPackage; >- >-import org.eclipse.emf.ecore.util.EObjectValidator; >- >-import org.eclipse.emf.ecore.xml.namespace.*; >- >-import org.eclipse.emf.ecore.xml.type.XMLTypePackage; >- >-import org.eclipse.emf.ecore.xml.type.util.XMLTypeValidator; >- >-/** >- * <!-- begin-user-doc --> >- * The <b>Validator</b> for the model. >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage >- * @generated >- */ >-public class XMLNamespaceValidator extends EObjectValidator >-{ >- /** >- * The cached model package >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static final XMLNamespaceValidator INSTANCE = new XMLNamespaceValidator(); >- >- /** >- * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.common.util.Diagnostic#getSource() >- * @see org.eclipse.emf.common.util.Diagnostic#getCode() >- * @generated >- */ >- public static final String DIAGNOSTIC_SOURCE = "org.eclipse.emf.ecore.xml.namespace"; >- >- /** >- * A constant with a fixed name that can be used as the base value for additional hand written constants. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0; >- >- /** >- * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; >- >- /** >- * The cached base package validator. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeValidator xmlTypeValidator; >- >- /** >- * Creates an instance of the switch. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLNamespaceValidator() >- { >- super(); >- xmlTypeValidator = XMLTypeValidator.INSTANCE; >- } >- >- /** >- * Returns the package of this validator switch. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected EPackage getEPackage() >- { >- return XMLNamespacePackage.eINSTANCE; >- } >- >- /** >- * Calls <code>validateXXX</code> for the corresonding classifier of the model. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map context) >- { >- switch (classifierID) >- { >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT: >- return validateXMLNamespaceDocumentRoot((XMLNamespaceDocumentRoot)value, diagnostics, context); >- case XMLNamespacePackage.SPACE_TYPE: >- return validateSpaceType((SpaceType)value, diagnostics, context); >- case XMLNamespacePackage.LANG_TYPE: >- return validateLangType((String)value, diagnostics, context); >- case XMLNamespacePackage.LANG_TYPE_NULL: >- return validateLangTypeNull((String)value, diagnostics, context); >- case XMLNamespacePackage.SPACE_TYPE_OBJECT: >- return validateSpaceTypeObject((SpaceType)value, diagnostics, context); >- default: >- return true; >- } >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateXMLNamespaceDocumentRoot(XMLNamespaceDocumentRoot xmlNamespaceDocumentRoot, DiagnosticChain diagnostics, Map context) >- { >- return validate_EveryDefaultConstraint(xmlNamespaceDocumentRoot, diagnostics, context); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateSpaceType(SpaceType spaceType, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateLangType(String langType, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateLangType_MemberTypes(langType, diagnostics, context); >- return result; >- } >- >- /** >- * Validates the MemberTypes constraint of '<em>Lang Type</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateLangType_MemberTypes(String langType, DiagnosticChain diagnostics, Map context) >- { >- if (diagnostics != null) >- { >- BasicDiagnostic tempDiagnostics = new BasicDiagnostic(); >- if (XMLTypePackage.Literals.LANGUAGE.isInstance(langType)) >- { >- if (xmlTypeValidator.validateLanguage((String)langType, tempDiagnostics, context)) return true; >- } >- if (XMLNamespacePackage.Literals.LANG_TYPE_NULL.isInstance(langType)) >- { >- if (validateLangTypeNull((String)langType, tempDiagnostics, context)) return true; >- } >- List children = tempDiagnostics.getChildren(); >- for (int i = 0; i < children.size(); i++) >- { >- diagnostics.add((Diagnostic)children.get(i)); >- } >- } >- else >- { >- if (XMLTypePackage.Literals.LANGUAGE.isInstance(langType)) >- { >- if (xmlTypeValidator.validateLanguage((String)langType, null, context)) return true; >- } >- if (XMLNamespacePackage.Literals.LANG_TYPE_NULL.isInstance(langType)) >- { >- if (validateLangTypeNull((String)langType, null, context)) return true; >- } >- } >- return false; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateLangTypeNull(String langTypeNull, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateSpaceTypeObject(SpaceType spaceTypeObject, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >-} //XMLNamespaceValidator >Index: src/org/eclipse/emf/ecore/util/EcoreUtil.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/EcoreUtil.java,v >retrieving revision 1.47 >diff -u -r1.47 EcoreUtil.java >--- src/org/eclipse/emf/ecore/util/EcoreUtil.java 7 Sep 2006 13:20:17 -0000 1.47 >+++ src/org/eclipse/emf/ecore/util/EcoreUtil.java 16 Nov 2007 07:20:54 -0000 >@@ -18,11 +18,12 @@ > > > import java.io.PrintStream; >-import java.security.SecureRandom; >+//XXX GWT CHANGE >+//import java.security.SecureRandom; > import java.util.ArrayList; > import java.util.Collection; > import java.util.Collections; >-import java.util.GregorianCalendar; >+//import java.util.GregorianCalendar; > import java.util.HashMap; > import java.util.Iterator; > import java.util.List; >@@ -3053,31 +3054,32 @@ > } > else if (javaClass.isPrimitive()) > { >- if (javaClass == Boolean.TYPE) >+//FIXME GWT CHANGE >+ if (javaClass == boolean.class) > { > return Boolean.class; > } >- else if (javaClass == Integer.TYPE) >+ else if (javaClass == int.class) > { > return Integer.class; > } >- else if (javaClass == Float.TYPE) >+ else if (javaClass == float.class) > { > return Float.class; > } >- else if (javaClass == Double.TYPE) >+ else if (javaClass == double.class) > { > return Double.class; > } >- else if (javaClass == Long.TYPE) >+ else if (javaClass == long.class) > { > return Long.class; > } >- else if (javaClass == Short.TYPE) >+ else if (javaClass == short.class) > { > return Short.class; > } >- else if (javaClass == Byte.TYPE) >+ else if (javaClass == byte.class) > { > return Byte.class; > } >@@ -3285,69 +3287,70 @@ > } > } > >- /** >- * Generates a universally unique identifier, >- * i.e., a <a href="ftp://ietf.org/internet-drafts/draft-mealling-uuid-urn-02.txt">UUID</a>. >- * It encodes the 128 bit UUID in <a href="http://www.ietf.org/rfc/rfc2045.txt">base 64</a>, >- * but rather than padding the encoding with two "=" characters, >- * it prefixes the encoding with a single "_" character, >- * to ensure that the result is a valid <a href="http://www.w3.org/TR/xmlschema-2/#ID">ID</a>, >- * i.e., an <a href="http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName">NCName</a> >- * @return a universally unique identifier. >- */ >- public static String generateUUID() >- { >- return UUID.generate(); >- } >- >- /** >- * Generates a universally unique identifier, >- * i.e., a <a href="ftp://ietf.org/internet-drafts/draft-mealling-uuid-urn-02.txt">UUID</a>. >- * The argument is filled in with the 128 bit UUID and hence must be at least 16 bytes in length. >- * @param uuid the value to receive the result. >- */ >- public static void generateUUID(byte [] uuid) >- { >- UUID.generate(uuid); >- } >- >- private static final class UUID >- { >- public synchronized static String generate() >- { >- updateCurrentTime(); >- >- // Do a base 64 conversion by turning every 3 bytes into 4 base 64 characters >- // >- for (int i = 0; i < 5; ++i) >- { >- buffer[4 * i + 1] = BASE64_DIGITS[(uuid[i * 3] >> 2) & 0x3F]; >- buffer[4 * i + 2] = BASE64_DIGITS[((uuid[i * 3] << 4) & 0x30) | ((uuid[i * 3 + 1] >> 4) & 0xF)]; >- buffer[4 * i + 3] = BASE64_DIGITS[((uuid[i * 3 + 1] << 2) & 0x3C) | ((uuid[i * 3 + 2] >> 6) & 0x3)]; >- buffer[4 * i + 4] = BASE64_DIGITS[uuid[i * 3 + 2] & 0x3F]; >- } >- >- // Handle the last byte at the end. >- // >- buffer[21] = BASE64_DIGITS[(uuid[15] >> 2) & 0x3F]; >- buffer[22] = BASE64_DIGITS[(uuid[15] << 4) & 0x30]; >- >- return new String(buffer); >- } >- >- public synchronized static void generate(byte [] uuid) >- { >- updateCurrentTime(); >- >- for (int i = 0; i < 16; i++) >- { >- uuid[i] = UUID.uuid[i]; >- } >- } >- >- private UUID() >- { >- } >+//FIXME GWT CHANGE >+// /** >+// * Generates a universally unique identifier, >+// * i.e., a <a href="ftp://ietf.org/internet-drafts/draft-mealling-uuid-urn-02.txt">UUID</a>. >+// * It encodes the 128 bit UUID in <a href="http://www.ietf.org/rfc/rfc2045.txt">base 64</a>, >+// * but rather than padding the encoding with two "=" characters, >+// * it prefixes the encoding with a single "_" character, >+// * to ensure that the result is a valid <a href="http://www.w3.org/TR/xmlschema-2/#ID">ID</a>, >+// * i.e., an <a href="http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName">NCName</a> >+// * @return a universally unique identifier. >+// */ >+// public static String generateUUID() >+// { >+// return UUID.generate(); >+// } >+// >+// /** >+// * Generates a universally unique identifier, >+// * i.e., a <a href="ftp://ietf.org/internet-drafts/draft-mealling-uuid-urn-02.txt">UUID</a>. >+// * The argument is filled in with the 128 bit UUID and hence must be at least 16 bytes in length. >+// * @param uuid the value to receive the result. >+// */ >+// public static void generateUUID(byte [] uuid) >+// { >+// UUID.generate(uuid); >+// } >+ >+// private static final class UUID >+// { >+// public synchronized static String generate() >+// { >+// updateCurrentTime(); >+// >+// // Do a base 64 conversion by turning every 3 bytes into 4 base 64 characters >+// // >+// for (int i = 0; i < 5; ++i) >+// { >+// buffer[4 * i + 1] = BASE64_DIGITS[(uuid[i * 3] >> 2) & 0x3F]; >+// buffer[4 * i + 2] = BASE64_DIGITS[((uuid[i * 3] << 4) & 0x30) | ((uuid[i * 3 + 1] >> 4) & 0xF)]; >+// buffer[4 * i + 3] = BASE64_DIGITS[((uuid[i * 3 + 1] << 2) & 0x3C) | ((uuid[i * 3 + 2] >> 6) & 0x3)]; >+// buffer[4 * i + 4] = BASE64_DIGITS[uuid[i * 3 + 2] & 0x3F]; >+// } >+// >+// // Handle the last byte at the end. >+// // >+// buffer[21] = BASE64_DIGITS[(uuid[15] >> 2) & 0x3F]; >+// buffer[22] = BASE64_DIGITS[(uuid[15] << 4) & 0x30]; >+// >+// return new String(buffer); >+// } >+// >+// public synchronized static void generate(byte [] uuid) >+// { >+// updateCurrentTime(); >+// >+// for (int i = 0; i < 16; i++) >+// { >+// uuid[i] = UUID.uuid[i]; >+// } >+// } >+ >+// private UUID() >+// { >+// } > > private static final char[] BASE64_DIGITS = { > 'A', >@@ -3414,173 +3417,173 @@ > '9', > '-', > '_' }; >+//FIXME GWT CHANGE >+// /** >+// * An adjustment to convert the Java epoch of Jan 1, 1970 00:00:00 to >+// * the epoch required by the IETF specification, Oct 15, 1582 00:00:00. >+// */ >+// private static final long EPOCH_ADJUSTMENT = new GregorianCalendar(1970, 0, 1, 0, 0, 0).getTime().getTime() >+// - new GregorianCalendar(1582, 9, 15, 0, 0, 0).getTime().getTime(); > >- /** >- * An adjustment to convert the Java epoch of Jan 1, 1970 00:00:00 to >- * the epoch required by the IETF specification, Oct 15, 1582 00:00:00. >- */ >- private static final long EPOCH_ADJUSTMENT = new GregorianCalendar(1970, 0, 1, 0, 0, 0).getTime().getTime() >- - new GregorianCalendar(1582, 9, 15, 0, 0, 0).getTime().getTime(); >- >- private static long lastTime = System.currentTimeMillis() + EPOCH_ADJUSTMENT; >+// private static long lastTime = System.currentTimeMillis() + EPOCH_ADJUSTMENT; > > private static short clockSequence; > > private static short timeAdjustment; >- >+ > private static int sleepTime = 1; > > /** > * A cached array of bytes representing the UUID. The second 8 bytes > * will be kept the same unless the clock sequence has changed. > */ >- private static final byte[] uuid = new byte [16]; >- >- private static final char[] buffer = new char [23]; >- >- static >- { >- SecureRandom random = new SecureRandom(); >- >- clockSequence = (short)random.nextInt(16384); >- updateClockSequence(); >- >- // Generate a 48 bit node identifier; >- // This is an alternative to the IEEE 802 host address, which is not available in Java. >- // >- byte[] nodeAddress = new byte [6]; >+// private static final byte[] uuid = new byte [16]; > >- random.nextBytes(nodeAddress); >- >- // Set the most significant bit of the first octet to 1 so as to distinguish it from IEEE node addresses >- // >- nodeAddress[0] |= (byte)0x80; >- >- // The node identifier is already in network byte order, >- // so there is no need to do any byte order reversing. >- // >- for (int i = 0; i < 6; ++i) >- { >- uuid[i + 10] = nodeAddress[i]; >- } >- >- buffer[0] = '_'; >- } >- >- /** >- * Updates the clock sequence portion of the UUID. The clock sequence >- * portion may seem odd, but in the specification, the high order byte >- * comes before the low order byte. The variant is multiplexed into the >- * high order octet of clockseq_hi. >- */ >- private static void updateClockSequence() >- { >- // clockseq_hi >- uuid[8] = (byte)(((clockSequence >> 8) & 0x3F) | 0x80); >- // clockseq_low >- uuid[9] = (byte)(clockSequence & 0xFF); >- } >+// private static final char[] buffer = new char [23]; > >- /** >- * Updates the UUID with the current time, compensating for the fact >- * that the clock resolution may be less than 100 ns. The byte array >- * will have its first eight bytes populated with the time in the >- * correct sequence of bytes, as per the specification. >- */ >- private static void updateCurrentTime() >- { >- // Get the current time in milliseconds since the epoch >- // and adjust it to match the epoch required by the specification. >- // >- long currentTime = System.currentTimeMillis() + EPOCH_ADJUSTMENT; >- >- if (lastTime > currentTime) >- { >- // The system clock has been rewound so the clock sequence must be incremented >- // to ensure that a duplicate UUID is not generated. >- // >- ++clockSequence; >- >- if (16384 == clockSequence) >- { >- clockSequence = 0; >- } >- >- updateClockSequence(); >- } >- else if (lastTime == currentTime) >- { >- // The system time hasn't changed so add some increment of 100s of nanoseconds to guarantee uniqueness. >- // >- ++timeAdjustment; >- >- if (timeAdjustment > 9999) >- { >- // Wait so that the clock can catch up and the time adjustment won't overflow. >- try >- { >- Thread.sleep(sleepTime); >- } >- catch (InterruptedException exception) >- { >- } >- >- timeAdjustment = 0; >- currentTime = System.currentTimeMillis() + EPOCH_ADJUSTMENT; >- >- while (lastTime == currentTime) >- { >- try >- { >- ++sleepTime; >- Thread.sleep(1); >- } >- catch (InterruptedException exception) >- { >- } >- currentTime = System.currentTimeMillis() + EPOCH_ADJUSTMENT; >- } >- } >- } >- else >- { >- timeAdjustment = 0; >- } >- >- lastTime = currentTime; >- >- // Since the granularity of time in Java is only milliseconds, >- // add an adjustment so that the time is represented in 100s of nanoseconds. >- // The version number (1) is multiplexed into the most significant hex digit. >- // >- currentTime *= 10000; >- currentTime += timeAdjustment; >- currentTime |= 0x1000000000000000L; >- >- // Place the time into the byte array in network byte order. >- // >- for (int i = 0; i < 4; ++i) >- { >- // time_low >- // >- uuid[i] = (byte)((currentTime >> 8 * (3 - i)) & 0xFFL); >- } >- >- for (int i = 0; i < 2; ++i) >- { >- // time_mid >- // >- uuid[i + 4] = (byte)((currentTime >> 8 * (1 - i) + 32) & 0xFFL); >- } >- >- for (int i = 0; i < 2; ++i) >- { >- // time_hi >- // >- uuid[i + 6] = (byte)((currentTime >> 8 * (1 - i) + 48) & 0xFFL); >- } >- } >- } >+// static >+// { >+// SecureRandom random = new SecureRandom(); >+// >+// clockSequence = (short)random.nextInt(16384); >+// updateClockSequence(); >+// >+// // Generate a 48 bit node identifier; >+// // This is an alternative to the IEEE 802 host address, which is not available in Java. >+// // >+// byte[] nodeAddress = new byte [6]; >+// >+// random.nextBytes(nodeAddress); >+// >+// // Set the most significant bit of the first octet to 1 so as to distinguish it from IEEE node addresses >+// // >+// nodeAddress[0] |= (byte)0x80; >+// >+// // The node identifier is already in network byte order, >+// // so there is no need to do any byte order reversing. >+// // >+// for (int i = 0; i < 6; ++i) >+// { >+// uuid[i + 10] = nodeAddress[i]; >+// } >+// >+// buffer[0] = '_'; >+// } >+ >+// /** >+// * Updates the clock sequence portion of the UUID. The clock sequence >+// * portion may seem odd, but in the specification, the high order byte >+// * comes before the low order byte. The variant is multiplexed into the >+// * high order octet of clockseq_hi. >+// */ >+// private static void updateClockSequence() >+// { >+// // clockseq_hi >+// uuid[8] = (byte)(((clockSequence >> 8) & 0x3F) | 0x80); >+// // clockseq_low >+// uuid[9] = (byte)(clockSequence & 0xFF); >+// } >+ >+// /** >+// * Updates the UUID with the current time, compensating for the fact >+// * that the clock resolution may be less than 100 ns. The byte array >+// * will have its first eight bytes populated with the time in the >+// * correct sequence of bytes, as per the specification. >+// */ >+// private static void updateCurrentTime() >+// { >+// // Get the current time in milliseconds since the epoch >+// // and adjust it to match the epoch required by the specification. >+// // >+// long currentTime = System.currentTimeMillis() + EPOCH_ADJUSTMENT; >+// >+// if (lastTime > currentTime) >+// { >+// // The system clock has been rewound so the clock sequence must be incremented >+// // to ensure that a duplicate UUID is not generated. >+// // >+// ++clockSequence; >+// >+// if (16384 == clockSequence) >+// { >+// clockSequence = 0; >+// } >+// >+// updateClockSequence(); >+// } >+// else if (lastTime == currentTime) >+// { >+// // The system time hasn't changed so add some increment of 100s of nanoseconds to guarantee uniqueness. >+// // >+// ++timeAdjustment; >+// >+// if (timeAdjustment > 9999) >+// { >+// // Wait so that the clock can catch up and the time adjustment won't overflow. >+// try >+// { >+// Thread.sleep(sleepTime); >+// } >+// catch (InterruptedException exception) >+// { >+// } >+// >+// timeAdjustment = 0; >+// currentTime = System.currentTimeMillis() + EPOCH_ADJUSTMENT; >+// >+// while (lastTime == currentTime) >+// { >+// try >+// { >+// ++sleepTime; >+// Thread.sleep(1); >+// } >+// catch (InterruptedException exception) >+// { >+// } >+// currentTime = System.currentTimeMillis() + EPOCH_ADJUSTMENT; >+// } >+// } >+// } >+// else >+// { >+// timeAdjustment = 0; >+// } >+// >+// lastTime = currentTime; >+// >+// // Since the granularity of time in Java is only milliseconds, >+// // add an adjustment so that the time is represented in 100s of nanoseconds. >+// // The version number (1) is multiplexed into the most significant hex digit. >+// // >+// currentTime *= 10000; >+// currentTime += timeAdjustment; >+// currentTime |= 0x1000000000000000L; >+// >+// // Place the time into the byte array in network byte order. >+// // >+// for (int i = 0; i < 4; ++i) >+// { >+// // time_low >+// // >+// uuid[i] = (byte)((currentTime >> 8 * (3 - i)) & 0xFFL); >+// } >+// >+// for (int i = 0; i < 2; ++i) >+// { >+// // time_mid >+// // >+// uuid[i + 4] = (byte)((currentTime >> 8 * (1 - i) + 32) & 0xFFL); >+// } >+// >+// for (int i = 0; i < 2; ++i) >+// { >+// // time_hi >+// // >+// uuid[i + 6] = (byte)((currentTime >> 8 * (1 - i) + 48) & 0xFFL); >+// } >+// } >+// } > > /** > * Marks the package to indicate that it and everything it contains or that its contents depend on can no longer be changed. >Index: src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java,v >retrieving revision 1.26.2.2 >diff -u -r1.26.2.2 BasicExtendedMetaData.java >--- src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java 14 Aug 2007 17:27:17 -0000 1.26.2.2 >+++ src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java 16 Nov 2007 07:20:53 -0000 >@@ -21,7 +21,7 @@ > import java.util.Collection; > import java.util.Collections; > import java.util.HashMap; >-import java.util.Hashtable; >+//XXX GWT CHANGE No Hashtable available > import java.util.List; > import java.util.Map; > import java.util.StringTokenizer; >@@ -72,7 +72,8 @@ > > public BasicExtendedMetaData(String annotationURI, EPackage.Registry registry, Map annotationMap) > { >- this.annotationURI = annotationURI.intern(); >+//XXX GWT CHANGE no String.intern() >+ this.annotationURI = annotationURI; > this.registry = registry; > this.demandRegistry = new org.eclipse.emf.ecore.impl.EPackageRegistryImpl(); > this.annotationMap = annotationMap; >@@ -1902,7 +1903,15 @@ > { > prefix.append('_'); > } >- return prefix.reverse().toString(); >+//XXX No reverse available for StringBuffer >+ char[] ar = prefix.toString().toCharArray(); >+ char[] nar = new char[ar.length]; >+ >+ for( int i = 0; i < ar.length; i++ ) { >+ nar[i] = ar[ar.length - 1 - i]; >+ } >+ >+ return new String(nar); > } > > public EClassifier demandType(String namespace, String name) >@@ -2776,7 +2785,8 @@ > { > if (validatorMap == null) > { >- validatorMap = new Hashtable(); >+//XXX GWT CHANGE No Hashtable >+ validatorMap = new HashMap(); > } > return validatorMap; > } >Index: src/org/eclipse/emf/ecore/util/BasicInternalEList.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/BasicInternalEList.java,v >retrieving revision 1.1 >diff -u -r1.1 BasicInternalEList.java >--- src/org/eclipse/emf/ecore/util/BasicInternalEList.java 10 Dec 2005 13:34:27 -0000 1.1 >+++ src/org/eclipse/emf/ecore/util/BasicInternalEList.java 16 Nov 2007 07:20:53 -0000 >@@ -16,8 +16,7 @@ > */ > package org.eclipse.emf.ecore.util; > >- >-import java.lang.reflect.Array; >+//XXX GWT CHANGE No Reflection > import java.util.Collection; > import java.util.Iterator; > import java.util.List; >@@ -57,7 +56,8 @@ > > protected Object [] newData(int capacity) > { >- return (Object [])Array.newInstance(dataClass, capacity); >+//FIXME GWT CHANGE No Reflection >+ return (Object [])new Object[capacity]; > } > > public NotificationChain basicRemove(Object object, NotificationChain notifications) >Index: src/org/eclipse/emf/ecore/util/EcoreEMap.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/EcoreEMap.java,v >retrieving revision 1.7 >diff -u -r1.7 EcoreEMap.java >--- src/org/eclipse/emf/ecore/util/EcoreEMap.java 13 Apr 2006 11:43:13 -0000 1.7 >+++ src/org/eclipse/emf/ecore/util/EcoreEMap.java 16 Nov 2007 07:20:53 -0000 >@@ -16,8 +16,8 @@ > */ > package org.eclipse.emf.ecore.util; > >- >-import java.lang.reflect.Array; >+//XXX GWT CHANGE No Reflection >+//import java.lang.reflect.Array; > import java.util.Iterator; > import java.util.List; > import java.util.ListIterator; >@@ -142,7 +142,8 @@ > { > public Object [] newData(int listCapacity) > { >- return (Object [])Array.newInstance(entryClass, listCapacity); >+//FIXME GWT CHANGE No Reflection >+ return (Object [])new Object[listCapacity]; > } > }; > } >Index: src/org/eclipse/emf/ecore/util/FeatureMapUtil.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/FeatureMapUtil.java,v >retrieving revision 1.28.2.1 >diff -u -r1.28.2.1 FeatureMapUtil.java >--- src/org/eclipse/emf/ecore/util/FeatureMapUtil.java 29 Mar 2007 14:36:10 -0000 1.28.2.1 >+++ src/org/eclipse/emf/ecore/util/FeatureMapUtil.java 16 Nov 2007 07:20:54 -0000 >@@ -23,12 +23,13 @@ > import java.util.Collection; > import java.util.Collections; > import java.util.ConcurrentModificationException; >+import java.util.HashMap; > import java.util.Iterator; > import java.util.List; > import java.util.ListIterator; > import java.util.Map; > import java.util.NoSuchElementException; >-import java.util.WeakHashMap; >+//XXX GWT CHANGE No WeakHashMap > > import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.common.notify.NotificationChain; >@@ -185,9 +186,9 @@ > if (value != null && !eStructuralFeature.getEType().isInstance(value)) > { > String valueClass = value instanceof EObject ? ((EObject)value).eClass().getName() : value.getClass().getName(); >- throw >+ throw > new ClassCastException >- ("The feature '" + eStructuralFeature.getName() + "'s type '" + >+ ("The feature '" + eStructuralFeature.getName() + "'s type '" + > eStructuralFeature.getEType().getName() + "' does not permit a value of type '" + valueClass + "'"); > } > } >@@ -215,7 +216,7 @@ > else > { > FeatureMap.Entry entry = (FeatureMap.Entry)that; >- return >+ return > entry.getEStructuralFeature() == eStructuralFeature && > (value == null ? entry.getValue() == null : value.equals(entry.getValue())); > } >@@ -230,10 +231,10 @@ > { > String prefix = eStructuralFeature.getEContainingClass().getEPackage().getNsPrefix(); > eStructuralFeature.getName(); >- return >- (prefix != null && prefix.length() != 0 ? >- prefix + ":" + eStructuralFeature.getName() : >- eStructuralFeature.getName()) + >+ return >+ (prefix != null && prefix.length() != 0 ? >+ prefix + ":" + eStructuralFeature.getName() : >+ eStructuralFeature.getName()) + > "=" + value; > /* > StringBuffer result = new StringBuffer(super.toString()); >@@ -517,6 +518,8 @@ > > public static class FeatureEList extends AbstractList implements InternalEList.Unsettable, EStructuralFeature.Setting > { >+//XXX GWT CHANGE No modCount available >+// protected int modCount = 0; > public static class Basic extends FeatureEList > { > public Basic(EStructuralFeature feature, FeatureMap.Internal featureMap) >@@ -670,13 +673,13 @@ > { > featureMap.addUnique(getEStructuralFeature(), index, object); > } >- >+ > public boolean addAllUnique(Collection collection) > { > modCount = -1; > return featureMap.addAllUnique(collection); > } >- >+ > public void addUnique(Entry.Internal entry) > { > modCount = -1; >@@ -823,17 +826,17 @@ > public static class FeatureFeatureMap extends FeatureEList implements FeatureMap.Internal, FeatureMap.Internal.Wrapper > { > protected FeatureMap.Internal.Wrapper wrapper = this; >- >+ > public FeatureFeatureMap(EStructuralFeature feature, FeatureMap.Internal featureMap) > { > super(feature, featureMap); > } >- >+ > public FeatureMap.ValueListIterator valueListIterator() > { > return featureMap.valueListIterator(); > } >- >+ > public FeatureMap.ValueListIterator valueListIterator(int index) > { > return featureMap.valueListIterator(index); >@@ -1111,7 +1114,7 @@ > { > featureMap.unset(feature); > } >- >+ > public Wrapper getWrapper() > { > return wrapper; >@@ -1193,14 +1196,14 @@ > { > super(owner, eventType, feature, oldObject, newObject, index, wasSet); > } >- >+ > public int getFeatureID(Class expectedClass) > { > if (featureID == NO_FEATURE_ID && feature != null) > { > Class containerClass = feature.getContainerClass(); >- featureID = containerClass == null ? >- notifier.eClass().getFeatureID(feature) : >+ featureID = containerClass == null ? >+ notifier.eClass().getFeatureID(feature) : > notifier.eDerivedStructuralFeatureID(feature.getFeatureID(), containerClass); > } > return notifier.eBaseStructuralFeatureID(featureID, expectedClass); >@@ -1348,8 +1351,8 @@ > protected List wildcards; > protected String name; > protected boolean isElement; >- >- protected class Cache extends WeakHashMap >+//XXX GWT CHANGE No WeakHashMap >+ protected class Cache extends HashMap > { > public Boolean get(EStructuralFeature eStructuralFeature) > { >@@ -1417,8 +1420,8 @@ > for (int i = 0, size = containingClass.getFeatureCount(); i < size; ++i) > { > EStructuralFeature feature = containingClass.getEStructuralFeature(i); >- for (EStructuralFeature group = ExtendedMetaData.INSTANCE.getGroup(feature); >- group != null; >+ for (EStructuralFeature group = ExtendedMetaData.INSTANCE.getGroup(feature); >+ group != null; > group = ExtendedMetaData.INSTANCE.getGroup(group)) > { > if (group == eStructuralFeature) >@@ -1428,7 +1431,7 @@ > } > } > } >- else >+ else > { > wildcards = null; > isElement = true; >@@ -1465,9 +1468,9 @@ > if (wildcards == ANY_WILDCARD) > { > int featureKind = ExtendedMetaData.INSTANCE.getFeatureKind(feature); >- return >- isElement ? >- featureKind == ExtendedMetaData.ELEMENT_FEATURE && >+ return >+ isElement ? >+ featureKind == ExtendedMetaData.ELEMENT_FEATURE && > feature != XMLTypeFeatures.TEXT && feature != XMLTypeFeatures.CDATA && feature != XMLTypeFeatures.COMMENT : > featureKind == ExtendedMetaData.ATTRIBUTE_FEATURE; > } >@@ -1493,7 +1496,7 @@ > } > } > >- protected static Validator NULL_VALIDATOR = >+ protected static Validator NULL_VALIDATOR = > new Validator() > { > public boolean isValid(EStructuralFeature eStructuralFeature) >@@ -1516,7 +1519,7 @@ > } > else > { >- BasicExtendedMetaData.EStructuralFeatureExtendedMetaData.Holder holder = >+ BasicExtendedMetaData.EStructuralFeatureExtendedMetaData.Holder holder = > (BasicExtendedMetaData.EStructuralFeatureExtendedMetaData.Holder)eStructuralFeature; > BasicExtendedMetaData.EStructuralFeatureExtendedMetaData extendedMetaData = holder.getExtendedMetaData(); > if (extendedMetaData == null) >@@ -1560,8 +1563,8 @@ > else > { > int affiliationUpperBound = affiliation.getUpperBound(); >- return >- (affiliationUpperBound > 1 || affiliationUpperBound == ETypedElement.UNBOUNDED_MULTIPLICITY) && >+ return >+ (affiliationUpperBound > 1 || affiliationUpperBound == ETypedElement.UNBOUNDED_MULTIPLICITY) && > ExtendedMetaData.INSTANCE.getFeatureKind(affiliation) != ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE; > } > } >Index: src/org/eclipse/emf/ecore/util/ECrossReferenceAdapter.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/ECrossReferenceAdapter.java,v >retrieving revision 1.17.2.3 >diff -u -r1.17.2.3 ECrossReferenceAdapter.java >--- src/org/eclipse/emf/ecore/util/ECrossReferenceAdapter.java 5 Jun 2007 10:46:30 -0000 1.17.2.3 >+++ src/org/eclipse/emf/ecore/util/ECrossReferenceAdapter.java 16 Nov 2007 07:20:53 -0000 >@@ -235,29 +235,31 @@ > { > // This should be the same as the logic in ResourceImpl.getEObject(String). > // >- String fragment = uri.fragment(); >- if (fragment != null) >- { >- int length = fragment.length(); >- if (length > 0 && fragment.charAt(0) != '/' && fragment.charAt(length - 1) == '?') >- { >- int index = fragment.lastIndexOf('?', length - 2); >- if (index > 0) >- { >- uri = uri.trimFragment().appendFragment(fragment.substring(0, index)); >- } >- } >- } >- Resource resourceContext = objectContext.eResource(); >- if (resourceContext != null) >- { >- ResourceSet resourceSetContext = resourceContext.getResourceSet(); >- if (resourceSetContext != null) >- { >- return resourceSetContext.getURIConverter().normalize(uri); >- } >- } >- return uri; >+ throw new UnsupportedOperationException(); >+//FIXME GWT CHANGE >+// String fragment = uri.fragment(); >+// if (fragment != null) >+// { >+// int length = fragment.length(); >+// if (length > 0 && fragment.charAt(0) != '/' && fragment.charAt(length - 1) == '?') >+// { >+// int index = fragment.lastIndexOf('?', length - 2); >+// if (index > 0) >+// { >+// uri = uri.trimFragment().appendFragment(fragment.substring(0, index)); >+// } >+// } >+// } >+// Resource resourceContext = objectContext.eResource(); >+// if (resourceContext != null) >+// { >+// ResourceSet resourceSetContext = resourceContext.getResourceSet(); >+// if (resourceSetContext != null) >+// { >+// return resourceSetContext.getURIConverter().normalize(uri); >+// } >+// } >+// return uri; > } > > protected boolean resolve() >@@ -357,7 +359,9 @@ > ResourceSet resourceSet = resource.getResourceSet(); > if (resourceSet != null) > { >- uri = resourceSet.getURIConverter().normalize(uri); >+ throw new UnsupportedOperationException(); >+//FIXME GWT CHANGE >+// uri = resourceSet.getURIConverter().normalize(uri); > } > uri = uri.appendFragment(resource.getURIFragment(eObject)); > } >Index: src/org/eclipse/emf/ecore/util/EcoreEList.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/EcoreEList.java,v >retrieving revision 1.9.2.2 >diff -u -r1.9.2.2 EcoreEList.java >--- src/org/eclipse/emf/ecore/util/EcoreEList.java 10 Jul 2007 19:44:10 -0000 1.9.2.2 >+++ src/org/eclipse/emf/ecore/util/EcoreEList.java 16 Nov 2007 07:20:53 -0000 >@@ -16,8 +16,8 @@ > */ > package org.eclipse.emf.ecore.util; > >- >-import java.lang.reflect.Array; >+//XXX GWT CHANGE No Reflection >+//import java.lang.reflect.Array; > import java.util.Iterator; > import java.util.List; > import java.util.ListIterator; >@@ -51,7 +51,8 @@ > > protected Object [] newData(int capacity) > { >- return (Object [])Array.newInstance(dataClass, capacity); >+//FIXME GWT CHANGE No Reflection >+ return (Object [])new Object[capacity]; > } > > protected Object validate(int index, Object object) >@@ -66,7 +67,9 @@ > > protected boolean isInstance(Object object) > { >- return dataClass.isInstance(object); >+ return true; >+//FIXME GWT CHANGE No Reflection >+// return dataClass.isInstance(object); > } > > public Object getNotifier() >Index: src/org/eclipse/emf/ecore/util/EObjectValidator.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/EObjectValidator.java,v >retrieving revision 1.15 >diff -u -r1.15 EObjectValidator.java >--- src/org/eclipse/emf/ecore/util/EObjectValidator.java 20 Jan 2006 16:17:51 -0000 1.15 >+++ src/org/eclipse/emf/ecore/util/EObjectValidator.java 16 Nov 2007 07:20:53 -0000 >@@ -25,7 +25,8 @@ > import java.util.ListIterator; > import java.util.Map; > >-import java.math.BigDecimal; >+//GWT CHANGE No Big-Values >+//import java.math.BigDecimal; > > import org.eclipse.emf.common.util.BasicDiagnostic; > import org.eclipse.emf.common.util.Diagnostic; >@@ -800,24 +801,24 @@ > result = false; > } > } >- >- if (effectiveTotalDigits != -1) >- { >- if (value instanceof BigDecimal && ((BigDecimal)value).unscaledValue().abs().toString().length() > effectiveTotalDigits) >- { >- if (diagnostics != null) reportTotalDigitsViolation(eDataType, value, effectiveTotalDigits, diagnostics, context); >- result = false; >- } >- } >- >- if (effectiveFractionDigits != -1) >- { >- if (value instanceof BigDecimal && ((BigDecimal)value).scale() > effectiveFractionDigits) >- { >- if (diagnostics != null) reportFractionDigitsViolation(eDataType, value, effectiveFractionDigits, diagnostics, context); >- result = false; >- } >- } >+//FIXME NO Big-Values >+// if (effectiveTotalDigits != -1) >+// { >+// if (value instanceof BigDecimal && ((BigDecimal)value).unscaledValue().abs().toString().length() > effectiveTotalDigits) >+// { >+// if (diagnostics != null) reportTotalDigitsViolation(eDataType, value, effectiveTotalDigits, diagnostics, context); >+// result = false; >+// } >+// } >+// >+// if (effectiveFractionDigits != -1) >+// { >+// if (value instanceof BigDecimal && ((BigDecimal)value).scale() > effectiveFractionDigits) >+// { >+// if (diagnostics != null) reportFractionDigitsViolation(eDataType, value, effectiveFractionDigits, diagnostics, context); >+// result = false; >+// } >+// } > > if (itemType != null) > { >Index: src/org/eclipse/emf/ecore/plugin/GeneratedPackageRegistryReader.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/plugin/GeneratedPackageRegistryReader.java >diff -N src/org/eclipse/emf/ecore/plugin/GeneratedPackageRegistryReader.java >--- src/org/eclipse/emf/ecore/plugin/GeneratedPackageRegistryReader.java 25 May 2006 19:17:08 -0000 1.7 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,98 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: GeneratedPackageRegistryReader.java,v 1.7 2006/05/25 19:17:08 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.plugin; >- >- >-import java.util.Map; >- >-import org.eclipse.core.runtime.IConfigurationElement; >-import org.eclipse.core.runtime.Platform; >- >-import org.eclipse.emf.common.util.URI; >-import org.eclipse.emf.ecore.EPackage; >- >-/** >- * A plugin extension reader that populates the >- * {@link org.eclipse.emf.ecore.EPackage.Registry#INSTANCE global} package registry. >- * Clients are not expected to use this class directly. >- */ >-class GeneratedPackageRegistryReader extends RegistryReader >-{ >- static final String TAG_PACKAGE = "package"; >- static final String ATT_URI = "uri"; >- static final String ATT_CLASS = "class"; >- static final String ATT_GEN_MODEL = "genModel"; >- >- protected Map ePackageNsURIToGenModelLocationMap; >- >- public GeneratedPackageRegistryReader() >- { >- super >- (Platform.getExtensionRegistry(), >- EcorePlugin.getPlugin().getBundle().getSymbolicName(), >- EcorePlugin.GENERATED_PACKAGE_PPID); >- } >- >- public GeneratedPackageRegistryReader(Map ePackageNsURIToGenModelLocationMap) >- { >- this(); >- this.ePackageNsURIToGenModelLocationMap = ePackageNsURIToGenModelLocationMap; >- } >- >- protected boolean readElement(IConfigurationElement element) >- { >- if (element.getName().equals(TAG_PACKAGE)) >- { >- String packageURI = element.getAttribute(ATT_URI); >- if (packageURI == null) >- { >- logMissingAttribute(element, ATT_URI); >- } >- else if (element.getAttribute(ATT_CLASS) == null) >- { >- logMissingAttribute(element, ATT_CLASS); >- } >- else >- { >- Object previous = EPackage.Registry.INSTANCE.put(packageURI, new EPackageDescriptor(element, ATT_CLASS)); >- if (previous instanceof PluginClassDescriptor) >- { >- PluginClassDescriptor descriptor = (PluginClassDescriptor)previous; >- EcorePlugin.INSTANCE.log >- ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a package for '" + packageURI + "'"); >- } >- >- if (ePackageNsURIToGenModelLocationMap != null) >- { >- String genModel = element.getAttribute(ATT_GEN_MODEL); >- if (genModel != null) >- { >- URI genModelURI = URI.createURI(genModel); >- if (genModelURI.isRelative()) >- { >- genModelURI = URI.createURI("platform:/plugin/" + element.getDeclaringExtension().getContributor().getName() + "/" + genModel); >- } >- ePackageNsURIToGenModelLocationMap.put(packageURI, genModelURI); >- } >- } >- return true; >- } >- } >- >- return false; >- } >-} >Index: src/org/eclipse/emf/ecore/plugin/ExtensionParserRegistryReader.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/plugin/ExtensionParserRegistryReader.java >diff -N src/org/eclipse/emf/ecore/plugin/ExtensionParserRegistryReader.java >--- src/org/eclipse/emf/ecore/plugin/ExtensionParserRegistryReader.java 25 May 2006 19:17:08 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,73 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: ExtensionParserRegistryReader.java,v 1.5 2006/05/25 19:17:08 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.plugin; >- >- >-import org.eclipse.core.runtime.IConfigurationElement; >-import org.eclipse.core.runtime.Platform; >- >-import org.eclipse.emf.ecore.resource.Resource; >- >- >-/** >- * A plugin extension reader that populates the >- * {@link org.eclipse.emf.ecore.resource.Resource.Factory.Registry#INSTANCE global} resource factory's >- * {@link org.eclipse.emf.ecore.resource.Resource.Factory.Registry#getExtensionToFactoryMap() extension} map. >- * Clients are not expected to use this class directly. >- */ >-class ExtensionParserRegistryReader extends RegistryReader >-{ >- static final String TAG_PARSER = "parser"; >- static final String ATT_TYPE = "type"; >- static final String ATT_CLASS = "class"; >- >- public ExtensionParserRegistryReader() >- { >- super >- (Platform.getExtensionRegistry(), >- EcorePlugin.getPlugin().getBundle().getSymbolicName(), >- EcorePlugin.EXTENSION_PARSER_PPID); >- } >- >- protected boolean readElement(IConfigurationElement element) >- { >- if (element.getName().equals(TAG_PARSER)) >- { >- String type = element.getAttribute(ATT_TYPE); >- if (type == null) >- { >- logMissingAttribute(element, ATT_TYPE); >- } >- else if (element.getAttribute(ATT_CLASS) == null) >- { >- logMissingAttribute(element, ATT_CLASS); >- } >- else >- { >- Object previous = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(type, new ResourceFactoryDescriptor(element, ATT_CLASS)); >- if (previous instanceof ResourceFactoryDescriptor) >- { >- ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous; >- EcorePlugin.INSTANCE.log >- ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register an extension parser for '" + type + "'"); >- } >- return true; >- } >- } >- return false; >- } >-} >Index: src/org/eclipse/emf/ecore/plugin/EcorePlugin.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/plugin/EcorePlugin.java,v >retrieving revision 1.14.2.1 >diff -u -r1.14.2.1 EcorePlugin.java >--- src/org/eclipse/emf/ecore/plugin/EcorePlugin.java 10 May 2007 17:29:50 -0000 1.14.2.1 >+++ src/org/eclipse/emf/ecore/plugin/EcorePlugin.java 16 Nov 2007 07:20:52 -0000 >@@ -1,614 +1,28 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2006 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: EcorePlugin.java,v 1.14.2.1 2007/05/10 17:29:50 emerks Exp $ >- */ > package org.eclipse.emf.ecore.plugin; > >-import java.io.File; >-import java.io.IOException; >-import java.io.InputStream; >-import java.util.Collection; >-import java.util.HashMap; >-import java.util.HashSet; >-import java.util.Iterator; >-import java.util.Map; >- >-import javax.xml.parsers.SAXParser; >-import javax.xml.parsers.SAXParserFactory; >- >-import org.osgi.framework.BundleContext; >-import org.xml.sax.Attributes; >-import org.xml.sax.InputSource; >-import org.xml.sax.SAXException; >-import org.xml.sax.helpers.DefaultHandler; >- >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.resources.IProject; >-import org.eclipse.core.resources.IWorkspaceRoot; >-import org.eclipse.core.resources.ResourcesPlugin; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IConfigurationElement; >-import org.eclipse.core.runtime.Platform; >- >-import org.eclipse.emf.common.EMFPlugin; > import org.eclipse.emf.common.util.ResourceLocator; >-import org.eclipse.emf.common.util.URI; >-import org.eclipse.emf.common.util.WrappedException; > import org.eclipse.emf.ecore.EPackage; >-import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; >-import org.eclipse.emf.ecore.xml.type.internal.RegEx; >- >- >-/** >- * A collection of platform-neutral static utilities >- * as well as Eclipse support utilities. >- */ >-public class EcorePlugin extends EMFPlugin >-{ >- /** >- * The singleton instance of the plugin. >- */ >- public static final EcorePlugin INSTANCE = new EcorePlugin(); >- >- /** >- * Creates the singleton instance. >- */ >- private EcorePlugin() >- { >- super(new ResourceLocator[] {}); >- } >- >- /* >- * Javadoc copied from base class. >- */ >- public ResourceLocator getPluginResourceLocator() >- { >- return plugin; >- } >- >- /** >- * Returns the platform resource map. >- * <p> >- * This map is from {@link String} to {@link URI}. >- * It is the logical equivalent of the map implied by an {@link IWorkspaceRoot}: >- * I.e., each entry in the map corresponds to >- * an {@link org.eclipse.core.resources.IProject} >- * that has a {@link org.eclipse.core.resources.IResource#getName name} >- * and a location {@link org.eclipse.core.resources.IResource#getLocation location}; >- * the name is the key >- * and the location, interpretted as a {@link URI#createFileURI file URI}, is the value. >- * This map is used to {@link #resolvePlatformResourcePath resolve} a platform resource path, >- * and thereby supports relocatable projects in a manner that is transparently the same as an Eclipse workspace. >- * </p> >- * @return the platform resource map. >- * @see #resolvePlatformResourcePath >- */ >- public static Map getPlatformResourceMap() >- { >- if (platformResourceMap == null) >- { >- platformResourceMap = new HashMap(); >- } >- return platformResourceMap; >- } >- >- /** >- * Resolves a platform resource path of the form <code>"/project/path"</code> >- * against the platform resource map. >- * <p> >- * The first segment of the path, i.e., the <em>project name</em>, >- * is used to get a URI from the {@link #getPlatformResourceMap() map}. >- * If a URI results, the remaining segments are {@link URI#resolve resolved} against it >- * and that is the result. >- * Otherwise, the result is <code>null</code>. >- * For example, given this mapping >- *<pre> >- * EcoreUtil.getPlatformResourceMap().put >- * ("project", URI.createURI("file:///C:/location/")); >- *</pre> >- * the following transformation would result: >- *<pre> >- * /project/directory/file >- * -> >- * file:///C:/location/directory/file >- *</pre> >- * </p> >- * @return the resolved URI or <code>null</code>. >- */ >- public static URI resolvePlatformResourcePath(String platformResourcePath) >- { >- if (platformResourceMap != null) >- { >- int index = platformResourcePath.indexOf("/", 1); >- String rootContainerName = platformResourcePath.substring(1, index); >- String relativeName = platformResourcePath.substring(index + 1); >- URI rootContainerLocation = (URI)getPlatformResourceMap().get(rootContainerName); >- if (rootContainerLocation != null) >- { >- return URI.createURI(relativeName).resolve(rootContainerLocation); >- } >- } >- return null; >- } >- >- /** >- * Handles recognized platform resource arguments and returns the stripped result. >- * <p> >- * Recognized arguments are of this form: >- *<pre> >- * -platformResource ( <project-name> <file-or-URI> )+ >- *</pre> >- * E.g., This these arguments >- *<pre> >- * -platformResource project file:///C:/location/ >- *</pre> >- * will produce this effect: >- *<pre> >- * EcoreUtil.getPlatformResourceMap().put >- * ("project", URI.createURI("file:///C:/location/")); >- *</pre> >- * This mechanism supports relocatable projects outside of Eclipse. >- * </p> >- * @param arguments an array of "command line" options. >- * @return the arguments stripped of those recognized as platform resource options. >- */ >- public static String [] handlePlatformResourceOptions(String [] arguments) >- { >- getPlatformResourceMap(); >- >- for (int i = 0; i < arguments.length; ++i) >- { >- if (arguments[i].equalsIgnoreCase("-platformResource")) >- { >- int start = i; >- while (++i < arguments.length && !arguments[i].startsWith("-")) >- { >- String rootContainerName = arguments[i]; >- if (++i < arguments.length) >- { >- String rootContainerLocation = arguments[i]; >- >- // This let's us test whether the string exists as a file. >- // If not, we try as a URI. >- // >- URI uri; >- File file = new File(rootContainerLocation); >- if (file.isDirectory() || !file.exists() && file.getParent() != null && file.getParentFile().isDirectory()) >- { >- try >- { >- file = file.getCanonicalFile(); >- } >- catch (IOException exception) >- { >- throw new WrappedException(exception); >- } >- uri = URI.createFileURI(file.toString() + "/"); >- } >- else >- { >- uri = URI.createURI(rootContainerLocation); >- } >- >- platformResourceMap.put(rootContainerName, uri); >- } >- } >- >- String [] remainingArguments = new String [arguments.length - (i - start)]; >- System.arraycopy(arguments, 0, remainingArguments, 0, start); >- System.arraycopy(arguments, i, remainingArguments, start, arguments.length - i); >- return remainingArguments; >- } >- } >- >- return arguments; >- } >- >- /** >- * Returns a map from {@link EPackage#getNsURI() package namespace URI} (represented as a String) >- * to the location of the GenModel containing a GenPackage for the package (represented as a {@link URI URI}). >- * @return a map from package namespace to GenModel location. >- */ >- public static Map getEPackageNsURIToGenModelLocationMap() >- { >- if (ePackageNsURIToGenModelLocationMap == null) >- { >- ePackageNsURIToGenModelLocationMap = new HashMap(); >- } >- return ePackageNsURIToGenModelLocationMap; >- } >- >- /** >- * Computes a map from <code>platform:/resource/<plugin-location>/</code> {@link URI} to >- * <code>platform:/plugin/<plugin-id>/</code> URI >- * for each URI in the collection of the form <code>platform:/plugin/<plugin-id>/...</code>. >- * This allows each plugin to be {@link org.eclipse.emf.ecore.resource.URIConverter#getURIMap() treated} >- * as if it were a project in the workspace. >- * If the workspace already contains a project for the plugin location, no mapping is produced. >- * @return a map from workspace URIs to plugin URIs. >- * @param uris a collections of {@link URI}s. >- * @return a map from platform resource URI to platform plugin URI. >- */ >- public static Map computePlatformResourceToPlatformPluginMap(Collection uris) >- { >- Map result = new HashMap(); >- IWorkspaceRoot root = getWorkspaceRoot(); >- if (root != null) >- { >- for (Iterator i = uris.iterator(); i.hasNext(); ) >- { >- URI uri = (URI)i.next(); >- if ("platform".equals(uri.scheme()) && uri.segmentCount() > 1 && "plugin".equals(uri.segment(0))) >- { >- String pluginID = uri.segment(1); >- if (!root.getProject(pluginID).isOpen()) >- { >- result.put(URI.createPlatformResourceURI(pluginID + "/"), URI.createURI("platform:/plugin/" + pluginID + "/")); >- } >- } >- } >- } >- return result; >- } >- >- private static RegEx.RegularExpression bundleSymbolNamePattern; >- private static byte [] NO_BYTES = new byte [0]; >- >- /** >- * Computes a map from <code>platform:/plugin/<plugin-id>/</code> {@link URI} to >- * <code>platform:/resource/<plugin-location>/</code> URI >- * for each plugin project in the workspace. >- * This allows each plugin from the runtime to be {@link org.eclipse.emf.ecore.resource.URIConverter#getURIMap() redirected} >- * to its active version in the workspace. >- * @return a map from plugin URIs to resource URIs. >- * @see org.eclipse.emf.ecore.resource.URIConverter#getURIMap() >- * @see URI >- */ >- public static Map computePlatformPluginToPlatformResourceMap() >- { >- Map result = new HashMap(); >- IWorkspaceRoot root = getWorkspaceRoot(); >- if (root != null) >- { >- IProject [] projects = root.getProjects(); >- if (projects != null) >- { >- String pluginID = null; >- >- class Handler extends DefaultHandler >- { >- public String pluginID; >- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException >- { >- if ("".equals(uri) && "plugin".equals(localName)) >- { >- pluginID = attributes.getValue("id"); >- } >- throw new SAXException("Done"); >- } >- }; >- Handler handler = new Handler(); >- >- SAXParserFactory parserFactory= SAXParserFactory.newInstance(); >- parserFactory.setNamespaceAware(true); >- SAXParser parser = null; >- >- try >- { >- parser = parserFactory.newSAXParser(); >- } >- catch (Exception exception) >- { >- INSTANCE.log(exception); >- } >- >- if (bundleSymbolNamePattern == null) >- { >- bundleSymbolNamePattern = new RegEx.RegularExpression("^\\s*Bundle-SymbolicName\\s*:\\s*([^\\s;]*)\\s*(;.*)?$", "m"); >- } >- >- byte [] bytes = NO_BYTES; >- >- for (int i = 0, size = projects.length; i < size; ++i) >- { >- IProject project = projects[i]; >- if (project.isOpen()) >- { >- pluginID = null; >- IFile manifest = project.getFile("META-INF/MANIFEST.MF"); >- if (manifest.exists()) >- { >- try >- { >- InputStream inputStream = manifest.getContents(); >- int available = inputStream.available(); >- if (bytes.length < available) >- { >- bytes = new byte [available]; >- } >- inputStream.read(bytes); >- String contents = new String(bytes, "UTF-8"); >- RegEx.Match match = new RegEx.Match(); >- if (bundleSymbolNamePattern.matches(contents, match)) >- { >- pluginID = match.getCapturedText(1); >- } >- } >- catch (Exception exception) >- { >- EcorePlugin.INSTANCE.log(exception); >- } >- } >- else if (parser != null) >- { >- final IFile plugin = project.getFile("plugin.xml"); >- if (plugin.exists()) >- { >- try >- { >- parser.parse(new InputSource(plugin.getContents()), handler); >- } >- catch (Exception exception) >- { >- if (handler.pluginID != null) >- { >- pluginID = handler.pluginID; >- } >- else >- { >- INSTANCE.log(exception); >- } >- } >- } >- } >- >- if (pluginID != null) >- { >- URI platformPluginURI = URI.createURI("platform:/plugin/" + pluginID + "/"); >- URI platformResourceURI = URI.createPlatformResourceURI(project.getName() + "/"); >- result.put(platformPluginURI, platformResourceURI); >- } >- } >- } >- } >- } >- >- return result; >- } >- >- /** >- * Computes a map so that plugins in the workspace will override those in the environment >- * and so that plugins with Ecore and GenModels will look like projects in the workspace. >- * It's implemented like this: >- *<pre> >- * Map result = new HashMap(); >- * result.putAll(computePlatformPluginToPlatformResourceMap()); >- * result.putAll(computePlatformResourceToPlatformPluginMap(new HashSet(EcorePlugin.getEPackageNsURIToGenModelLocationMap().values()))); >- * return result; >- *</pre> >- * @return computes a map so that plugins in the workspace will override those in the environment >- * and so that plugins with Ecore and GenModels will look like projects in the workspace. >- * @see org.eclipse.emf.ecore.resource.URIConverter#getURIMap() >- * @see URI >- * @see #computePlatformPluginToPlatformResourceMap() >- * @see #computePlatformResourceToPlatformPluginMap(Collection) >- */ >- public static Map computePlatformURIMap() >- { >- Map result = new HashMap(); >- result.putAll(computePlatformPluginToPlatformResourceMap()); >- result.putAll(computePlatformResourceToPlatformPluginMap(new HashSet(EcorePlugin.getEPackageNsURIToGenModelLocationMap().values()))); >- return result; >- } >- >- /** >- * The platform resource map. >- * @see #getPlatformResourceMap >- */ >- private static Map platformResourceMap; >- >- /** >- * The map fro >- * @see #getPlatformResourceMap >- */ >- private static Map ePackageNsURIToGenModelLocationMap; >- >- /** >- * A plugin implementation that handles Ecore plugin registration. >- * @see #startup >- */ >- static public class Implementation extends EclipsePlugin >- { >- /** >- * Creates the singleton instance. >- */ >- public Implementation() >- { >- super(); >- plugin = this; >- } >- >- /** >- * Starts up this plugin by reading some extensions and populating the relevant registries. >- * <p> >- * The {@link org.eclipse.emf.ecore.EPackage.Registry#INSTANCE global} package registry >- * is populated by plugin registration of the form: >- *<pre> >- * <extension point="org.eclipse.emf.ecore.generated_package" > >- * <package uri="http://www.example.org/abc/Abc.ecore" class="org.example.abc.AbcPackage"/> >- * <extension> >- *</pre> >- * </p> >- * The URI is arbitrary but an absolute URI is recommended. >- * Provision for access to the serialized model via <code>"http:"</code> is encouraged. >- * <p> >- * The {@link org.eclipse.emf.ecore.resource.Resource.Factory.Registry#INSTANCE global} resource factory registry's >- * {@link org.eclipse.emf.ecore.resource.Resource.Factory.Registry#getExtensionToFactoryMap() extension} map >- * is populated by plugin registration of the form: >- *<pre> >- * <extension point="org.eclipse.emf.ecore.extension_parser"> >- * <parser type="abc" class="org.example.abc.util.AbcResourceFactoryImpl"/> >- * <extension> >- *</pre> >- * </p> >- * <p> >- * The {@link org.eclipse.emf.ecore.resource.Resource.Factory.Registry#INSTANCE global} resource factory registry's >- * {@link org.eclipse.emf.ecore.resource.Resource.Factory.Registry#getProtocolToFactoryMap() protocol} map >- * is populated by plugin registration of the form: >- *<pre> >- * <extension point="org.eclipse.emf.ecore.protocol_parser" > >- * <parser protocolName="abc" class="org.example.abc.util.AbcResourceFactoryImpl"/> >- * <extension> >- *</pre> >- * </p> >- * <p> >- * The {@link org.eclipse.emf.ecore.resource.URIConverter#URI_MAP global} URI map >- * is populated by plugin registration of the form: >- *<pre> >- * <extension point="org.eclipse.emf.ecore.uri_mapping" > >- * <mapping source="//special/" target="special/"/> >- * <extension> >- *</pre> >- * If the target is relative, it is resolved against the plugin's installed location, >- * resulting in a URI of the form: >- *<pre> >- * platform:/plugin/plugin-name_1.2.3/... >- *</pre> >- * The above registration would map >- *<pre> >- * //special/a/b.c >- *</pre> >- * to >- *<pre> >- * platform:/plugin/plugin-name_1.2.3/special/a/b.c >- *</pre> >- * </p> >- * @throws Exception if there is a show stopping problem. >- */ >- public void start(BundleContext context) throws Exception >- { >- super.start(context); >- >- if (System.getProperty("org.eclipse.emf.ecore.plugin.EcorePlugin.doNotLoadResourcesPlugin") == null && >- Platform.getBundle("org.eclipse.core.resources") != null) >- { >- workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); >- } >- >- new RegistryReader >- (Platform.getExtensionRegistry(), >- EcorePlugin.getPlugin().getBundle().getSymbolicName(), >- PACKAGE_REGISTRY_IMPLEMENTATION) >- { >- IConfigurationElement previous; >- >- protected boolean readElement(IConfigurationElement element) >- { >- if (element.getName().equals("registry")) >- { >- String implementationClass = element.getAttribute("class"); >- if (implementationClass == null) >- { >- logMissingAttribute(element, "class"); >- } >- else >- { >- if (defaultRegistryImplementation != null) >- { >- if (previous != null) >- { >- log("Both '" + previous.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a package registry implementation"); >- } >- if (defaultRegistryImplementation instanceof EPackageRegistryImpl.Delegator) >- { >- return false; >- } >- } >- try >- { >- defaultRegistryImplementation = (EPackage.Registry)element.createExecutableExtension("class"); >- previous = element; >- } >- catch (CoreException exception) >- { >- log(exception); >- } >- return true; >- } >- } >- return false; >- } >- >- }.readRegistry(); >- >- new GeneratedPackageRegistryReader(getEPackageNsURIToGenModelLocationMap()).readRegistry(); >- new FactoryOverrideRegistryReader().readRegistry(); >- new ExtensionParserRegistryReader().readRegistry(); >- new ProtocolParserRegistryReader().readRegistry(); >- new URIMappingRegistryReader().readRegistry(); >- } >- } > >- /** >- * The default registry implementation singleton. >- */ >- private static EPackage.Registry defaultRegistryImplementation; >+public class EcorePlugin implements ResourceLocator { > >- /** >- * Returns the default registry implementation singleton. >- * @return the default registry implementation singleton. >- */ >- public static EPackage.Registry getDefaultRegistryImplementation() >- { >- return defaultRegistryImplementation; >- } >+ public static final EcorePlugin INSTANCE = new EcorePlugin(); > >- /** >- * Returns the Eclipse plugin singleton. >- * @return the plugin singleton. >- */ >- public static Implementation getPlugin() >- { >- return plugin; >- } >+ public void log(Exception exception) { >+ exception.printStackTrace(); >+ System.err.println(exception.toString()); >+ } > >- /** >- * The plugin singleton >- */ >- private static Implementation plugin; >+ public String getString(String key) { >+ return key; >+ } > >- /** >- * The workspace root. >- * @see #getWorkspaceRoot >- */ >- private static IWorkspaceRoot workspaceRoot; >+ public String getString(String string, Object[] objects) { >+ return string; >+ } > >- /** >- * Returns the workspace root, or <code>null</code>, if the runtime environment is stand-alone. >- * @return the workspace root, or <code>null</code>. >- */ >- public static IWorkspaceRoot getWorkspaceRoot() >- { >- return workspaceRoot; >- } >+ public static EPackage.Registry getDefaultRegistryImplementation() { >+ // TODO Auto-generated method stub >+ return null; >+ } > >- static final String GENERATED_PACKAGE_PPID = "generated_package"; >- static final String FACTORY_OVERRIDE_PPID = "factory_override"; >- static final String EXTENSION_PARSER_PPID = "extension_parser"; >- static final String PROTOCOL_PARSER_PPID = "protocol_parser"; >- static final String SCHEME_PARSER_PPID = "scheme_parser"; >- static final String URI_MAPPING_PPID = "uri_mapping"; >- static final String PACKAGE_REGISTRY_IMPLEMENTATION = "package_registry_implementation"; >-} >\ No newline at end of file >+} >Index: src/org/eclipse/emf/ecore/plugin/FactoryOverrideRegistryReader.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/plugin/FactoryOverrideRegistryReader.java >diff -N src/org/eclipse/emf/ecore/plugin/FactoryOverrideRegistryReader.java >--- src/org/eclipse/emf/ecore/plugin/FactoryOverrideRegistryReader.java 25 May 2006 19:17:08 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,77 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: FactoryOverrideRegistryReader.java,v 1.3 2006/05/25 19:17:08 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.plugin; >- >- >-import org.eclipse.core.runtime.IConfigurationElement; >-import org.eclipse.core.runtime.Platform; >- >-import org.eclipse.emf.ecore.EPackage; >- >- >-/** >- * A plugin extension reader that populates the >- * {@link org.eclipse.emf.ecore.EPackage.Registry#INSTANCE global} package registry. >- * Clients are not expected to use this class directly. >- */ >-class FactoryOverrideRegistryReader extends RegistryReader >-{ >- static final String TAG_FACTORY = "factory"; >- static final String ATT_URI = "uri"; >- static final String ATT_CLASS = "class"; >- >- public FactoryOverrideRegistryReader() >- { >- super >- (Platform.getExtensionRegistry(), >- EcorePlugin.getPlugin().getBundle().getSymbolicName(), >- EcorePlugin.FACTORY_OVERRIDE_PPID); >- } >- >- protected boolean readElement(IConfigurationElement element) >- { >- if (element.getName().equals(TAG_FACTORY)) >- { >- String packageURI = element.getAttribute(ATT_URI); >- if (packageURI == null) >- { >- logMissingAttribute(element, ATT_URI); >- } >- else if (element.getAttribute(ATT_CLASS) == null) >- { >- logMissingAttribute(element, ATT_CLASS); >- } >- else >- { >- Object ePackageDescriptor = EPackage.Registry.INSTANCE.get(packageURI); >- if (ePackageDescriptor instanceof EPackage.Descriptor) >- { >- EPackage.Registry.INSTANCE.put(packageURI, new EFactoryDescriptor(element, ATT_CLASS, (EPackage.Descriptor)ePackageDescriptor)); >- if (ePackageDescriptor instanceof EFactoryDescriptor) >- { >- EFactoryDescriptor descriptor = (EFactoryDescriptor)ePackageDescriptor; >- EcorePlugin.INSTANCE.log >- ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a factory override for '" + packageURI + "'"); >- } >- } >- return true; >- } >- } >- >- return false; >- } >-} >Index: src/org/eclipse/emf/ecore/plugin/ProtocolParserRegistryReader.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/plugin/ProtocolParserRegistryReader.java >diff -N src/org/eclipse/emf/ecore/plugin/ProtocolParserRegistryReader.java >--- src/org/eclipse/emf/ecore/plugin/ProtocolParserRegistryReader.java 25 May 2006 19:17:08 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,74 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: ProtocolParserRegistryReader.java,v 1.5 2006/05/25 19:17:08 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.plugin; >- >- >-import org.eclipse.core.runtime.IConfigurationElement; >-import org.eclipse.core.runtime.Platform; >- >-import org.eclipse.emf.ecore.resource.Resource; >- >- >-/** >- * A plugin extension reader that populates the >- * {@link org.eclipse.emf.ecore.resource.Resource.Factory.Registry#INSTANCE global} resource factory's >- * {@link org.eclipse.emf.ecore.resource.Resource.Factory.Registry#getProtocolToFactoryMap() protocol} map. >- * Clients are not expected to use this class directly. >- */ >-class ProtocolParserRegistryReader extends RegistryReader >-{ >- static final String TAG_PARSER = "parser"; >- static final String ATT_PROTOCOLNAME = "protocolName"; >- static final String ATT_CLASS = "class"; >- >- public ProtocolParserRegistryReader() >- { >- super >- (Platform.getExtensionRegistry(), >- EcorePlugin.getPlugin().getBundle().getSymbolicName(), >- EcorePlugin.PROTOCOL_PARSER_PPID); >- } >- >- protected boolean readElement(IConfigurationElement element) >- { >- if (element.getName().equals(TAG_PARSER)) >- { >- String protocolName = element.getAttribute(ATT_PROTOCOLNAME); >- if (protocolName == null) >- { >- logMissingAttribute(element, ATT_PROTOCOLNAME); >- } >- else if (element.getAttribute(ATT_CLASS) == null) >- { >- logMissingAttribute(element, ATT_CLASS); >- } >- else >- { >- Object previous = Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put(protocolName, new ResourceFactoryDescriptor(element, ATT_CLASS)); >- if (previous instanceof ResourceFactoryDescriptor) >- { >- ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous; >- EcorePlugin.INSTANCE.log >- ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a protocol parser for '" + protocolName + "'"); >- } >- return true; >- } >- } >- >- return false; >- } >-} >Index: src/org/eclipse/emf/ecore/plugin/RegistryReader.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/plugin/RegistryReader.java >diff -N src/org/eclipse/emf/ecore/plugin/RegistryReader.java >--- src/org/eclipse/emf/ecore/plugin/RegistryReader.java 22 Feb 2006 22:28:56 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,229 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: RegistryReader.java,v 1.6 2006/02/22 22:28:56 marcelop Exp $ >- */ >-package org.eclipse.emf.ecore.plugin; >- >- >-import java.lang.reflect.Field; >- >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IConfigurationElement; >-import org.eclipse.core.runtime.IExtension; >-import org.eclipse.core.runtime.IExtensionPoint; >-import org.eclipse.core.runtime.IExtensionRegistry; >-import org.eclipse.core.runtime.Platform; >- >-import org.eclipse.emf.common.util.WrappedException; >-import org.eclipse.emf.ecore.EFactory; >-import org.eclipse.emf.ecore.EPackage; >-import org.eclipse.emf.ecore.resource.Resource; >- >- >-public abstract class RegistryReader >-{ >- protected static final String TAG_DESCRIPTION = "description"; >- >- protected IExtensionRegistry pluginRegistry; >- String pluginID; >- String extensionPointID; >- >- public RegistryReader(IExtensionRegistry pluginRegistry, String pluginID, String extensionPointID) >- { >- super(); >- this.pluginRegistry = pluginRegistry; >- this.pluginID = pluginID; >- this.extensionPointID = extensionPointID; >- } >- >- /** >- * Implement this method to read element attributes. >- * If this element has subelements, the reader will recursively cycle through them >- * and will call this method, so don't do it here. >- */ >- protected abstract boolean readElement(IConfigurationElement element); >- >- /** >- * Reads from the plugin registry and parses it. >- */ >- public void readRegistry() >- { >- IExtensionPoint point = pluginRegistry.getExtensionPoint(pluginID, extensionPointID); >- if (point != null) >- { >- IConfigurationElement[] elements = point.getConfigurationElements(); >- for (int i = 0; i < elements.length; i++) >- { >- internalReadElement(elements[i]); >- } >- } >- } >- >- private void internalReadElement(IConfigurationElement element) >- { >- boolean recognized = this.readElement(element); >- if (recognized) >- { >- IConfigurationElement[] children = element.getChildren(); >- for (int i = 0; i < children.length; ++i) >- { >- internalReadElement(children[i]); >- } >- } >- else >- { >- logError(element, "Error processing extension: " + element); >- } >- } >- >- /** >- * Logs the error in the desktop log using the provided >- * text and the information in the configuration element. >- */ >- protected void logError(IConfigurationElement element, String text) >- { >- IExtension extension = element.getDeclaringExtension(); >- System.err.println("Plugin " + extension.getContributor().getName() + ", extension " + extension.getExtensionPointUniqueIdentifier()); >- System.err.println(text); >- } >- >- /** >- * Logs a very common registry error when a required attribute is missing. >- */ >- protected void logMissingAttribute(IConfigurationElement element, String attributeName) >- { >- logError(element, "The required attribute '" + attributeName + "' not defined"); >- } >- >- public static class PluginClassDescriptor >- { >- protected IConfigurationElement element; >- protected String attributeName; >- >- public PluginClassDescriptor(IConfigurationElement element, String attributeName) >- { >- this.element = element; >- this.attributeName = attributeName; >- } >- >- public Object createInstance() >- { >- try >- { >- return element.createExecutableExtension(attributeName); >- } >- catch (CoreException e) >- { >- throw new WrappedException(e); >- } >- } >- } >- >- static class ResourceFactoryDescriptor extends PluginClassDescriptor implements Resource.Factory.Descriptor >- { >- protected Resource.Factory factoryInstance; >- >- public ResourceFactoryDescriptor(IConfigurationElement e, String attrName) >- { >- super(e, attrName); >- } >- >- public Resource.Factory createFactory() >- { >- if (factoryInstance == null) >- { >- factoryInstance = (Resource.Factory)createInstance(); >- } >- return factoryInstance; >- } >- } >- >- static class EPackageDescriptor extends PluginClassDescriptor implements EPackage.Descriptor >- { >- public EPackageDescriptor(IConfigurationElement element, String attributeName) >- { >- super(element, attributeName); >- } >- >- public EPackage getEPackage() >- { >- // First try to see if this class has an eInstance >- // >- try >- { >- Class javaClass = Platform.getBundle(element.getDeclaringExtension().getContributor().getName()).loadClass(element.getAttribute(attributeName)); >- Field field = javaClass.getField("eINSTANCE"); >- Object result = field.get(null); >- return (EPackage)result; >- } >- catch (ClassNotFoundException e) >- { >- throw new WrappedException(e); >- } >- catch (IllegalAccessException e) >- { >- throw new WrappedException(e); >- } >- catch (NoSuchFieldException e) >- { >- throw new WrappedException(e); >- } >- } >- >- public EFactory getEFactory() >- { >- return null; >- } >- } >- >- static class EFactoryDescriptor extends PluginClassDescriptor implements EPackage.Descriptor >- { >- protected EPackage.Descriptor overridenDescriptor; >- >- public EFactoryDescriptor(IConfigurationElement element, String attributeName, EPackage.Descriptor overridenDescriptor) >- { >- super(element, attributeName); >- this.overridenDescriptor = overridenDescriptor; >- } >- >- public EPackage getEPackage() >- { >- return overridenDescriptor.getEPackage(); >- } >- >- public EFactory getEFactory() >- { >- // First try to see if this class has an eInstance >- // >- try >- { >- Class javaClass = Platform.getBundle(element.getDeclaringExtension().getContributor().getName()).loadClass(element.getAttribute(attributeName)); >- return (EFactory)javaClass.newInstance(); >- } >- catch (ClassNotFoundException e) >- { >- throw new WrappedException(e); >- } >- catch (IllegalAccessException e) >- { >- throw new WrappedException(e); >- } >- catch (InstantiationException e) >- { >- throw new WrappedException(e); >- } >- } >- } >-} >Index: src/org/eclipse/emf/ecore/plugin/URIMappingRegistryReader.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/plugin/URIMappingRegistryReader.java >diff -N src/org/eclipse/emf/ecore/plugin/URIMappingRegistryReader.java >--- src/org/eclipse/emf/ecore/plugin/URIMappingRegistryReader.java 25 May 2006 19:17:08 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,91 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: URIMappingRegistryReader.java,v 1.6 2006/05/25 19:17:08 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.plugin; >- >- >-import java.util.HashMap; >-import java.util.Map; >- >-import org.eclipse.core.runtime.IConfigurationElement; >-import org.eclipse.core.runtime.Platform; >- >-import org.eclipse.emf.common.util.URI; >-import org.eclipse.emf.ecore.resource.URIConverter; >- >- >-/** >- * A plugin extension reader that populates the >- * {@link org.eclipse.emf.ecore.resource.URIConverter#URI_MAP global} mapping registry. >- * Clients are not expected to use this class directly. >- */ >-class URIMappingRegistryReader extends RegistryReader >-{ >- static final String TAG_MAPPING = "mapping"; >- static final String ATT_SOURCE = "source"; >- static final String ATT_TARGET = "target"; >- >- protected Map map = new HashMap(); >- >- public URIMappingRegistryReader() >- { >- super >- (Platform.getExtensionRegistry(), >- EcorePlugin.getPlugin().getBundle().getSymbolicName(), >- EcorePlugin.URI_MAPPING_PPID); >- } >- >- protected boolean readElement(IConfigurationElement element) >- { >- if (element.getName().equals(TAG_MAPPING)) >- { >- String sourceURIValue = element.getAttribute(ATT_SOURCE); >- if (sourceURIValue == null) >- { >- logMissingAttribute(element, ATT_SOURCE); >- } >- else >- { >- String targetURIValue = element.getAttribute(ATT_TARGET); >- if (targetURIValue == null) >- { >- logMissingAttribute(element, ATT_TARGET); >- } >- else >- { >- URI sourceURI = URI.createURI(sourceURIValue); >- URI targetURI = URI.createURI(targetURIValue); >- if (targetURI.isRelative() && targetURI.hasRelativePath()) >- { >- targetURI = >- targetURI.resolve >- (URI.createURI >- (Platform.getBundle(element.getDeclaringExtension().getContributor().getName()).getEntry("/").toString())); >- } >- URIConverter.URI_MAP.put(sourceURI, targetURI); >- IConfigurationElement previous = (IConfigurationElement)map.put(sourceURI, element); >- if (previous != null) >- { >- EcorePlugin.INSTANCE.log >- ("Both '" + previous.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a URI mapping for '" + sourceURI + "'"); >- } >- return true; >- } >- } >- } >- return false; >- } >-} >Index: src/org/eclipse/emf/ecore/xml/type/util/XMLTypeUtil.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/xml/type/util/XMLTypeUtil.java,v >retrieving revision 1.8 >diff -u -r1.8 XMLTypeUtil.java >--- src/org/eclipse/emf/ecore/xml/type/util/XMLTypeUtil.java 10 Feb 2006 20:51:22 -0000 1.8 >+++ src/org/eclipse/emf/ecore/xml/type/util/XMLTypeUtil.java 16 Nov 2007 07:20:56 -0000 >@@ -1,261 +1,17 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLTypeUtil.java,v 1.8 2006/02/10 20:51:22 emerks Exp $ >- */ > package org.eclipse.emf.ecore.xml.type.util; > >+import org.eclipse.emf.ecore.EValidator.PatternMatcher; > >-import org.eclipse.emf.ecore.EValidator; >-import org.eclipse.emf.ecore.xml.type.internal.DataValue; >-import org.eclipse.emf.ecore.xml.type.internal.QName; >-import org.eclipse.emf.ecore.xml.type.internal.RegEx; >-import org.eclipse.emf.ecore.xml.type.internal.XMLCalendar; >-import org.eclipse.emf.ecore.xml.type.internal.XMLDuration; >+public class XMLTypeUtil { > >+ public static String normalize(String value, boolean b) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public static PatternMatcher createPatternMatcher(String next) { >+ // TODO Auto-generated method stub >+ return null; >+ } > >-/** >- * This class contains convenient static methods for working with XML-related information. >- */ >-public final class XMLTypeUtil >-{ >- public static final int EQUALS = 0; >- public static final int LESS_THAN = -1; >- public static final int GREATER_THAN = 1; >- public static final int INDETERMINATE = 2; >- >- public static int compareCalendar(Object calendar1, Object calendar2) >- { >- return XMLCalendar.compare((XMLCalendar)calendar1, (XMLCalendar)calendar2); >- } >- >- public static int compareDuration(Object duration1, Object duration2) >- { >- return XMLDuration.compare((XMLDuration)duration1, (XMLDuration)duration2); >- } >- >- public static boolean isSpace(char value) >- { >- return DataValue.XMLChar.isSpace(value); >- } >- >- // TODO >- // This is faster than many charAt() calls. >- // >- private static class CharArrayThreadLocal extends ThreadLocal >- { >- private Thread cachedThread; >- private char [] cachedResult; >- >- public final char [] get(int capacity) >- { >- Thread currentThread = Thread.currentThread(); >- char [] result = cachedResult; >- if (cachedThread != currentThread) >- { >- cachedThread = currentThread; >- result = (char [])get(); >- } >- if (result.length < capacity) >- { >- result = new char [capacity]; >- set(result); >- } >- return cachedResult = result; >- } >- >- protected Object initialValue() >- { >- return new char [20]; >- } >- } >- >- private static final CharArrayThreadLocal VALUE = new CharArrayThreadLocal(); >- >- public static String normalize(String value, boolean collapse) >- { >- if (value == null) >- { >- return null; >- } >- >- int length = value.length(); >- if (length == 0) >- { >- return ""; >- } >- >- char [] valueArray = VALUE.get(length); >- value.getChars(0, length, valueArray, 0); >- StringBuffer buffer = null; >- boolean skipSpace = collapse; >- for (int i = 0, offset = 0; i < length; i++) >- { >- char c = valueArray[i]; >- if (isSpace(c)) >- { >- if (skipSpace) >- { >- if (buffer == null) >- { >- buffer = new StringBuffer(value); >- } >- buffer.deleteCharAt(i - offset++); >- } >- else >- { >- skipSpace = collapse; >- if (c != ' ') >- { >- if (buffer == null) >- { >- buffer = new StringBuffer(value); >- } >- buffer.setCharAt(i - offset, ' '); >- } >- } >- } >- else >- { >- skipSpace = false; >- } >- } >- >- if (skipSpace) >- { >- if (buffer == null) >- { >- return value.substring(0, length - 1); >- } >- else >- { >- length = buffer.length(); >- if (length > 0) >- { >- return buffer.substring(0, length - 1); >- } >- else >- { >- return ""; >- } >- } >- } >- else >- { >- if (buffer == null) >- { >- return value; >- } >- else >- { >- return buffer.toString(); >- } >- } >- } >- >- public static EValidator.PatternMatcher createPatternMatcher(String pattern) >- { >- return new PatternMatcherImpl(pattern); >- } >- >- >- /** >- * Creates a new QName object with the specified values >- * @param namespaceUri namespace uri value or null >- * @param localPart localPart (not null) >- * @param prefix prefix value or null >- * @return The newly created QName object >- */ >- public static Object createQName(String namespaceUri, String localPart, String prefix) >- { >- return new QName(namespaceUri, localPart, prefix); >- } >- >- /** >- * Sets the QName object values to the specified onces >- * @param namespaceUri namespace uri value or null >- * @param localPart localPart (not null) >- * @param prefix prefix value or null >- */ >- public static void setQNameValues(Object qname, String namespaceUri, String localPart, String prefix) >- { >- QName qn = (QName)qname; >- qn.setLocalPart(localPart); >- qn.setNamespaceURI(namespaceUri); >- qn.setPrefix(prefix); >- } >- >- /** >- * Returns the namespaceURI of a QName. >- */ >- public static String getQNameNamespaceURI(Object qname) >- { >- return ((QName)qname).getNamespaceURI(); >- } >- /** >- * Returns the localPart of a QName. >- */ >- public static String getQNameLocalPart(Object qname) >- { >- return ((QName)qname).getLocalPart(); >- } >- >- /** >- * Returns the prefix of a QName. >- */ >- public static String getQNamePrefix(Object qname) >- { >- return ((QName)qname).getPrefix(); >- } >- >- private static class PatternMatcherImpl implements EValidator.PatternMatcher >- { >- protected RegEx.RegularExpression regularExpression; >- >- public PatternMatcherImpl(String pattern) >- { >- regularExpression = new RegEx.RegularExpression(pattern, "X"); >- } >- >- public boolean matches(String value) >- { >- return regularExpression.matches(value); >- } >- >- public String toString() >- { >- return regularExpression.getPattern(); >- } >- } >- >-/* >- public static void main(String args[]) >- { >- System.err.println("###YES"); >- String x1 = normalize(" x ", true); >- String x2 = normalize(" x ", false); >- String x3 = normalize(" x x ", true); >- String x4 = normalize(" x x ", false); >- String x5 = normalize(" x x ", true); >- String x6 = normalize(" x x ", false); >- String x7 = normalize(" x x", true); >- String x8 = normalize(" x x", false); >- String x9 = normalize(" x \n x", true); >- String x10 = normalize(" x \n x", false); >- System.err.println(XMLTypeFactory.eINSTANCE.createFromString(XMLTypePackage.eINSTANCE.getInt(), " 1 ")); >- System.err.println(XMLTypeFactory.eINSTANCE.createFromString(XMLTypePackage.eINSTANCE.getInt(), " 1 \n ")); >- System.err.println("###YES"); >- } >-*/ > } >Index: src/org/eclipse/emf/ecore/xml/type/util/XMLTypeValidator.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/type/util/XMLTypeValidator.java >diff -N src/org/eclipse/emf/ecore/xml/type/util/XMLTypeValidator.java >--- src/org/eclipse/emf/ecore/xml/type/util/XMLTypeValidator.java 23 Nov 2005 18:10:02 -0000 1.9 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,1372 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLTypeValidator.java,v 1.9 2005/11/23 18:10:02 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.xml.type.util; >- >-import java.math.BigDecimal; >-import java.math.BigInteger; >- >-import java.util.Iterator; >-import java.util.List; >-import java.util.Map; >- >-import org.eclipse.emf.common.util.DiagnosticChain; >- >-import org.eclipse.emf.ecore.EPackage; >- >-import org.eclipse.emf.ecore.util.EObjectValidator; >- >-import org.eclipse.emf.ecore.xml.type.*; >- >-/** >- * <!-- begin-user-doc --> >- * The <b>Validator</b> for the model. >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.type.XMLTypePackage >- * @generated >- */ >-public class XMLTypeValidator extends EObjectValidator >-{ >- /** >- * The cached model package >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static final XMLTypeValidator INSTANCE = new XMLTypeValidator(); >- >- /** >- * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.common.util.Diagnostic#getSource() >- * @see org.eclipse.emf.common.util.Diagnostic#getCode() >- * @generated >- */ >- public static final String DIAGNOSTIC_SOURCE = "org.eclipse.emf.ecore.xml.type"; >- >- /** >- * A constant with a fixed name that can be used as the base value for additional hand written constants. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0; >- >- /** >- * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; >- >- /** >- * Creates an instance of the switch. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeValidator() >- { >- super(); >- } >- >- /** >- * Returns the package of this validator switch. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected EPackage getEPackage() >- { >- return XMLTypePackage.eINSTANCE; >- } >- >- /** >- * Calls <code>validateXXX</code> for the corresonding classifier of the model. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map context) >- { >- switch (classifierID) >- { >- case XMLTypePackage.ANY_TYPE: >- return validateAnyType((AnyType)value, diagnostics, context); >- case XMLTypePackage.SIMPLE_ANY_TYPE: >- return validateSimpleAnyType((SimpleAnyType)value, diagnostics, context); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT: >- return validateXMLTypeDocumentRoot((XMLTypeDocumentRoot)value, diagnostics, context); >- case XMLTypePackage.ANY_SIMPLE_TYPE: >- return validateAnySimpleType(value, diagnostics, context); >- case XMLTypePackage.ANY_URI: >- return validateAnyURI((String)value, diagnostics, context); >- case XMLTypePackage.BASE64_BINARY: >- return validateBase64Binary((byte[])value, diagnostics, context); >- case XMLTypePackage.BOOLEAN: >- return validateBoolean(((Boolean)value).booleanValue(), diagnostics, context); >- case XMLTypePackage.BOOLEAN_OBJECT: >- return validateBooleanObject((Boolean)value, diagnostics, context); >- case XMLTypePackage.BYTE: >- return validateByte(((Byte)value).byteValue(), diagnostics, context); >- case XMLTypePackage.BYTE_OBJECT: >- return validateByteObject((Byte)value, diagnostics, context); >- case XMLTypePackage.DATE: >- return validateDate(value, diagnostics, context); >- case XMLTypePackage.DATE_TIME: >- return validateDateTime(value, diagnostics, context); >- case XMLTypePackage.DECIMAL: >- return validateDecimal((BigDecimal)value, diagnostics, context); >- case XMLTypePackage.DOUBLE: >- return validateDouble(((Double)value).doubleValue(), diagnostics, context); >- case XMLTypePackage.DOUBLE_OBJECT: >- return validateDoubleObject((Double)value, diagnostics, context); >- case XMLTypePackage.DURATION: >- return validateDuration(value, diagnostics, context); >- case XMLTypePackage.ENTITIES: >- return validateENTITIES((List)value, diagnostics, context); >- case XMLTypePackage.ENTITIES_BASE: >- return validateENTITIESBase((List)value, diagnostics, context); >- case XMLTypePackage.ENTITY: >- return validateENTITY((String)value, diagnostics, context); >- case XMLTypePackage.FLOAT: >- return validateFloat(((Float)value).floatValue(), diagnostics, context); >- case XMLTypePackage.FLOAT_OBJECT: >- return validateFloatObject((Float)value, diagnostics, context); >- case XMLTypePackage.GDAY: >- return validateGDay(value, diagnostics, context); >- case XMLTypePackage.GMONTH: >- return validateGMonth(value, diagnostics, context); >- case XMLTypePackage.GMONTH_DAY: >- return validateGMonthDay(value, diagnostics, context); >- case XMLTypePackage.GYEAR: >- return validateGYear(value, diagnostics, context); >- case XMLTypePackage.GYEAR_MONTH: >- return validateGYearMonth(value, diagnostics, context); >- case XMLTypePackage.HEX_BINARY: >- return validateHexBinary((byte[])value, diagnostics, context); >- case XMLTypePackage.ID: >- return validateID((String)value, diagnostics, context); >- case XMLTypePackage.IDREF: >- return validateIDREF((String)value, diagnostics, context); >- case XMLTypePackage.IDREFS: >- return validateIDREFS((List)value, diagnostics, context); >- case XMLTypePackage.IDREFS_BASE: >- return validateIDREFSBase((List)value, diagnostics, context); >- case XMLTypePackage.INT: >- return validateInt(((Integer)value).intValue(), diagnostics, context); >- case XMLTypePackage.INTEGER: >- return validateInteger((BigInteger)value, diagnostics, context); >- case XMLTypePackage.INT_OBJECT: >- return validateIntObject((Integer)value, diagnostics, context); >- case XMLTypePackage.LANGUAGE: >- return validateLanguage((String)value, diagnostics, context); >- case XMLTypePackage.LONG: >- return validateLong(((Long)value).longValue(), diagnostics, context); >- case XMLTypePackage.LONG_OBJECT: >- return validateLongObject((Long)value, diagnostics, context); >- case XMLTypePackage.NAME: >- return validateName((String)value, diagnostics, context); >- case XMLTypePackage.NC_NAME: >- return validateNCName((String)value, diagnostics, context); >- case XMLTypePackage.NEGATIVE_INTEGER: >- return validateNegativeInteger((BigInteger)value, diagnostics, context); >- case XMLTypePackage.NMTOKEN: >- return validateNMTOKEN((String)value, diagnostics, context); >- case XMLTypePackage.NMTOKENS: >- return validateNMTOKENS((List)value, diagnostics, context); >- case XMLTypePackage.NMTOKENS_BASE: >- return validateNMTOKENSBase((List)value, diagnostics, context); >- case XMLTypePackage.NON_NEGATIVE_INTEGER: >- return validateNonNegativeInteger((BigInteger)value, diagnostics, context); >- case XMLTypePackage.NON_POSITIVE_INTEGER: >- return validateNonPositiveInteger((BigInteger)value, diagnostics, context); >- case XMLTypePackage.NORMALIZED_STRING: >- return validateNormalizedString((String)value, diagnostics, context); >- case XMLTypePackage.NOTATION: >- return validateNOTATION(value, diagnostics, context); >- case XMLTypePackage.POSITIVE_INTEGER: >- return validatePositiveInteger((BigInteger)value, diagnostics, context); >- case XMLTypePackage.QNAME: >- return validateQName(value, diagnostics, context); >- case XMLTypePackage.SHORT: >- return validateShort(((Short)value).shortValue(), diagnostics, context); >- case XMLTypePackage.SHORT_OBJECT: >- return validateShortObject((Short)value, diagnostics, context); >- case XMLTypePackage.STRING: >- return validateString((String)value, diagnostics, context); >- case XMLTypePackage.TIME: >- return validateTime(value, diagnostics, context); >- case XMLTypePackage.TOKEN: >- return validateToken((String)value, diagnostics, context); >- case XMLTypePackage.UNSIGNED_BYTE: >- return validateUnsignedByte(((Short)value).shortValue(), diagnostics, context); >- case XMLTypePackage.UNSIGNED_BYTE_OBJECT: >- return validateUnsignedByteObject((Short)value, diagnostics, context); >- case XMLTypePackage.UNSIGNED_INT: >- return validateUnsignedInt(((Long)value).longValue(), diagnostics, context); >- case XMLTypePackage.UNSIGNED_INT_OBJECT: >- return validateUnsignedIntObject((Long)value, diagnostics, context); >- case XMLTypePackage.UNSIGNED_LONG: >- return validateUnsignedLong((BigInteger)value, diagnostics, context); >- case XMLTypePackage.UNSIGNED_SHORT: >- return validateUnsignedShort(((Integer)value).intValue(), diagnostics, context); >- case XMLTypePackage.UNSIGNED_SHORT_OBJECT: >- return validateUnsignedShortObject((Integer)value, diagnostics, context); >- default: >- return true; >- } >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateAnyType(AnyType anyType, DiagnosticChain diagnostics, Map context) >- { >- return validate_EveryDefaultConstraint(anyType, diagnostics, context); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateSimpleAnyType(SimpleAnyType simpleAnyType, DiagnosticChain diagnostics, Map context) >- { >- return validate_EveryDefaultConstraint(simpleAnyType, diagnostics, context); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateXMLTypeDocumentRoot(XMLTypeDocumentRoot xmlTypeDocumentRoot, DiagnosticChain diagnostics, Map context) >- { >- return validate_EveryDefaultConstraint(xmlTypeDocumentRoot, diagnostics, context); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateAnySimpleType(Object anySimpleType, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateAnyURI(String anyURI, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateBase64Binary(byte[] base64Binary, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateBoolean(boolean boolean_, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateBooleanObject(Boolean booleanObject, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateByte(byte byte_, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateByteObject(Byte byteObject, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateDate(Object date, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateDateTime(Object dateTime, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateDecimal(BigDecimal decimal, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateDouble(double double_, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateDoubleObject(Double doubleObject, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateDuration(Object duration, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateENTITIES(List entities, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateENTITIESBase_ItemType(entities, diagnostics, context); >- if (result || diagnostics != null) result &= validateENTITIES_MinLength(entities, diagnostics, context); >- return result; >- } >- >- /** >- * Validates the MinLength constraint of '<em>ENTITIES</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateENTITIES_MinLength(List entities, DiagnosticChain diagnostics, Map context) >- { >- int length = entities.size(); >- boolean result = length >= 1; >- if (!result && diagnostics != null) >- reportMinLengthViolation(XMLTypePackage.Literals.ENTITIES, entities, length, 1, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateENTITIESBase(List entitiesBase, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateENTITIESBase_ItemType(entitiesBase, diagnostics, context); >- return result; >- } >- >- /** >- * Validates the ItemType constraint of '<em>ENTITIES Base</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateENTITIESBase_ItemType(List entitiesBase, DiagnosticChain diagnostics, Map context) >- { >- boolean result = true; >- for (Iterator i = entitiesBase.iterator(); i.hasNext() && (result || diagnostics != null); ) >- { >- Object item = i.next(); >- if (XMLTypePackage.Literals.ENTITY.isInstance(item)) >- { >- result &= validateENTITY((String)item, diagnostics, context); >- } >- else >- { >- result = false; >- reportDataValueTypeViolation(XMLTypePackage.Literals.ENTITY, item, diagnostics, context); >- } >- } >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateENTITY(String entity, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateNCName_Pattern(entity, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateFloat(float float_, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateFloatObject(Float floatObject, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateGDay(Object gDay, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateGMonth(Object gMonth, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateGMonthDay(Object gMonthDay, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateGYear(Object gYear, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateGYearMonth(Object gYearMonth, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateHexBinary(byte[] hexBinary, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateID(String id, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateNCName_Pattern(id, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateIDREF(String idref, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateNCName_Pattern(idref, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateIDREFS(List idrefs, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateIDREFSBase_ItemType(idrefs, diagnostics, context); >- if (result || diagnostics != null) result &= validateIDREFS_MinLength(idrefs, diagnostics, context); >- return result; >- } >- >- /** >- * Validates the MinLength constraint of '<em>IDREFS</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateIDREFS_MinLength(List idrefs, DiagnosticChain diagnostics, Map context) >- { >- int length = idrefs.size(); >- boolean result = length >= 1; >- if (!result && diagnostics != null) >- reportMinLengthViolation(XMLTypePackage.Literals.IDREFS, idrefs, length, 1, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateIDREFSBase(List idrefsBase, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateIDREFSBase_ItemType(idrefsBase, diagnostics, context); >- return result; >- } >- >- /** >- * Validates the ItemType constraint of '<em>IDREFS Base</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateIDREFSBase_ItemType(List idrefsBase, DiagnosticChain diagnostics, Map context) >- { >- boolean result = true; >- for (Iterator i = idrefsBase.iterator(); i.hasNext() && (result || diagnostics != null); ) >- { >- Object item = i.next(); >- if (XMLTypePackage.Literals.IDREF.isInstance(item)) >- { >- result &= validateIDREF((String)item, diagnostics, context); >- } >- else >- { >- result = false; >- reportDataValueTypeViolation(XMLTypePackage.Literals.IDREF, item, diagnostics, context); >- } >- } >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateInt(int int_, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateInteger(BigInteger integer, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateIntObject(Integer intObject, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateLanguage(String language, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateLanguage_Pattern(language, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateLanguage_Pattern >- */ >- public static final PatternMatcher [][] LANGUAGE__PATTERN__VALUES = >- new PatternMatcher [][] >- { >- new PatternMatcher [] >- { >- XMLTypeUtil.createPatternMatcher("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*") >- } >- }; >- >- /** >- * Validates the Pattern constraint of '<em>Language</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateLanguage_Pattern(String language, DiagnosticChain diagnostics, Map context) >- { >- return validatePattern(XMLTypePackage.Literals.LANGUAGE, language, LANGUAGE__PATTERN__VALUES, diagnostics, context); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateLong(long long_, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateLongObject(Long longObject, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateName(String name, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateName_Pattern(name, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateName_Pattern >- */ >- public static final PatternMatcher [][] NAME__PATTERN__VALUES = >- new PatternMatcher [][] >- { >- new PatternMatcher [] >- { >- XMLTypeUtil.createPatternMatcher("\\i\\c*") >- } >- }; >- >- /** >- * Validates the Pattern constraint of '<em>Name</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateName_Pattern(String name, DiagnosticChain diagnostics, Map context) >- { >- return validatePattern(XMLTypePackage.Literals.NAME, name, NAME__PATTERN__VALUES, diagnostics, context); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNCName(String ncName, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateNCName_Pattern(ncName, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateNCName_Pattern >- */ >- public static final PatternMatcher [][] NC_NAME__PATTERN__VALUES = >- new PatternMatcher [][] >- { >- new PatternMatcher [] >- { >- XMLTypeUtil.createPatternMatcher("[\\i-[:]][\\c-[:]]*") >- }, >- new PatternMatcher [] >- { >- XMLTypeUtil.createPatternMatcher("\\i\\c*") >- } >- }; >- >- /** >- * Validates the Pattern constraint of '<em>NC Name</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNCName_Pattern(String ncName, DiagnosticChain diagnostics, Map context) >- { >- return validatePattern(XMLTypePackage.Literals.NC_NAME, ncName, NC_NAME__PATTERN__VALUES, diagnostics, context); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNegativeInteger(BigInteger negativeInteger, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateNegativeInteger_Max(negativeInteger, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateNegativeInteger_Max >- */ >- public static final BigInteger NEGATIVE_INTEGER__MAX__VALUE = new BigInteger("-1"); >- >- /** >- * Validates the Max constraint of '<em>Negative Integer</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNegativeInteger_Max(BigInteger negativeInteger, DiagnosticChain diagnostics, Map context) >- { >- boolean result = negativeInteger.compareTo(NEGATIVE_INTEGER__MAX__VALUE) <= 0; >- if (!result && diagnostics != null) >- reportMaxViolation(XMLTypePackage.Literals.NEGATIVE_INTEGER, negativeInteger, NEGATIVE_INTEGER__MAX__VALUE, true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNMTOKEN(String nmtoken, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateNMTOKEN_Pattern(nmtoken, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateNMTOKEN_Pattern >- */ >- public static final PatternMatcher [][] NMTOKEN__PATTERN__VALUES = >- new PatternMatcher [][] >- { >- new PatternMatcher [] >- { >- XMLTypeUtil.createPatternMatcher("\\c+") >- } >- }; >- >- /** >- * Validates the Pattern constraint of '<em>NMTOKEN</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNMTOKEN_Pattern(String nmtoken, DiagnosticChain diagnostics, Map context) >- { >- return validatePattern(XMLTypePackage.Literals.NMTOKEN, nmtoken, NMTOKEN__PATTERN__VALUES, diagnostics, context); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNMTOKENS(List nmtokens, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateNMTOKENSBase_ItemType(nmtokens, diagnostics, context); >- if (result || diagnostics != null) result &= validateNMTOKENS_MinLength(nmtokens, diagnostics, context); >- return result; >- } >- >- /** >- * Validates the MinLength constraint of '<em>NMTOKENS</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNMTOKENS_MinLength(List nmtokens, DiagnosticChain diagnostics, Map context) >- { >- int length = nmtokens.size(); >- boolean result = length >= 1; >- if (!result && diagnostics != null) >- reportMinLengthViolation(XMLTypePackage.Literals.NMTOKENS, nmtokens, length, 1, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNMTOKENSBase(List nmtokensBase, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateNMTOKENSBase_ItemType(nmtokensBase, diagnostics, context); >- return result; >- } >- >- /** >- * Validates the ItemType constraint of '<em>NMTOKENS Base</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNMTOKENSBase_ItemType(List nmtokensBase, DiagnosticChain diagnostics, Map context) >- { >- boolean result = true; >- for (Iterator i = nmtokensBase.iterator(); i.hasNext() && (result || diagnostics != null); ) >- { >- Object item = i.next(); >- if (XMLTypePackage.Literals.NMTOKEN.isInstance(item)) >- { >- result &= validateNMTOKEN((String)item, diagnostics, context); >- } >- else >- { >- result = false; >- reportDataValueTypeViolation(XMLTypePackage.Literals.NMTOKEN, item, diagnostics, context); >- } >- } >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNonNegativeInteger(BigInteger nonNegativeInteger, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateNonNegativeInteger_Min(nonNegativeInteger, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateNonNegativeInteger_Min >- */ >- public static final BigInteger NON_NEGATIVE_INTEGER__MIN__VALUE = new BigInteger("0"); >- >- /** >- * Validates the Min constraint of '<em>Non Negative Integer</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNonNegativeInteger_Min(BigInteger nonNegativeInteger, DiagnosticChain diagnostics, Map context) >- { >- boolean result = nonNegativeInteger.compareTo(NON_NEGATIVE_INTEGER__MIN__VALUE) >= 0; >- if (!result && diagnostics != null) >- reportMinViolation(XMLTypePackage.Literals.NON_NEGATIVE_INTEGER, nonNegativeInteger, NON_NEGATIVE_INTEGER__MIN__VALUE, true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNonPositiveInteger(BigInteger nonPositiveInteger, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateNonPositiveInteger_Max(nonPositiveInteger, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateNonPositiveInteger_Max >- */ >- public static final BigInteger NON_POSITIVE_INTEGER__MAX__VALUE = new BigInteger("0"); >- >- /** >- * Validates the Max constraint of '<em>Non Positive Integer</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNonPositiveInteger_Max(BigInteger nonPositiveInteger, DiagnosticChain diagnostics, Map context) >- { >- boolean result = nonPositiveInteger.compareTo(NON_POSITIVE_INTEGER__MAX__VALUE) <= 0; >- if (!result && diagnostics != null) >- reportMaxViolation(XMLTypePackage.Literals.NON_POSITIVE_INTEGER, nonPositiveInteger, NON_POSITIVE_INTEGER__MAX__VALUE, true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNormalizedString(String normalizedString, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateNOTATION(Object notation, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validatePositiveInteger(BigInteger positiveInteger, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validatePositiveInteger_Min(positiveInteger, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validatePositiveInteger_Min >- */ >- public static final BigInteger POSITIVE_INTEGER__MIN__VALUE = new BigInteger("1"); >- >- /** >- * Validates the Min constraint of '<em>Positive Integer</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validatePositiveInteger_Min(BigInteger positiveInteger, DiagnosticChain diagnostics, Map context) >- { >- boolean result = positiveInteger.compareTo(POSITIVE_INTEGER__MIN__VALUE) >= 0; >- if (!result && diagnostics != null) >- reportMinViolation(XMLTypePackage.Literals.POSITIVE_INTEGER, positiveInteger, POSITIVE_INTEGER__MIN__VALUE, true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateQName(Object qName, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateShort(short short_, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateShortObject(Short shortObject, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateString(String string, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateTime(Object time, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateToken(String token, DiagnosticChain diagnostics, Map context) >- { >- return true; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedByte(short unsignedByte, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateUnsignedByte_Min(unsignedByte, diagnostics, context); >- if (result || diagnostics != null) result &= validateUnsignedByte_Max(unsignedByte, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateUnsignedByte_Min >- */ >- public static final short UNSIGNED_BYTE__MIN__VALUE = 0; >- >- /** >- * Validates the Min constraint of '<em>Unsigned Byte</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedByte_Min(short unsignedByte, DiagnosticChain diagnostics, Map context) >- { >- boolean result = unsignedByte >= UNSIGNED_BYTE__MIN__VALUE; >- if (!result && diagnostics != null) >- reportMinViolation(XMLTypePackage.Literals.UNSIGNED_BYTE, new Short(unsignedByte), new Short(UNSIGNED_BYTE__MIN__VALUE), true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateUnsignedByte_Max >- */ >- public static final short UNSIGNED_BYTE__MAX__VALUE = 255; >- >- /** >- * Validates the Max constraint of '<em>Unsigned Byte</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedByte_Max(short unsignedByte, DiagnosticChain diagnostics, Map context) >- { >- boolean result = unsignedByte <= UNSIGNED_BYTE__MAX__VALUE; >- if (!result && diagnostics != null) >- reportMaxViolation(XMLTypePackage.Literals.UNSIGNED_BYTE, new Short(unsignedByte), new Short(UNSIGNED_BYTE__MAX__VALUE), true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedByteObject(Short unsignedByteObject, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateUnsignedByte_Min(unsignedByteObject.shortValue(), diagnostics, context); >- if (result || diagnostics != null) result &= validateUnsignedByte_Max(unsignedByteObject.shortValue(), diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedInt(long unsignedInt, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateUnsignedInt_Min(unsignedInt, diagnostics, context); >- if (result || diagnostics != null) result &= validateUnsignedInt_Max(unsignedInt, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateUnsignedInt_Min >- */ >- public static final long UNSIGNED_INT__MIN__VALUE = 0L; >- >- /** >- * Validates the Min constraint of '<em>Unsigned Int</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedInt_Min(long unsignedInt, DiagnosticChain diagnostics, Map context) >- { >- boolean result = unsignedInt >= UNSIGNED_INT__MIN__VALUE; >- if (!result && diagnostics != null) >- reportMinViolation(XMLTypePackage.Literals.UNSIGNED_INT, new Long(unsignedInt), new Long(UNSIGNED_INT__MIN__VALUE), true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateUnsignedInt_Max >- */ >- public static final long UNSIGNED_INT__MAX__VALUE = 4294967295L; >- >- /** >- * Validates the Max constraint of '<em>Unsigned Int</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedInt_Max(long unsignedInt, DiagnosticChain diagnostics, Map context) >- { >- boolean result = unsignedInt <= UNSIGNED_INT__MAX__VALUE; >- if (!result && diagnostics != null) >- reportMaxViolation(XMLTypePackage.Literals.UNSIGNED_INT, new Long(unsignedInt), new Long(UNSIGNED_INT__MAX__VALUE), true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedIntObject(Long unsignedIntObject, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateUnsignedInt_Min(unsignedIntObject.longValue(), diagnostics, context); >- if (result || diagnostics != null) result &= validateUnsignedInt_Max(unsignedIntObject.longValue(), diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedLong(BigInteger unsignedLong, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateUnsignedLong_Min(unsignedLong, diagnostics, context); >- if (result || diagnostics != null) result &= validateUnsignedLong_Max(unsignedLong, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateUnsignedLong_Min >- */ >- public static final BigInteger UNSIGNED_LONG__MIN__VALUE = new BigInteger("0"); >- >- /** >- * Validates the Min constraint of '<em>Unsigned Long</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedLong_Min(BigInteger unsignedLong, DiagnosticChain diagnostics, Map context) >- { >- boolean result = unsignedLong.compareTo(UNSIGNED_LONG__MIN__VALUE) >= 0; >- if (!result && diagnostics != null) >- reportMinViolation(XMLTypePackage.Literals.UNSIGNED_LONG, unsignedLong, UNSIGNED_LONG__MIN__VALUE, true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateUnsignedLong_Max >- */ >- public static final BigInteger UNSIGNED_LONG__MAX__VALUE = new BigInteger("18446744073709551615"); >- >- /** >- * Validates the Max constraint of '<em>Unsigned Long</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedLong_Max(BigInteger unsignedLong, DiagnosticChain diagnostics, Map context) >- { >- boolean result = unsignedLong.compareTo(UNSIGNED_LONG__MAX__VALUE) <= 0; >- if (!result && diagnostics != null) >- reportMaxViolation(XMLTypePackage.Literals.UNSIGNED_LONG, unsignedLong, UNSIGNED_LONG__MAX__VALUE, true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedShort(int unsignedShort, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateUnsignedShort_Min(unsignedShort, diagnostics, context); >- if (result || diagnostics != null) result &= validateUnsignedShort_Max(unsignedShort, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateUnsignedShort_Min >- */ >- public static final int UNSIGNED_SHORT__MIN__VALUE = 0; >- >- /** >- * Validates the Min constraint of '<em>Unsigned Short</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedShort_Min(int unsignedShort, DiagnosticChain diagnostics, Map context) >- { >- boolean result = unsignedShort >= UNSIGNED_SHORT__MIN__VALUE; >- if (!result && diagnostics != null) >- reportMinViolation(XMLTypePackage.Literals.UNSIGNED_SHORT, new Integer(unsignedShort), new Integer(UNSIGNED_SHORT__MIN__VALUE), true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @see #validateUnsignedShort_Max >- */ >- public static final int UNSIGNED_SHORT__MAX__VALUE = 65535; >- >- /** >- * Validates the Max constraint of '<em>Unsigned Short</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedShort_Max(int unsignedShort, DiagnosticChain diagnostics, Map context) >- { >- boolean result = unsignedShort <= UNSIGNED_SHORT__MAX__VALUE; >- if (!result && diagnostics != null) >- reportMaxViolation(XMLTypePackage.Literals.UNSIGNED_SHORT, new Integer(unsignedShort), new Integer(UNSIGNED_SHORT__MAX__VALUE), true, diagnostics, context); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean validateUnsignedShortObject(Integer unsignedShortObject, DiagnosticChain diagnostics, Map context) >- { >- boolean result = validateUnsignedShort_Min(unsignedShortObject.intValue(), diagnostics, context); >- if (result || diagnostics != null) result &= validateUnsignedShort_Max(unsignedShortObject.intValue(), diagnostics, context); >- return result; >- } >- >-} //XMLTypeValidator >Index: src/org/eclipse/emf/ecore/xml/type/util/XMLTypeResourceImpl.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/type/util/XMLTypeResourceImpl.java >diff -N src/org/eclipse/emf/ecore/xml/type/util/XMLTypeResourceImpl.java >--- src/org/eclipse/emf/ecore/xml/type/util/XMLTypeResourceImpl.java 3 May 2006 19:30:32 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,2455 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLTypeResourceImpl.java,v 1.2 2006/05/03 19:30:32 davidms Exp $ >- */ >-package org.eclipse.emf.ecore.xml.type.util; >- >-import java.math.BigDecimal; >-import java.math.BigInteger; >- >- >-import java.util.List; >-import org.eclipse.emf.common.util.URI; >- >-import org.eclipse.emf.ecore.resource.impl.ResourceImpl; >- >-import org.eclipse.emf.ecore.xml.type.AnyType; >-import org.eclipse.emf.ecore.xml.type.SimpleAnyType; >-import org.eclipse.emf.ecore.xml.type.XMLTypeDocumentRoot; >-import org.eclipse.emf.ecore.xml.type.XMLTypeFactory; >-// import org.eclipse.emf.ecore.xml.type.XMLTypePackage; >- >-import org.xml.sax.Attributes; >-import org.xml.sax.SAXException; >-import org.xml.sax.SAXParseException; >-import org.xml.sax.helpers.DefaultHandler; >- >- >-/** >- * <!-- begin-user-doc --> >- * The <b>Resource </b> associated with the package. >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.type.util.XMLTypeResourceFactoryImpl >- * @generated >- */ >-public class XMLTypeResourceImpl extends ResourceImpl >-{ >- /** >- * Creates an instance of the resource. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param uri the URI of the new resource. >- * @generated >- */ >- public XMLTypeResourceImpl(URI uri) >- { >- super(uri); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public final static class FrameFactory { >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static final FrameFactory INSTANCE = new FrameFactory(); >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected AnyTypeStackFrame anyType; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected SimpleAnyTypeStackFrame simpleAnyType; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeDocumentRootStackFrame xmlTypeDocumentRoot; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame anySimpleType; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame anyURI; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame base64Binary; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame boolean_; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame booleanObject; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame byte_; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame byteObject; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame date; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame dateTime; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame decimal; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame double_; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame doubleObject; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame duration; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame entities; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame entitiesBase; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame entity; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame float_; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame floatObject; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame gDay; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame gMonth; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame gMonthDay; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame gYear; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame gYearMonth; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame hexBinary; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame id; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame idref; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame idrefs; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame idrefsBase; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame int_; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame integer; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame intObject; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame language; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame long_; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame longObject; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame name; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame ncName; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame negativeInteger; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame nmtoken; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame nmtokens; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame nmtokensBase; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame nonNegativeInteger; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame nonPositiveInteger; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame normalizedString; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame notation; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame positiveInteger; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame qName; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame short_; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame shortObject; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame string; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame time; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame token; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame unsignedByte; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame unsignedByteObject; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame unsignedInt; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame unsignedIntObject; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame unsignedLong; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame unsignedShort; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame unsignedShortObject; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public AnyTypeStackFrame pushAnyType(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- AnyTypeStackFrame resultAnyType = anyType == null ? new AnyTypeStackFrame() : anyType; >- anyType = null; >- resultAnyType.pushOnto(previous); >- resultAnyType.handleAttributes(attributes); >- return resultAnyType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public AnyType popAnyType(AnyTypeStackFrame anyType) >- { >- AnyType resultAnyTypeValue = anyType.popAnyType(); >- this.anyType = anyType; >- return resultAnyTypeValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static class AnyTypeStackFrame extends XMLTypeResourceImpl.StackFrame >- { >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected AnyType theAnyType; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void handleAttributes(Attributes attributes) >- { >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.StackFrame startElement(String namespace, String localName, String qName, Attributes attributes) throws SAXException >- { >- return super.startElement(namespace, localName, qName, attributes); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void endElement(XMLTypeResourceImpl.StackFrame child) throws SAXException >- { >- super.endElement(child); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void create() >- { >- theAnyType = XMLTypeFactory.eINSTANCE.createAnyType(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected AnyType popAnyType() >- { >- pop(); >- AnyType resultAnyTypeValue = theAnyType; >- theAnyType = null; >- return resultAnyTypeValue; >- } >- >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public SimpleAnyTypeStackFrame pushSimpleAnyType(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- SimpleAnyTypeStackFrame resultSimpleAnyType = simpleAnyType == null ? new SimpleAnyTypeStackFrame() : simpleAnyType; >- simpleAnyType = null; >- resultSimpleAnyType.pushOnto(previous); >- resultSimpleAnyType.handleAttributes(attributes); >- return resultSimpleAnyType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public SimpleAnyType popSimpleAnyType(SimpleAnyTypeStackFrame simpleAnyType) >- { >- SimpleAnyType resultSimpleAnyTypeValue = simpleAnyType.popSimpleAnyType(); >- this.simpleAnyType = simpleAnyType; >- return resultSimpleAnyTypeValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static class SimpleAnyTypeStackFrame extends XMLTypeResourceImpl.StackFrame >- { >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected SimpleAnyType theSimpleAnyType; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void handleAttributes(Attributes attributes) >- { >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.StackFrame startElement(String namespace, String localName, String qName, Attributes attributes) throws SAXException >- { >- return super.startElement(namespace, localName, qName, attributes); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void endElement(XMLTypeResourceImpl.StackFrame child) throws SAXException >- { >- super.endElement(child); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void create() >- { >- theSimpleAnyType = XMLTypeFactory.eINSTANCE.createSimpleAnyType(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected SimpleAnyType popSimpleAnyType() >- { >- pop(); >- SimpleAnyType resultSimpleAnyTypeValue = theSimpleAnyType; >- theSimpleAnyType = null; >- return resultSimpleAnyTypeValue; >- } >- >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeDocumentRootStackFrame pushXMLTypeDocumentRoot(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeDocumentRootStackFrame resultXMLTypeDocumentRoot = xmlTypeDocumentRoot == null ? new XMLTypeDocumentRootStackFrame() : xmlTypeDocumentRoot; >- xmlTypeDocumentRoot = null; >- resultXMLTypeDocumentRoot.pushOnto(previous); >- resultXMLTypeDocumentRoot.handleAttributes(attributes); >- return resultXMLTypeDocumentRoot; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeDocumentRoot popXMLTypeDocumentRoot(XMLTypeDocumentRootStackFrame xmlTypeDocumentRoot) >- { >- XMLTypeDocumentRoot resultXMLTypeDocumentRootValue = xmlTypeDocumentRoot.popXMLTypeDocumentRoot(); >- this.xmlTypeDocumentRoot = xmlTypeDocumentRoot; >- return resultXMLTypeDocumentRootValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static class XMLTypeDocumentRootStackFrame extends XMLTypeResourceImpl.StackFrame >- { >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeDocumentRoot theXMLTypeDocumentRoot; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame cDATA; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame comment; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeResourceImpl.DataFrame text; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void handleAttributes(Attributes attributes) >- { >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.StackFrame startElement(String namespace, String localName, String qName, Attributes attributes) throws SAXException >- { >- if ("cDATA".equals(localName) && "http://www.eclipse.org/emf/2003/XMLType".equals(namespace)) >- { >- return cDATA = XMLTypeResourceImpl.FrameFactory.INSTANCE.pushString(this, attributes); >- } >- else if ("comment".equals(localName) && "http://www.eclipse.org/emf/2003/XMLType".equals(namespace)) >- { >- return comment = XMLTypeResourceImpl.FrameFactory.INSTANCE.pushString(this, attributes); >- } >- else if ("text".equals(localName) && "http://www.eclipse.org/emf/2003/XMLType".equals(namespace)) >- { >- return text = XMLTypeResourceImpl.FrameFactory.INSTANCE.pushString(this, attributes); >- } >- else >- { >- return super.startElement(namespace, localName, qName, attributes); >- } >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void endElement(XMLTypeResourceImpl.StackFrame child) throws SAXException >- { >- if (child == cDATA) >- { >- theXMLTypeDocumentRoot.setCDATA(XMLTypeResourceImpl.FrameFactory.INSTANCE.popString(cDATA)); >- cDATA = null; >- } >- else if (child == comment) >- { >- theXMLTypeDocumentRoot.setComment(XMLTypeResourceImpl.FrameFactory.INSTANCE.popString(comment)); >- comment = null; >- } >- else if (child == text) >- { >- theXMLTypeDocumentRoot.setText(XMLTypeResourceImpl.FrameFactory.INSTANCE.popString(text)); >- text = null; >- } >- else >- { >- super.endElement(child); >- } >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void create() >- { >- theXMLTypeDocumentRoot = XMLTypeFactory.eINSTANCE.createXMLTypeDocumentRoot(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeDocumentRoot popXMLTypeDocumentRoot() >- { >- pop(); >- XMLTypeDocumentRoot resultXMLTypeDocumentRootValue = theXMLTypeDocumentRoot; >- theXMLTypeDocumentRoot = null; >- return resultXMLTypeDocumentRootValue; >- } >- >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushAnySimpleType(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultAnySimpleType = anySimpleType == null ? new XMLTypeResourceImpl.DataFrame() : anySimpleType; >- anySimpleType = null; >- resultAnySimpleType.pushOnto(previous); >- resultAnySimpleType.handleAttributes(attributes); >- return resultAnySimpleType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popAnySimpleType(XMLTypeResourceImpl.DataFrame anySimpleType) >- { >- Object resultAnySimpleTypeValue = XMLTypeFactory.eINSTANCE.createAnySimpleType(anySimpleType.popValue()); >- this.anySimpleType = anySimpleType; >- return resultAnySimpleTypeValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushAnyURI(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultAnyURI = anyURI == null ? new XMLTypeResourceImpl.DataFrame() : anyURI; >- anyURI = null; >- resultAnyURI.pushOnto(previous); >- resultAnyURI.handleAttributes(attributes); >- return resultAnyURI; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String popAnyURI(XMLTypeResourceImpl.DataFrame anyURI) >- { >- String resultAnyURIValue = XMLTypeFactory.eINSTANCE.createAnyURI(anyURI.popValue()); >- this.anyURI = anyURI; >- return resultAnyURIValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushBase64Binary(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultBase64Binary = base64Binary == null ? new XMLTypeResourceImpl.DataFrame() : base64Binary; >- base64Binary = null; >- resultBase64Binary.pushOnto(previous); >- resultBase64Binary.handleAttributes(attributes); >- return resultBase64Binary; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public byte[] popBase64Binary(XMLTypeResourceImpl.DataFrame base64Binary) >- { >- byte[] resultBase64BinaryValue = XMLTypeFactory.eINSTANCE.createBase64Binary(base64Binary.popValue()); >- this.base64Binary = base64Binary; >- return resultBase64BinaryValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushBoolean(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultBoolean = boolean_ == null ? new XMLTypeResourceImpl.DataFrame() : boolean_; >- boolean_ = null; >- resultBoolean.pushOnto(previous); >- resultBoolean.handleAttributes(attributes); >- return resultBoolean; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean popBoolean(XMLTypeResourceImpl.DataFrame boolean_) >- { >- boolean resultBooleanValue = XMLTypeFactory.eINSTANCE.createBoolean(boolean_.popValue()); >- this.boolean_ = boolean_; >- return resultBooleanValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushBooleanObject(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultBooleanObject = booleanObject == null ? new XMLTypeResourceImpl.DataFrame() : booleanObject; >- booleanObject = null; >- resultBooleanObject.pushOnto(previous); >- resultBooleanObject.handleAttributes(attributes); >- return resultBooleanObject; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Boolean popBooleanObject(XMLTypeResourceImpl.DataFrame booleanObject) >- { >- Boolean resultBooleanObjectValue = XMLTypeFactory.eINSTANCE.createBooleanObject(booleanObject.popValue()); >- this.booleanObject = booleanObject; >- return resultBooleanObjectValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushByte(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultByte = byte_ == null ? new XMLTypeResourceImpl.DataFrame() : byte_; >- byte_ = null; >- resultByte.pushOnto(previous); >- resultByte.handleAttributes(attributes); >- return resultByte; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public byte popByte(XMLTypeResourceImpl.DataFrame byte_) >- { >- byte resultByteValue = XMLTypeFactory.eINSTANCE.createByte(byte_.popValue()); >- this.byte_ = byte_; >- return resultByteValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushByteObject(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultByteObject = byteObject == null ? new XMLTypeResourceImpl.DataFrame() : byteObject; >- byteObject = null; >- resultByteObject.pushOnto(previous); >- resultByteObject.handleAttributes(attributes); >- return resultByteObject; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Byte popByteObject(XMLTypeResourceImpl.DataFrame byteObject) >- { >- Byte resultByteObjectValue = XMLTypeFactory.eINSTANCE.createByteObject(byteObject.popValue()); >- this.byteObject = byteObject; >- return resultByteObjectValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushDate(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultDate = date == null ? new XMLTypeResourceImpl.DataFrame() : date; >- date = null; >- resultDate.pushOnto(previous); >- resultDate.handleAttributes(attributes); >- return resultDate; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popDate(XMLTypeResourceImpl.DataFrame date) >- { >- Object resultDateValue = XMLTypeFactory.eINSTANCE.createDate(date.popValue()); >- this.date = date; >- return resultDateValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushDateTime(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultDateTime = dateTime == null ? new XMLTypeResourceImpl.DataFrame() : dateTime; >- dateTime = null; >- resultDateTime.pushOnto(previous); >- resultDateTime.handleAttributes(attributes); >- return resultDateTime; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popDateTime(XMLTypeResourceImpl.DataFrame dateTime) >- { >- Object resultDateTimeValue = XMLTypeFactory.eINSTANCE.createDateTime(dateTime.popValue()); >- this.dateTime = dateTime; >- return resultDateTimeValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushDecimal(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultDecimal = decimal == null ? new XMLTypeResourceImpl.DataFrame() : decimal; >- decimal = null; >- resultDecimal.pushOnto(previous); >- resultDecimal.handleAttributes(attributes); >- return resultDecimal; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigDecimal popDecimal(XMLTypeResourceImpl.DataFrame decimal) >- { >- BigDecimal resultDecimalValue = XMLTypeFactory.eINSTANCE.createDecimal(decimal.popValue()); >- this.decimal = decimal; >- return resultDecimalValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushDouble(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultDouble = double_ == null ? new XMLTypeResourceImpl.DataFrame() : double_; >- double_ = null; >- resultDouble.pushOnto(previous); >- resultDouble.handleAttributes(attributes); >- return resultDouble; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public double popDouble(XMLTypeResourceImpl.DataFrame double_) >- { >- double resultDoubleValue = XMLTypeFactory.eINSTANCE.createDouble(double_.popValue()); >- this.double_ = double_; >- return resultDoubleValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushDoubleObject(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultDoubleObject = doubleObject == null ? new XMLTypeResourceImpl.DataFrame() : doubleObject; >- doubleObject = null; >- resultDoubleObject.pushOnto(previous); >- resultDoubleObject.handleAttributes(attributes); >- return resultDoubleObject; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Double popDoubleObject(XMLTypeResourceImpl.DataFrame doubleObject) >- { >- Double resultDoubleObjectValue = XMLTypeFactory.eINSTANCE.createDoubleObject(doubleObject.popValue()); >- this.doubleObject = doubleObject; >- return resultDoubleObjectValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushDuration(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultDuration = duration == null ? new XMLTypeResourceImpl.DataFrame() : duration; >- duration = null; >- resultDuration.pushOnto(previous); >- resultDuration.handleAttributes(attributes); >- return resultDuration; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popDuration(XMLTypeResourceImpl.DataFrame duration) >- { >- Object resultDurationValue = XMLTypeFactory.eINSTANCE.createDuration(duration.popValue()); >- this.duration = duration; >- return resultDurationValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushENTITIES(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultENTITIES = entities == null ? new XMLTypeResourceImpl.DataFrame() : entities; >- entities = null; >- resultENTITIES.pushOnto(previous); >- resultENTITIES.handleAttributes(attributes); >- return resultENTITIES; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List popENTITIES(XMLTypeResourceImpl.DataFrame entities) >- { >- List resultENTITIESValue = XMLTypeFactory.eINSTANCE.createENTITIES(entities.popValue()); >- this.entities = entities; >- return resultENTITIESValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushENTITIESBase(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultENTITIESBase = entitiesBase == null ? new XMLTypeResourceImpl.DataFrame() : entitiesBase; >- entitiesBase = null; >- resultENTITIESBase.pushOnto(previous); >- resultENTITIESBase.handleAttributes(attributes); >- return resultENTITIESBase; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List popENTITIESBase(XMLTypeResourceImpl.DataFrame entitiesBase) >- { >- List resultENTITIESBaseValue = XMLTypeFactory.eINSTANCE.createENTITIESBase(entitiesBase.popValue()); >- this.entitiesBase = entitiesBase; >- return resultENTITIESBaseValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushENTITY(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultENTITY = entity == null ? new XMLTypeResourceImpl.DataFrame() : entity; >- entity = null; >- resultENTITY.pushOnto(previous); >- resultENTITY.handleAttributes(attributes); >- return resultENTITY; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String popENTITY(XMLTypeResourceImpl.DataFrame entity) >- { >- String resultENTITYValue = XMLTypeFactory.eINSTANCE.createENTITY(entity.popValue()); >- this.entity = entity; >- return resultENTITYValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushFloat(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultFloat = float_ == null ? new XMLTypeResourceImpl.DataFrame() : float_; >- float_ = null; >- resultFloat.pushOnto(previous); >- resultFloat.handleAttributes(attributes); >- return resultFloat; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public float popFloat(XMLTypeResourceImpl.DataFrame float_) >- { >- float resultFloatValue = XMLTypeFactory.eINSTANCE.createFloat(float_.popValue()); >- this.float_ = float_; >- return resultFloatValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushFloatObject(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultFloatObject = floatObject == null ? new XMLTypeResourceImpl.DataFrame() : floatObject; >- floatObject = null; >- resultFloatObject.pushOnto(previous); >- resultFloatObject.handleAttributes(attributes); >- return resultFloatObject; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Float popFloatObject(XMLTypeResourceImpl.DataFrame floatObject) >- { >- Float resultFloatObjectValue = XMLTypeFactory.eINSTANCE.createFloatObject(floatObject.popValue()); >- this.floatObject = floatObject; >- return resultFloatObjectValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushGDay(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultGDay = gDay == null ? new XMLTypeResourceImpl.DataFrame() : gDay; >- gDay = null; >- resultGDay.pushOnto(previous); >- resultGDay.handleAttributes(attributes); >- return resultGDay; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popGDay(XMLTypeResourceImpl.DataFrame gDay) >- { >- Object resultGDayValue = XMLTypeFactory.eINSTANCE.createGDay(gDay.popValue()); >- this.gDay = gDay; >- return resultGDayValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushGMonth(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultGMonth = gMonth == null ? new XMLTypeResourceImpl.DataFrame() : gMonth; >- gMonth = null; >- resultGMonth.pushOnto(previous); >- resultGMonth.handleAttributes(attributes); >- return resultGMonth; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popGMonth(XMLTypeResourceImpl.DataFrame gMonth) >- { >- Object resultGMonthValue = XMLTypeFactory.eINSTANCE.createGMonth(gMonth.popValue()); >- this.gMonth = gMonth; >- return resultGMonthValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushGMonthDay(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultGMonthDay = gMonthDay == null ? new XMLTypeResourceImpl.DataFrame() : gMonthDay; >- gMonthDay = null; >- resultGMonthDay.pushOnto(previous); >- resultGMonthDay.handleAttributes(attributes); >- return resultGMonthDay; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popGMonthDay(XMLTypeResourceImpl.DataFrame gMonthDay) >- { >- Object resultGMonthDayValue = XMLTypeFactory.eINSTANCE.createGMonthDay(gMonthDay.popValue()); >- this.gMonthDay = gMonthDay; >- return resultGMonthDayValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushGYear(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultGYear = gYear == null ? new XMLTypeResourceImpl.DataFrame() : gYear; >- gYear = null; >- resultGYear.pushOnto(previous); >- resultGYear.handleAttributes(attributes); >- return resultGYear; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popGYear(XMLTypeResourceImpl.DataFrame gYear) >- { >- Object resultGYearValue = XMLTypeFactory.eINSTANCE.createGYear(gYear.popValue()); >- this.gYear = gYear; >- return resultGYearValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushGYearMonth(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultGYearMonth = gYearMonth == null ? new XMLTypeResourceImpl.DataFrame() : gYearMonth; >- gYearMonth = null; >- resultGYearMonth.pushOnto(previous); >- resultGYearMonth.handleAttributes(attributes); >- return resultGYearMonth; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popGYearMonth(XMLTypeResourceImpl.DataFrame gYearMonth) >- { >- Object resultGYearMonthValue = XMLTypeFactory.eINSTANCE.createGYearMonth(gYearMonth.popValue()); >- this.gYearMonth = gYearMonth; >- return resultGYearMonthValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushHexBinary(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultHexBinary = hexBinary == null ? new XMLTypeResourceImpl.DataFrame() : hexBinary; >- hexBinary = null; >- resultHexBinary.pushOnto(previous); >- resultHexBinary.handleAttributes(attributes); >- return resultHexBinary; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public byte[] popHexBinary(XMLTypeResourceImpl.DataFrame hexBinary) >- { >- byte[] resultHexBinaryValue = XMLTypeFactory.eINSTANCE.createHexBinary(hexBinary.popValue()); >- this.hexBinary = hexBinary; >- return resultHexBinaryValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushID(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultID = id == null ? new XMLTypeResourceImpl.DataFrame() : id; >- id = null; >- resultID.pushOnto(previous); >- resultID.handleAttributes(attributes); >- return resultID; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String popID(XMLTypeResourceImpl.DataFrame id) >- { >- String resultIDValue = XMLTypeFactory.eINSTANCE.createID(id.popValue()); >- this.id = id; >- return resultIDValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushIDREF(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultIDREF = idref == null ? new XMLTypeResourceImpl.DataFrame() : idref; >- idref = null; >- resultIDREF.pushOnto(previous); >- resultIDREF.handleAttributes(attributes); >- return resultIDREF; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String popIDREF(XMLTypeResourceImpl.DataFrame idref) >- { >- String resultIDREFValue = XMLTypeFactory.eINSTANCE.createIDREF(idref.popValue()); >- this.idref = idref; >- return resultIDREFValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushIDREFS(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultIDREFS = idrefs == null ? new XMLTypeResourceImpl.DataFrame() : idrefs; >- idrefs = null; >- resultIDREFS.pushOnto(previous); >- resultIDREFS.handleAttributes(attributes); >- return resultIDREFS; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List popIDREFS(XMLTypeResourceImpl.DataFrame idrefs) >- { >- List resultIDREFSValue = XMLTypeFactory.eINSTANCE.createIDREFS(idrefs.popValue()); >- this.idrefs = idrefs; >- return resultIDREFSValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushIDREFSBase(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultIDREFSBase = idrefsBase == null ? new XMLTypeResourceImpl.DataFrame() : idrefsBase; >- idrefsBase = null; >- resultIDREFSBase.pushOnto(previous); >- resultIDREFSBase.handleAttributes(attributes); >- return resultIDREFSBase; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List popIDREFSBase(XMLTypeResourceImpl.DataFrame idrefsBase) >- { >- List resultIDREFSBaseValue = XMLTypeFactory.eINSTANCE.createIDREFSBase(idrefsBase.popValue()); >- this.idrefsBase = idrefsBase; >- return resultIDREFSBaseValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushInt(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultInt = int_ == null ? new XMLTypeResourceImpl.DataFrame() : int_; >- int_ = null; >- resultInt.pushOnto(previous); >- resultInt.handleAttributes(attributes); >- return resultInt; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public int popInt(XMLTypeResourceImpl.DataFrame int_) >- { >- int resultIntValue = XMLTypeFactory.eINSTANCE.createInt(int_.popValue()); >- this.int_ = int_; >- return resultIntValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushInteger(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultInteger = integer == null ? new XMLTypeResourceImpl.DataFrame() : integer; >- integer = null; >- resultInteger.pushOnto(previous); >- resultInteger.handleAttributes(attributes); >- return resultInteger; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigInteger popInteger(XMLTypeResourceImpl.DataFrame integer) >- { >- BigInteger resultIntegerValue = XMLTypeFactory.eINSTANCE.createInteger(integer.popValue()); >- this.integer = integer; >- return resultIntegerValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushIntObject(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultIntObject = intObject == null ? new XMLTypeResourceImpl.DataFrame() : intObject; >- intObject = null; >- resultIntObject.pushOnto(previous); >- resultIntObject.handleAttributes(attributes); >- return resultIntObject; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Integer popIntObject(XMLTypeResourceImpl.DataFrame intObject) >- { >- Integer resultIntObjectValue = XMLTypeFactory.eINSTANCE.createIntObject(intObject.popValue()); >- this.intObject = intObject; >- return resultIntObjectValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushLanguage(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultLanguage = language == null ? new XMLTypeResourceImpl.DataFrame() : language; >- language = null; >- resultLanguage.pushOnto(previous); >- resultLanguage.handleAttributes(attributes); >- return resultLanguage; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String popLanguage(XMLTypeResourceImpl.DataFrame language) >- { >- String resultLanguageValue = XMLTypeFactory.eINSTANCE.createLanguage(language.popValue()); >- this.language = language; >- return resultLanguageValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushLong(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultLong = long_ == null ? new XMLTypeResourceImpl.DataFrame() : long_; >- long_ = null; >- resultLong.pushOnto(previous); >- resultLong.handleAttributes(attributes); >- return resultLong; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public long popLong(XMLTypeResourceImpl.DataFrame long_) >- { >- long resultLongValue = XMLTypeFactory.eINSTANCE.createLong(long_.popValue()); >- this.long_ = long_; >- return resultLongValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushLongObject(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultLongObject = longObject == null ? new XMLTypeResourceImpl.DataFrame() : longObject; >- longObject = null; >- resultLongObject.pushOnto(previous); >- resultLongObject.handleAttributes(attributes); >- return resultLongObject; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Long popLongObject(XMLTypeResourceImpl.DataFrame longObject) >- { >- Long resultLongObjectValue = XMLTypeFactory.eINSTANCE.createLongObject(longObject.popValue()); >- this.longObject = longObject; >- return resultLongObjectValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushName(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultName = name == null ? new XMLTypeResourceImpl.DataFrame() : name; >- name = null; >- resultName.pushOnto(previous); >- resultName.handleAttributes(attributes); >- return resultName; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String popName(XMLTypeResourceImpl.DataFrame name) >- { >- String resultNameValue = XMLTypeFactory.eINSTANCE.createName(name.popValue()); >- this.name = name; >- return resultNameValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushNCName(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultNCName = ncName == null ? new XMLTypeResourceImpl.DataFrame() : ncName; >- ncName = null; >- resultNCName.pushOnto(previous); >- resultNCName.handleAttributes(attributes); >- return resultNCName; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String popNCName(XMLTypeResourceImpl.DataFrame ncName) >- { >- String resultNCNameValue = XMLTypeFactory.eINSTANCE.createNCName(ncName.popValue()); >- this.ncName = ncName; >- return resultNCNameValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushNegativeInteger(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultNegativeInteger = negativeInteger == null ? new XMLTypeResourceImpl.DataFrame() : negativeInteger; >- negativeInteger = null; >- resultNegativeInteger.pushOnto(previous); >- resultNegativeInteger.handleAttributes(attributes); >- return resultNegativeInteger; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigInteger popNegativeInteger(XMLTypeResourceImpl.DataFrame negativeInteger) >- { >- BigInteger resultNegativeIntegerValue = XMLTypeFactory.eINSTANCE.createNegativeInteger(negativeInteger.popValue()); >- this.negativeInteger = negativeInteger; >- return resultNegativeIntegerValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushNMTOKEN(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultNMTOKEN = nmtoken == null ? new XMLTypeResourceImpl.DataFrame() : nmtoken; >- nmtoken = null; >- resultNMTOKEN.pushOnto(previous); >- resultNMTOKEN.handleAttributes(attributes); >- return resultNMTOKEN; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String popNMTOKEN(XMLTypeResourceImpl.DataFrame nmtoken) >- { >- String resultNMTOKENValue = XMLTypeFactory.eINSTANCE.createNMTOKEN(nmtoken.popValue()); >- this.nmtoken = nmtoken; >- return resultNMTOKENValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushNMTOKENS(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultNMTOKENS = nmtokens == null ? new XMLTypeResourceImpl.DataFrame() : nmtokens; >- nmtokens = null; >- resultNMTOKENS.pushOnto(previous); >- resultNMTOKENS.handleAttributes(attributes); >- return resultNMTOKENS; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List popNMTOKENS(XMLTypeResourceImpl.DataFrame nmtokens) >- { >- List resultNMTOKENSValue = XMLTypeFactory.eINSTANCE.createNMTOKENS(nmtokens.popValue()); >- this.nmtokens = nmtokens; >- return resultNMTOKENSValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushNMTOKENSBase(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultNMTOKENSBase = nmtokensBase == null ? new XMLTypeResourceImpl.DataFrame() : nmtokensBase; >- nmtokensBase = null; >- resultNMTOKENSBase.pushOnto(previous); >- resultNMTOKENSBase.handleAttributes(attributes); >- return resultNMTOKENSBase; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List popNMTOKENSBase(XMLTypeResourceImpl.DataFrame nmtokensBase) >- { >- List resultNMTOKENSBaseValue = XMLTypeFactory.eINSTANCE.createNMTOKENSBase(nmtokensBase.popValue()); >- this.nmtokensBase = nmtokensBase; >- return resultNMTOKENSBaseValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushNonNegativeInteger(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultNonNegativeInteger = nonNegativeInteger == null ? new XMLTypeResourceImpl.DataFrame() : nonNegativeInteger; >- nonNegativeInteger = null; >- resultNonNegativeInteger.pushOnto(previous); >- resultNonNegativeInteger.handleAttributes(attributes); >- return resultNonNegativeInteger; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigInteger popNonNegativeInteger(XMLTypeResourceImpl.DataFrame nonNegativeInteger) >- { >- BigInteger resultNonNegativeIntegerValue = XMLTypeFactory.eINSTANCE.createNonNegativeInteger(nonNegativeInteger.popValue()); >- this.nonNegativeInteger = nonNegativeInteger; >- return resultNonNegativeIntegerValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushNonPositiveInteger(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultNonPositiveInteger = nonPositiveInteger == null ? new XMLTypeResourceImpl.DataFrame() : nonPositiveInteger; >- nonPositiveInteger = null; >- resultNonPositiveInteger.pushOnto(previous); >- resultNonPositiveInteger.handleAttributes(attributes); >- return resultNonPositiveInteger; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigInteger popNonPositiveInteger(XMLTypeResourceImpl.DataFrame nonPositiveInteger) >- { >- BigInteger resultNonPositiveIntegerValue = XMLTypeFactory.eINSTANCE.createNonPositiveInteger(nonPositiveInteger.popValue()); >- this.nonPositiveInteger = nonPositiveInteger; >- return resultNonPositiveIntegerValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushNormalizedString(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultNormalizedString = normalizedString == null ? new XMLTypeResourceImpl.DataFrame() : normalizedString; >- normalizedString = null; >- resultNormalizedString.pushOnto(previous); >- resultNormalizedString.handleAttributes(attributes); >- return resultNormalizedString; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String popNormalizedString(XMLTypeResourceImpl.DataFrame normalizedString) >- { >- String resultNormalizedStringValue = XMLTypeFactory.eINSTANCE.createNormalizedString(normalizedString.popValue()); >- this.normalizedString = normalizedString; >- return resultNormalizedStringValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushNOTATION(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultNOTATION = notation == null ? new XMLTypeResourceImpl.DataFrame() : notation; >- notation = null; >- resultNOTATION.pushOnto(previous); >- resultNOTATION.handleAttributes(attributes); >- return resultNOTATION; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popNOTATION(XMLTypeResourceImpl.DataFrame notation) >- { >- Object resultNOTATIONValue = XMLTypeFactory.eINSTANCE.createNOTATION(notation.popValue()); >- this.notation = notation; >- return resultNOTATIONValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushPositiveInteger(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultPositiveInteger = positiveInteger == null ? new XMLTypeResourceImpl.DataFrame() : positiveInteger; >- positiveInteger = null; >- resultPositiveInteger.pushOnto(previous); >- resultPositiveInteger.handleAttributes(attributes); >- return resultPositiveInteger; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigInteger popPositiveInteger(XMLTypeResourceImpl.DataFrame positiveInteger) >- { >- BigInteger resultPositiveIntegerValue = XMLTypeFactory.eINSTANCE.createPositiveInteger(positiveInteger.popValue()); >- this.positiveInteger = positiveInteger; >- return resultPositiveIntegerValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushQName(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultQName = qName == null ? new XMLTypeResourceImpl.DataFrame() : qName; >- qName = null; >- resultQName.pushOnto(previous); >- resultQName.handleAttributes(attributes); >- return resultQName; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popQName(XMLTypeResourceImpl.DataFrame qName) >- { >- Object resultQNameValue = XMLTypeFactory.eINSTANCE.createQName(qName.popValue()); >- this.qName = qName; >- return resultQNameValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushShort(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultShort = short_ == null ? new XMLTypeResourceImpl.DataFrame() : short_; >- short_ = null; >- resultShort.pushOnto(previous); >- resultShort.handleAttributes(attributes); >- return resultShort; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public short popShort(XMLTypeResourceImpl.DataFrame short_) >- { >- short resultShortValue = XMLTypeFactory.eINSTANCE.createShort(short_.popValue()); >- this.short_ = short_; >- return resultShortValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushShortObject(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultShortObject = shortObject == null ? new XMLTypeResourceImpl.DataFrame() : shortObject; >- shortObject = null; >- resultShortObject.pushOnto(previous); >- resultShortObject.handleAttributes(attributes); >- return resultShortObject; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Short popShortObject(XMLTypeResourceImpl.DataFrame shortObject) >- { >- Short resultShortObjectValue = XMLTypeFactory.eINSTANCE.createShortObject(shortObject.popValue()); >- this.shortObject = shortObject; >- return resultShortObjectValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushString(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultString = string == null ? new XMLTypeResourceImpl.DataFrame() : string; >- string = null; >- resultString.pushOnto(previous); >- resultString.handleAttributes(attributes); >- return resultString; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String popString(XMLTypeResourceImpl.DataFrame string) >- { >- String resultStringValue = string.popValue(); >- this.string = string; >- return resultStringValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushTime(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultTime = time == null ? new XMLTypeResourceImpl.DataFrame() : time; >- time = null; >- resultTime.pushOnto(previous); >- resultTime.handleAttributes(attributes); >- return resultTime; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object popTime(XMLTypeResourceImpl.DataFrame time) >- { >- Object resultTimeValue = XMLTypeFactory.eINSTANCE.createTime(time.popValue()); >- this.time = time; >- return resultTimeValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushToken(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultToken = token == null ? new XMLTypeResourceImpl.DataFrame() : token; >- token = null; >- resultToken.pushOnto(previous); >- resultToken.handleAttributes(attributes); >- return resultToken; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String popToken(XMLTypeResourceImpl.DataFrame token) >- { >- String resultTokenValue = XMLTypeFactory.eINSTANCE.createToken(token.popValue()); >- this.token = token; >- return resultTokenValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushUnsignedByte(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultUnsignedByte = unsignedByte == null ? new XMLTypeResourceImpl.DataFrame() : unsignedByte; >- unsignedByte = null; >- resultUnsignedByte.pushOnto(previous); >- resultUnsignedByte.handleAttributes(attributes); >- return resultUnsignedByte; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public short popUnsignedByte(XMLTypeResourceImpl.DataFrame unsignedByte) >- { >- short resultUnsignedByteValue = XMLTypeFactory.eINSTANCE.createUnsignedByte(unsignedByte.popValue()); >- this.unsignedByte = unsignedByte; >- return resultUnsignedByteValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushUnsignedByteObject(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultUnsignedByteObject = unsignedByteObject == null ? new XMLTypeResourceImpl.DataFrame() : unsignedByteObject; >- unsignedByteObject = null; >- resultUnsignedByteObject.pushOnto(previous); >- resultUnsignedByteObject.handleAttributes(attributes); >- return resultUnsignedByteObject; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Short popUnsignedByteObject(XMLTypeResourceImpl.DataFrame unsignedByteObject) >- { >- Short resultUnsignedByteObjectValue = XMLTypeFactory.eINSTANCE.createUnsignedByteObject(unsignedByteObject.popValue()); >- this.unsignedByteObject = unsignedByteObject; >- return resultUnsignedByteObjectValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushUnsignedInt(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultUnsignedInt = unsignedInt == null ? new XMLTypeResourceImpl.DataFrame() : unsignedInt; >- unsignedInt = null; >- resultUnsignedInt.pushOnto(previous); >- resultUnsignedInt.handleAttributes(attributes); >- return resultUnsignedInt; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public long popUnsignedInt(XMLTypeResourceImpl.DataFrame unsignedInt) >- { >- long resultUnsignedIntValue = XMLTypeFactory.eINSTANCE.createUnsignedInt(unsignedInt.popValue()); >- this.unsignedInt = unsignedInt; >- return resultUnsignedIntValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushUnsignedIntObject(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultUnsignedIntObject = unsignedIntObject == null ? new XMLTypeResourceImpl.DataFrame() : unsignedIntObject; >- unsignedIntObject = null; >- resultUnsignedIntObject.pushOnto(previous); >- resultUnsignedIntObject.handleAttributes(attributes); >- return resultUnsignedIntObject; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Long popUnsignedIntObject(XMLTypeResourceImpl.DataFrame unsignedIntObject) >- { >- Long resultUnsignedIntObjectValue = XMLTypeFactory.eINSTANCE.createUnsignedIntObject(unsignedIntObject.popValue()); >- this.unsignedIntObject = unsignedIntObject; >- return resultUnsignedIntObjectValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushUnsignedLong(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultUnsignedLong = unsignedLong == null ? new XMLTypeResourceImpl.DataFrame() : unsignedLong; >- unsignedLong = null; >- resultUnsignedLong.pushOnto(previous); >- resultUnsignedLong.handleAttributes(attributes); >- return resultUnsignedLong; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigInteger popUnsignedLong(XMLTypeResourceImpl.DataFrame unsignedLong) >- { >- BigInteger resultUnsignedLongValue = XMLTypeFactory.eINSTANCE.createUnsignedLong(unsignedLong.popValue()); >- this.unsignedLong = unsignedLong; >- return resultUnsignedLongValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushUnsignedShort(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultUnsignedShort = unsignedShort == null ? new XMLTypeResourceImpl.DataFrame() : unsignedShort; >- unsignedShort = null; >- resultUnsignedShort.pushOnto(previous); >- resultUnsignedShort.handleAttributes(attributes); >- return resultUnsignedShort; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public int popUnsignedShort(XMLTypeResourceImpl.DataFrame unsignedShort) >- { >- int resultUnsignedShortValue = XMLTypeFactory.eINSTANCE.createUnsignedShort(unsignedShort.popValue()); >- this.unsignedShort = unsignedShort; >- return resultUnsignedShortValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeResourceImpl.DataFrame pushUnsignedShortObject(XMLTypeResourceImpl.StackFrame previous, Attributes attributes) >- { >- XMLTypeResourceImpl.DataFrame resultUnsignedShortObject = unsignedShortObject == null ? new XMLTypeResourceImpl.DataFrame() : unsignedShortObject; >- unsignedShortObject = null; >- resultUnsignedShortObject.pushOnto(previous); >- resultUnsignedShortObject.handleAttributes(attributes); >- return resultUnsignedShortObject; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Integer popUnsignedShortObject(XMLTypeResourceImpl.DataFrame unsignedShortObject) >- { >- Integer resultUnsignedShortObjectValue = XMLTypeFactory.eINSTANCE.createUnsignedShortObject(unsignedShortObject.popValue()); >- this.unsignedShortObject = unsignedShortObject; >- return resultUnsignedShortObjectValue; >- } >- >- } >- >- public static abstract class StackFrame >- { >- private StackFrame previous; >- >- final public void pushOnto(StackFrame previous) >- { >- this.previous = previous; >- create(); >- } >- >- final public void pop() >- { >- this.previous = null; >- } >- >- public void handleAttributes(Attributes attributes) >- { >- } >- >- public StackFrame startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException >- { >- throw new SAXException("Unexpected start element"); >- } >- >- public void endElement(StackFrame child) throws SAXException >- { >- throw new SAXException("Unexpected end element"); >- } >- >- final public StackFrame endElement() throws SAXException >- { >- StackFrame result = previous; >- previous.endElement(this); >- return result; >- } >- >- public void characters(char[] text, int start, int length) throws SAXException >- { >- } >- >- public void create() >- { >- } >- } >- >- public static class DataFrame extends StackFrame >- { >- protected StringBuffer stringBuffer; >- >- public void characters(char[] text, int start, int length) throws SAXException >- { >- if (stringBuffer == null) >- { >- stringBuffer = new StringBuffer(); >- } >- stringBuffer.append(text, start, length); >- } >- >- public String popValue() >- { >- if (stringBuffer == null) >- { >- pop(); >- return null; >- } >- else >- { >- String result = stringBuffer.toString(); >- stringBuffer.setLength(0); >- pop(); >- return result; >- } >- } >- } >- >- public static class Handler extends DefaultHandler >- { >- protected StackFrame stackFrame = null; >- >- public Handler(StackFrame stackFrame) >- { >- this.stackFrame = stackFrame; >- } >- >- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException >- { >- stackFrame = stackFrame.startElement(uri, localName, qName, attributes); >- } >- >- public void endElement(String uri, String localName, String qName) throws SAXException >- { >- stackFrame = stackFrame.endElement(); >- } >- >- public void characters(char[] text, int start, int length) throws SAXException >- { >- stackFrame.characters(text, start, length); >- } >- >- public void error(SAXParseException exception) throws SAXException >- { >- } >- >- public void fatalError(SAXParseException exception) throws SAXException >- { >- } >- } >- >-} //XMLTypeResourceImpl >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/META-INF/MANIFEST.MF,v >retrieving revision 1.8.2.3 >diff -u -r1.8.2.3 MANIFEST.MF >--- META-INF/MANIFEST.MF 7 Jun 2007 21:56:38 -0000 1.8.2.3 >+++ META-INF/MANIFEST.MF 16 Nov 2007 07:20:49 -0000 >@@ -13,9 +13,6 @@ > org.eclipse.emf.ecore.resource, > org.eclipse.emf.ecore.resource.impl, > org.eclipse.emf.ecore.util, >- org.eclipse.emf.ecore.xml.namespace, >- org.eclipse.emf.ecore.xml.namespace.impl, >- org.eclipse.emf.ecore.xml.namespace.util, > org.eclipse.emf.ecore.xml.type, > org.eclipse.emf.ecore.xml.type.impl, > org.eclipse.emf.ecore.xml.type.internal, >Index: src/org/eclipse/emf/ecore/resource/URIConverter.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/resource/URIConverter.java >diff -N src/org/eclipse/emf/ecore/resource/URIConverter.java >--- src/org/eclipse/emf/ecore/resource/URIConverter.java 10 May 2007 17:29:50 -0000 1.5.2.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,429 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: URIConverter.java,v 1.5.2.1 2007/05/10 17:29:50 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.resource; >- >- >-import java.io.ByteArrayInputStream; >-import java.io.ByteArrayOutputStream; >-import java.io.IOException; >-import java.io.InputStream; >-import java.io.InputStreamReader; >-import java.io.OutputStream; >-import java.io.OutputStreamWriter; >-import java.io.Reader; >-import java.io.StringReader; >-import java.io.Writer; >-import java.util.Map; >- >-import org.eclipse.emf.common.util.URI; >-import org.eclipse.emf.ecore.xml.type.internal.RegEx; >- >- >-/** >- * A converter to normalize a URI or to produce an input or output stream for a URI. >- * <p> >- * A resource set provides {@link ResourceSet#getURIConverter one} of these >- * for use by it's {@link ResourceSet#getResources resources} >- * when they are {@link Resource#save(java.util.Map) serialized} and {@link Resource#load(java.util.Map) deserialized}. >- * A resource set also uses this directly when it {@link ResourceSet#getResource looks up} a resource: >- * a resource is considered a match if {@link Resource#getURI it's URI}, >- * and the URI being looked up, >- * {@link #normalize normalize} to {@link URI#equals(Object) equal} URIs. >- * </p> >- */ >-public interface URIConverter >-{ >- /** >- * Returns the normalized form of the URI. >- * <p> >- * This may, in theory, do absolutly anything. >- * Default behaviour includes >- * applying URI {@link URIConverter#getURIMap mapping}, >- * assuming <code>"file:"</code> protocol >- * for a {@link URI#isRelative relative} URI with a {@link URI#hasRelativePath relative path}: >- *<pre> >- * ./WhateverDirectory/Whatever.file >- * -> >- * file:./WhateverDirectory/Whatever.file >- *</pre> >- * and assuming <code>"platform:/resource"</code> protocol >- * for a relative URI with an {@link URI#hasAbsolutePath absolute path}: >- *<pre> >- * /WhateverRelocatableProject/Whatever.file >- * -> >- * platform:/resource/WhateverRelocatableProject/Whatever.file >- *</pre> >- * </p> >- * <p> >- * It is important to emphasize that normalization can result it loss of information. >- * The normalized URI should generally be used only for comparison and for access to input or output streams. >- * </p> >- * @param uri the URI to normalize. >- * @return the normalized form. >- * @see org.eclipse.emf.ecore.plugin.EcorePlugin#getPlatformResourceMap >- */ >- URI normalize(URI uri); >- >- /** >- * Returns the map used for remapping a logical URI to a physical URI when {@link #normalize normalizing}. >- * <p> >- * An implementation will typically also delegate to the {@link URIConverter#URI_MAP global} map, >- * so registrations made in this map are <em>local</em> to this URI converter, >- * i.e., they augment or override those of the global map. >- * </p> >- * <p> >- * The map generally specifies instance to instance mapping, >- * except for the case that both the key URI and the value URI end with "/", >- * which specifies a folder to folder mapping. >- * A folder mapping will remap any URI that has the key as its {@link URI#replacePrefix prefix}, >- * e.g., if the map contains: >- *<pre> >- * http://www.example.com/ -> platform:/resource/example/ >- *</pre> >- * then the URI >- *<pre> >- * http://www.example.com/a/b/c.d >- *</pre> >- * will map to >- *<pre> >- * platform:/resource/example/a/b/c.d >- *</pre> >- * A matching instance mapping is considered first. >- * If there isn't one, the folder mappings are considered starting with the {@link URI#segmentCount() longest} prefix. >- * </p> >- * @see #normalize(URI) >- * @see #URI_MAP >- * @return the map used for remapping a logical URI to a physical URI. >- */ >- Map getURIMap(); >- >- /** >- * The global static URI map. >- * Registrations made in this instance will (typically) be available >- * for {@link URIConverter#normalize use} by any URI converter. >- * It is populated by URI mappings registered via >- * {@link org.eclipse.emf.ecore.plugin.EcorePlugin.Implementation#startup plugin registration}. >- * @see #normalize(URI) >- */ >- Map URI_MAP = org.eclipse.emf.ecore.resource.impl.URIMappingRegistryImpl.INSTANCE.map(); >- >- /** >- * Creates an input stream for the URI and returns it. >- * <p> >- * It {@link #normalize normalizes} the URI and uses that as the basis for further processing. >- * Special requirements, such as an Eclipse file refresh, >- * are handled by the {@link org.eclipse.emf.ecore.resource.impl.URIConverterImpl default implementation}. >- * </p> >- * @return an open input stream. >- * @exception IOException if there is a problem obtaining an open input stream. >- */ >- InputStream createInputStream(URI uri) throws IOException; >- >- /** >- * An interface that is optionally implemented by the input streams returned from >- * {@link URIConverter#createInputStream(URI)}. >- * @see ReadableInputStream >- */ >- interface Readable >- { >- /** >- * Returns a reader that provides access to the same underlying data as the input stream itself. >- * @return a reader that provides access to the same underlying data as the input stream itself. >- */ >- Reader asReader(); >- >- /** >- * Returns the encoding used to convert the reader's characters to bytes. >- * @return the encoding used to convert the reader's characters to bytes. >- */ >- String getEncoding(); >- } >- >- /** >- * A wrapper around a reader that implements an input stream but can be unwrapped to access the reader directly. >- */ >- public class ReadableInputStream extends InputStream implements Readable >- { >- private static final RegEx.RegularExpression XML_HEADER = new RegEx.RegularExpression("<\\?xml\\s+(?:version\\s*=\\s*\"[^\"]*\"\\s+)encoding\\s*=\\s*\"\\s*([^\\s\"]*)\"\\s*\\?>"); >- >- public static String getEncoding(String xmlString) >- { >- RegEx.Match match = new RegEx.Match(); >- return >- XML_HEADER.matches(xmlString, match) ? >- match.getCapturedText(1) : >- null; >- } >- >- protected String encoding; >- protected Reader reader; >- protected Buffer buffer; >- >- public ReadableInputStream(Reader reader, String encoding) >- { >- super(); >- this.reader = reader; >- this.encoding = encoding; >- } >- >- public ReadableInputStream(String string, String encoding) >- { >- this(new StringReader(string), encoding); >- } >- >- public ReadableInputStream(String xmlString) >- { >- this(new StringReader(xmlString), getEncoding(xmlString)); >- } >- >- public int read() throws IOException >- { >- if (buffer == null) >- { >- buffer = new Buffer(100); >- } >- >- return buffer.read(); >- } >- >- public Reader asReader() >- { >- return reader; >- } >- >- public String getEncoding() >- { >- return encoding; >- } >- >- public void close() throws IOException >- { >- super.close(); >- reader.close(); >- } >- >- public void reset() throws IOException >- { >- super.reset(); >- reader.reset(); >- } >- >- protected class Buffer extends ByteArrayOutputStream >- { >- protected int index; >- protected char [] characters; >- protected OutputStreamWriter writer; >- >- public Buffer(int size) throws IOException >- { >- super(size); >- characters = new char [size]; >- writer = new OutputStreamWriter(this, encoding); >- } >- >- public int read() throws IOException >- { >- if (index < count) >- { >- return buf[index++]; >- } >- else >- { >- index = 0; >- reset(); >- >- int readCount = reader.read(characters); >- if (readCount < 0) >- { >- return -1; >- } >- else >- { >- writer.write(characters, 0, readCount); >- writer.flush(); >- return buf[index++]; >- } >- } >- } >- } >- } >- >- /** >- * Creates an output stream for the URI and returns it. >- * <p> >- * It {@link #normalize normalizes} the URI and uses that as the basis for further processing. >- * Special requirements, such as an Eclipse file refresh and automatic subdirectory creation, >- * are handled by the {@link org.eclipse.emf.ecore.resource.impl.URIConverterImpl default implementation}. >- * </p> >- * @return an open output stream. >- * @exception IOException if there is a problem obtaining an open output stream. >- */ >- OutputStream createOutputStream(URI uri) throws IOException; >- >- /** >- * An interface that is optionally implemented by the output streams returned from >- * {@link URIConverter#createOutputStream(URI)}. >- * @see WriteableOutputStream >- */ >- interface Writeable >- { >- /** >- * Returns a writer that provides access to the same underlying data as the input stream itself. >- * @return a writer that provides access to the same underlying data as the input stream itself. >- */ >- Writer asWriter(); >- >- /** >- * Returns the encoding used to convert the writer's bytes to characters. >- * @return the encoding used to convert the writer's bytes to characters. >- */ >- String getEncoding(); >- } >- >- /** >- * A wrapper around a writer that implements an output stream but can be unwrapped to access the writer directly. >- */ >- public static class WriteableOutputStream extends OutputStream implements Writeable >- { >- protected String encoding; >- protected Writer writer; >- protected Buffer buffer; >- >- public WriteableOutputStream(Writer writer, String encoding) >- { >- super(); >- this.writer = writer; >- this.encoding = encoding; >- } >- >- public void write(int b) throws IOException >- { >- if (buffer == null) >- { >- buffer = new Buffer(100); >- } >- >- buffer.write(b); >- } >- >- public Writer asWriter() >- { >- return writer; >- } >- >- public String getEncoding() >- { >- return encoding; >- } >- >- public void close() throws IOException >- { >- super.close(); >- writer.close(); >- } >- >- public void flush() throws IOException >- { >- super.flush(); >- buffer.flush(); >- writer.flush(); >- } >- >- protected class Buffer extends ByteArrayInputStream >- { >- protected int index; >- protected char [] characters; >- protected InputStreamReader reader; >- >- public Buffer(int size) throws IOException >- { >- super(new byte [size], 0, 0); >- characters = new char [size]; >- reader = new InputStreamReader(this, encoding); >- } >- >- public void write(int b) throws IOException >- { >- if (count < buf.length) >- { >- buf[count++] = (byte)b; >- } >- else >- { >- int readCount = reader.read(characters); >- if (readCount > 0) >- { >- writer.write(characters, 0, readCount); >- } >- count = 0; >- index = 0; >- pos = 0; >- write(b); >- } >- } >- >- public void flush() throws IOException >- { >- int readCount = reader.read(characters); >- if (readCount > 0) >- { >- writer.write(characters, 0, readCount); >- } >- count = 0; >- index = 0; >- pos = 0; >- } >- } >- } >- >- /** >- * An interface to be implemented by encryption service providers. >- * @since 2.2.0 >- */ >- interface Cipher >- { >- /** >- * Encrypts the specified output stream. >- * @param outputStream >- * @return an encrypted output stream >- */ >- OutputStream encrypt(OutputStream outputStream) throws Exception; >- >- /** >- * This method is invoked after the encrypted output stream is used >- * allowing the Cipher implementation to do any maintenance work required, >- * such as flushing an internal cache. >- * @param The encrypted outputStream returned by {@link #encrypt(OutputStream)}. >- */ >- void finish(OutputStream outputStream) throws Exception; >- >- /** >- * Decrypts the specified input stream. >- * @param inputStream >- * @return a decrypted input stream >- */ >- InputStream decrypt(InputStream inputStream) throws Exception; >- >- /** >- * This method is invoked after the decrypted input stream is used >- * allowing the Cipher implementation to do any maintenance work required, >- * such as flushing internal cache. >- * @param The inputStream returned by {@link #decrypt(InputStream)}. >- */ >- void finish(InputStream inputStream) throws Exception; >- } >-} >Index: src/org/eclipse/emf/ecore/resource/Resource.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/resource/Resource.java,v >retrieving revision 1.7 >diff -u -r1.7 Resource.java >--- src/org/eclipse/emf/ecore/resource/Resource.java 1 May 2006 16:13:09 -0000 1.7 >+++ src/org/eclipse/emf/ecore/resource/Resource.java 16 Nov 2007 07:20:52 -0000 >@@ -17,9 +17,9 @@ > package org.eclipse.emf.ecore.resource; > > >-import java.io.IOException; >-import java.io.InputStream; >-import java.io.OutputStream; >+//import java.io.IOException; >+//import java.io.InputStream; >+//import java.io.OutputStream; > import java.util.Map; > > import org.eclipse.emf.common.notify.NotificationChain; >@@ -115,17 +115,17 @@ > * The {@link #getWarnings} feature {@link org.eclipse.emf.common.notify.Notification#getFeatureID ID}. > */ > int RESOURCE__WARNINGS = 7; >- >+ > /** > * Specify a {@link URIConverter.Cipher} to encrypt and decrypt the resource content. >- */ >- String OPTION_CIPHER = "CIPHER"; >+ */ >+ String OPTION_CIPHER = "CIPHER"; > > /** > * Specify whether the content of the resource should be zipped during save and unzip > * during load. The default value is <tt>Boolean.FALSE</tt> >- */ >- String OPTION_ZIP = "ZIP"; >+ */ >+ String OPTION_ZIP = "ZIP"; > > /** > * Returns the containing resource set. >@@ -220,77 +220,77 @@ > */ > EObject getEObject(String uriFragment); > >- /** >- * Saves the resource using the specified options. >- * <p> >- * Options are handled generically as feature-to-setting entries; >- * the resource will ignore options it doesn't recognize. >- * The options could even include things like an Eclipse progress monitor... >- * </p> >- * <p> >- * An implementation typically uses the {@link ResourceSet#getURIConverter URI converter} >- * of the {@link #getResourceSet containing} resource set >- * to {@link URIConverter#createOutputStream create} an output stream, >- * and then delegates to {@link #save(OutputStream, Map) save(OutputStream, Map)}. >- * </p> >- * @param options the save options. >- * @see #save(OutputStream, Map) >- */ >- void save(Map options) throws IOException; >- >- /** >- * Loads the resource using the specified options. >- * <p> >- * Options are handled generically as feature-to-setting entries; >- * the resource will ignore options it doesn't recognize. >- * The options could even include things like an Eclipse progress monitor... >- * </p> >- * <p> >- * An implementation typically uses the {@link ResourceSet#getURIConverter URI converter} >- * of the {@link #getResourceSet containing} resource set >- * to {@link URIConverter#createInputStream create} an input stream, >- * and then delegates to {@link #load(InputStream, Map) load(InputStream, Map)}. >- * </p> >- * <p> >- * When the load completes, the {@link #getErrors errors} and {@link #getWarnings warnings} can be consulted. >- * An implementation will typically deserialize as much of a document as possible >- * while producing diagnostics for any problems that are encountered. >- * </p> >- * @param options the load options. >- * @see #load(InputStream, Map) >- */ >- void load(Map options) throws IOException; >- >- /** >- * Saves the resource to the output stream using the specified options. >- * <p> >- * Usually, {@link #save(Map) save(Map)} is called directly and it calls this. >- * </p> >- * @param outputStream the stream >- * @param options the save options. >- * @see #save(Map) >- * @see #load(InputStream, Map) >- */ >- void save(OutputStream outputStream, Map options) throws IOException; >- >- /** >- * Loads the resource from the input stream using the specified options. >- * <p> >- * Usually, {@link #load(Map) load(Map)} is called directly and it calls this. >- * </p> >- * @param inputStream the stream >- * @param options the load options. >- * @see #load(Map) >- * @see #save(OutputStream, Map) >- */ >- void load(InputStream inputStream, Map options) throws IOException; >+// /** >+// * Saves the resource using the specified options. >+// * <p> >+// * Options are handled generically as feature-to-setting entries; >+// * the resource will ignore options it doesn't recognize. >+// * The options could even include things like an Eclipse progress monitor... >+// * </p> >+// * <p> >+// * An implementation typically uses the {@link ResourceSet#getURIConverter URI converter} >+// * of the {@link #getResourceSet containing} resource set >+// * to {@link URIConverter#createOutputStream create} an output stream, >+// * and then delegates to {@link #save(OutputStream, Map) save(OutputStream, Map)}. >+// * </p> >+// * @param options the save options. >+// * @see #save(OutputStream, Map) >+// */ >+// void save(Map options) throws IOException; >+ >+// /** >+// * Loads the resource using the specified options. >+// * <p> >+// * Options are handled generically as feature-to-setting entries; >+// * the resource will ignore options it doesn't recognize. >+// * The options could even include things like an Eclipse progress monitor... >+// * </p> >+// * <p> >+// * An implementation typically uses the {@link ResourceSet#getURIConverter URI converter} >+// * of the {@link #getResourceSet containing} resource set >+// * to {@link URIConverter#createInputStream create} an input stream, >+// * and then delegates to {@link #load(InputStream, Map) load(InputStream, Map)}. >+// * </p> >+// * <p> >+// * When the load completes, the {@link #getErrors errors} and {@link #getWarnings warnings} can be consulted. >+// * An implementation will typically deserialize as much of a document as possible >+// * while producing diagnostics for any problems that are encountered. >+// * </p> >+// * @param options the load options. >+// * @see #load(InputStream, Map) >+// */ >+// void load(Map options) throws IOException; >+ >+// /** >+// * Saves the resource to the output stream using the specified options. >+// * <p> >+// * Usually, {@link #save(Map) save(Map)} is called directly and it calls this. >+// * </p> >+// * @param outputStream the stream >+// * @param options the save options. >+// * @see #save(Map) >+// * @see #load(InputStream, Map) >+// */ >+// void save(OutputStream outputStream, Map options) throws IOException; >+// >+// /** >+// * Loads the resource from the input stream using the specified options. >+// * <p> >+// * Usually, {@link #load(Map) load(Map)} is called directly and it calls this. >+// * </p> >+// * @param inputStream the stream >+// * @param options the load options. >+// * @see #load(Map) >+// * @see #save(OutputStream, Map) >+// */ >+// void load(InputStream inputStream, Map options) throws IOException; > > /** > * Returns whether modification tracking is enabled. > * <p> > * If modification tracking is enabled, > * each object of the resource must be adapted in order to listen for changes. >- * This will make the processing of {@link Resource.Internal#attached attached} >+ * This will make the processing of {@link Resource.Internal#attached attached} > * and {@link Resource.Internal#detached detached } significantly more expensive. > * as well as all model editing, in general. > * </p> >@@ -513,7 +513,7 @@ > * {@link org.eclipse.emf.ecore.resource.Resource.Factory} > * or {@link org.eclipse.emf.ecore.resource.Resource.Factory.Descriptor}. > * <p> >- * The {@link #DEFAULT_EXTENSION default} file extension <code>"*"</code> >+ * The {@link #DEFAULT_EXTENSION default} file extension <code>"*"</code> > * can be registered as a default that matches any file extension. > * This is typically reserved for a default factory that supports XMI serialization; > * clients are strongly discouraged from using this feature in the global registry, >@@ -536,36 +536,36 @@ > } > } > >- /** >- * An IO exception that wraps another exception. >- * <p> >- * Since save and load throw an IO Exception, >- * it may be convenient for an implementation to wrap another exception >- * in order to throw it as an IO exception. >- * </p> >- */ >- class IOWrappedException extends IOException >- { >- /** >- * Creates an instance which wraps the given exception. >- * @param exception the exception to wrap. >- */ >- public IOWrappedException(Exception exception) >- { >- super(exception.getLocalizedMessage()); >- initCause(exception); >- } >- >- /** >- * Returns the wrapped exception. >- * @return the wrapped exception. >- * @deprecated in 2.2. Use {@link #getCause()} instead. >- */ >- public Exception getWrappedException() >- { >- return (Exception)getCause(); >- } >- } >+// /** >+// * An IO exception that wraps another exception. >+// * <p> >+// * Since save and load throw an IO Exception, >+// * it may be convenient for an implementation to wrap another exception >+// * in order to throw it as an IO exception. >+// * </p> >+// */ >+// class IOWrappedException extends IOException >+// { >+// /** >+// * Creates an instance which wraps the given exception. >+// * @param exception the exception to wrap. >+// */ >+// public IOWrappedException(Exception exception) >+// { >+// super(exception.getLocalizedMessage()); >+// initCause(exception); >+// } >+// >+// /** >+// * Returns the wrapped exception. >+// * @return the wrapped exception. >+// * @deprecated in 2.2. Use {@link #getCause()} instead. >+// */ >+// public Exception getWrappedException() >+// { >+// return (Exception)getCause(); >+// } >+// } > > /** > * An internal interface implemented by all resources. >Index: src/org/eclipse/emf/ecore/resource/ResourceSet.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/resource/ResourceSet.java,v >retrieving revision 1.2 >diff -u -r1.2 ResourceSet.java >--- src/org/eclipse/emf/ecore/resource/ResourceSet.java 8 Jun 2005 06:20:10 -0000 1.2 >+++ src/org/eclipse/emf/ecore/resource/ResourceSet.java 16 Nov 2007 07:20:52 -0000 >@@ -33,19 +33,19 @@ > * A resource set manages a collection of related {@link #getResources resources} > * and produces notification for changes to that collection. > * It provides a {@link #getAllContents tree} of contents. >- * A collection of {@link #getAdapterFactories adapter factories} >+ * A collection of {@link #getAdapterFactories adapter factories} > * supports {@link org.eclipse.emf.ecore.util.EcoreUtil#getRegisteredAdapter adapter lookup} via registered adapter factory. > * </p> > * <p> >- * A resource can be {@link #createResource created} >+ * A resource can be {@link #createResource created} > * or {@link #getResource(URI, boolean) demand loaded} > * into the collection. > * The {@link #getResourceFactoryRegistry registry} of resource factories can be configured > * to create resources of the appropriate type. >- * A proxy can be {@link #getEObject resolved} by the resource set, >+ * A proxy can be {@link #getEObject resolved} by the resource set, > * and may cause the demand load of a resource. > * Default {@link #getLoadOptions load options} are used during demand load. >- * A {@link #getURIConverter URI converter} can be configured to >+ * A {@link #getURIConverter URI converter} can be configured to > * normalize URIs for comparison and to monitor access to the backing store. > * </p> > * @see Resource >@@ -63,7 +63,7 @@ > /** > * Returns the direct {@link Resource}s being managed. > * <p> >- * A resource added to this list >+ * A resource added to this list > * will be {@link Resource#getResourceSet contained} by this resource set. > * If it was previously contained by a resource set, it will have been removed. > * </p> >@@ -73,8 +73,8 @@ > EList getResources(); > > /** >- * Returns a tree iterator that iterates over all the {@link #getResources direct resources} >- * and over the content {@link Resource#getAllContents tree} of each. >+ * Returns a tree iterator that iterates over all the {@link #getResources direct resources} >+ * and over the content {@link Resource#getAllContents tree} of each. > * @return a tree iterator that iterates over all contents. > * @see EObject#eAllContents > * @see Resource#getAllContents >@@ -85,13 +85,13 @@ > /** > * Returns the list of registered {@link org.eclipse.emf.common.notify.AdapterFactory} instances. > * <p> >- * One style of adapter {@link org.eclipse.emf.ecore.util.EcoreUtil#getRegisteredAdapter lookup} supported by EMF >+ * One style of adapter {@link org.eclipse.emf.ecore.util.EcoreUtil#getRegisteredAdapter lookup} supported by EMF > * is via registered adapter factories. > * Since these factories are accessible to any fully contained object via > *<pre> > * eObject.eResource().getResourceSet().getAdapterFactories() > *</pre> >- * they can be used to create adapters on demand, >+ * they can be used to create adapters on demand, > * without going to the factory first. > * </p> > * @return the list of adapter factories. >@@ -117,7 +117,7 @@ > * Returns the object resolved by the URI. > * <p> > * Every object {@link EObject#eResource contained} by a resource (or that is a {@link EObject#eIsProxy proxy}) >- * has a {@link org.eclipse.emf.ecore.util.EcoreUtil#getURI corresponding URI} >+ * has a {@link org.eclipse.emf.ecore.util.EcoreUtil#getURI corresponding URI} > * that resolves to the object. > * So for any object contained by a resource, the following is <code>true</code>. > *<pre> >@@ -144,28 +144,28 @@ > /** > * Returns the resource resolved by the URI. > * <p> >- * A resource set is expected to implement the following strategy >+ * A resource set is expected to implement the following strategy > * in order to resolve the given URI to a resource. >- * First it uses it's {@link #getURIConverter URI converter} to {@link URIConverter#normalize normalize} the URI >+ * First it uses it's {@link #getURIConverter URI converter} to {@link URIConverter#normalize normalize} the URI > * and then to compare it with the normalized URI of each resource; >- * if it finds a match, >+ * if it finds a match, > * that resource becomes the result. > * Failing that, >- * it {@link org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#delegatedGetResource delegates} >+ * it {@link org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#delegatedGetResource delegates} > * to allow the URI to be resolved elsewhere. >- * For example, >+ * For example, > * the {@link org.eclipse.emf.ecore.EPackage.Registry#INSTANCE package registry} >- * is used to {@link org.eclipse.emf.ecore.EPackage.Registry#getEPackage resolve} >+ * is used to {@link org.eclipse.emf.ecore.EPackage.Registry#getEPackage resolve} > * the {@link org.eclipse.emf.ecore.EPackage namespace URI} of a package > * to the static instance of that package. > * So the important point is that an arbitrary implementation may resolve the URI to any resource, > * not necessarily to one contained by this particular resource set. > * If the delegation step fails to provide a result, > * and if <code>loadOnDemand</code> is <code>true</code>, >- * a resource is {@link org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#demandCreateResource created} >+ * a resource is {@link org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#demandCreateResource created} > * and that resource becomes the result. > * If <code>loadOnDemand</code> is <code>true</code> >- * and the result resource is not {@link Resource#isLoaded loaded}, >+ * and the result resource is not {@link Resource#isLoaded loaded}, > * it will be {@link org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#demandLoad loaded} before it is returned. > * </p> > * @param uri the URI to resolve. >@@ -179,7 +179,7 @@ > /** > * Creates a new resource, of the appropriate type, and returns it. > * <p> >- * It delegates to the resource factory {@link #getResourceFactoryRegistry registry} >+ * It delegates to the resource factory {@link #getResourceFactoryRegistry registry} > * to determine the {@link Resource.Factory.Registry#getFactory correct} factory, > * and then it uses that factory to {@link Resource.Factory#createResource create} the resource > * and add it to the {@link #getResources contents}. >@@ -211,21 +211,21 @@ > */ > void setResourceFactoryRegistry(Resource.Factory.Registry resourceFactoryRegistry); > >- /** >- * Returns the converter used to normalize URIs and to open streams. >- * @return the URI converter. >- * @see URIConverter >- * @see URI >- */ >- URIConverter getURIConverter(); >- >- /** >- * Sets the converter used to normalize URIs and to open streams. >- * @param converter the new converter. >- * @see URIConverter >- * @see URI >- */ >- void setURIConverter(URIConverter converter); >+// /** >+// * Returns the converter used to normalize URIs and to open streams. >+// * @return the URI converter. >+// * @see URIConverter >+// * @see URI >+// */ >+// URIConverter getURIConverter(); >+ >+// /** >+// * Sets the converter used to normalize URIs and to open streams. >+// * @param converter the new converter. >+// * @see URIConverter >+// * @see URI >+// */ >+// void setURIConverter(URIConverter converter); > > /** > * Returns the registry used for looking up a package based namespace. >Index: src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespacePackageImpl.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespacePackageImpl.java >diff -N src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespacePackageImpl.java >--- src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespacePackageImpl.java 2 Dec 2005 18:07:47 -0000 1.11 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,499 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLNamespacePackageImpl.java,v 1.11 2005/12/02 18:07:47 davidms Exp $ >- */ >-package org.eclipse.emf.ecore.xml.namespace.impl; >- >- >-import org.eclipse.emf.ecore.EAttribute; >-import org.eclipse.emf.ecore.EClass; >-import org.eclipse.emf.ecore.EDataType; >-import org.eclipse.emf.ecore.EEnum; >-import org.eclipse.emf.ecore.EPackage; >-import org.eclipse.emf.ecore.EReference; >-import org.eclipse.emf.ecore.EValidator; >-import org.eclipse.emf.ecore.impl.EPackageImpl; >-import org.eclipse.emf.ecore.xml.namespace.SpaceType; >-import org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot; >-import org.eclipse.emf.ecore.xml.namespace.XMLNamespaceFactory; >-import org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage; >-import org.eclipse.emf.ecore.xml.namespace.util.XMLNamespaceValidator; >-import org.eclipse.emf.ecore.xml.type.XMLTypePackage; >- >- >-/** >- * <!-- begin-user-doc --> >- * An implementation of the model <b>Package</b>. >- * <!-- end-user-doc --> >- * @generated >- */ >-public class XMLNamespacePackageImpl extends EPackageImpl implements XMLNamespacePackage >-{ >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EClass xmlNamespaceDocumentRootEClass = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EEnum spaceTypeEEnum = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType langTypeEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType langTypeNullEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType spaceTypeObjectEDataType = null; >- >- /** >- * Creates an instance of the model <b>Package</b>, registered with >- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package >- * package URI value. >- * <p>Note: the correct way to create the package is via the static >- * factory method {@link #init init()}, which also performs >- * initialization of the package, or returns the registered package, >- * if one already exists. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.EPackage.Registry >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage#eNS_URI >- * @see #init() >- * @generated >- */ >- private XMLNamespacePackageImpl() >- { >- super(eNS_URI, XMLNamespaceFactory.eINSTANCE); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private static boolean isInited = false; >- >- /** >- * Creates, registers, and initializes the <b>Package</b> for this >- * model, and for any others upon which it depends. Simple >- * dependencies are satisfied by calling this method on all >- * dependent packages before doing anything else. This method drives >- * initialization for interdependent packages directly, in parallel >- * with this package, itself. >- * <p>Of this package and its interdependencies, all packages which >- * have not yet been registered by their URI values are first created >- * and registered. The packages are then initialized in two steps: >- * meta-model objects for all of the packages are created before any >- * are initialized, since one package's meta-model objects may refer to >- * those of another. >- * <p>Invocation of this method will not affect any packages that have >- * already been initialized. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #eNS_URI >- * @see #createPackageContents() >- * @see #initializePackageContents() >- * @generated >- */ >- public static XMLNamespacePackage init() >- { >- if (isInited) return (XMLNamespacePackage)EPackage.Registry.INSTANCE.getEPackage(XMLNamespacePackage.eNS_URI); >- >- // Obtain or create and register package >- XMLNamespacePackageImpl theXMLNamespacePackage = (XMLNamespacePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof XMLNamespacePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new XMLNamespacePackageImpl()); >- >- isInited = true; >- >- // Initialize simple dependencies >- XMLTypePackage.eINSTANCE.eClass(); >- >- // Create package meta-data objects >- theXMLNamespacePackage.createPackageContents(); >- >- // Initialize created meta-data >- theXMLNamespacePackage.initializePackageContents(); >- >- // Register package validator >- EValidator.Registry.INSTANCE.put >- (theXMLNamespacePackage, >- new EValidator.Descriptor() >- { >- public EValidator getEValidator() >- { >- return XMLNamespaceValidator.INSTANCE; >- } >- }); >- >- // Mark meta-data to indicate it can't be changed >- theXMLNamespacePackage.freeze(); >- >- return theXMLNamespacePackage; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EClass getXMLNamespaceDocumentRoot() >- { >- return xmlNamespaceDocumentRootEClass; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getXMLNamespaceDocumentRoot_Mixed() >- { >- return (EAttribute)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(0); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EReference getXMLNamespaceDocumentRoot_XMLNSPrefixMap() >- { >- return (EReference)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(1); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EReference getXMLNamespaceDocumentRoot_XSISchemaLocation() >- { >- return (EReference)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(2); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getXMLNamespaceDocumentRoot_Base() >- { >- return (EAttribute)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(3); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getXMLNamespaceDocumentRoot_Id() >- { >- return (EAttribute)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(4); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getXMLNamespaceDocumentRoot_Lang() >- { >- return (EAttribute)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(5); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getXMLNamespaceDocumentRoot_Space() >- { >- return (EAttribute)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(6); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EEnum getSpaceType() >- { >- return spaceTypeEEnum; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getLangType() >- { >- return langTypeEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getLangTypeNull() >- { >- return langTypeNullEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getSpaceTypeObject() >- { >- return spaceTypeObjectEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLNamespaceFactory getXMLNamespaceFactory() >- { >- return (XMLNamespaceFactory)getEFactoryInstance(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private boolean isCreated = false; >- >- /** >- * Creates the meta-model objects for the package. This method is >- * guarded to have no affect on any invocation but its first. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void createPackageContents() >- { >- if (isCreated) return; >- isCreated = true; >- >- // Create classes and their features >- xmlNamespaceDocumentRootEClass = createEClass(XML_NAMESPACE_DOCUMENT_ROOT); >- createEAttribute(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__MIXED); >- createEReference(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP); >- createEReference(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); >- createEAttribute(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__BASE); >- createEAttribute(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__ID); >- createEAttribute(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__LANG); >- createEAttribute(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__SPACE); >- >- // Create enums >- spaceTypeEEnum = createEEnum(SPACE_TYPE); >- >- // Create data types >- langTypeEDataType = createEDataType(LANG_TYPE); >- langTypeNullEDataType = createEDataType(LANG_TYPE_NULL); >- spaceTypeObjectEDataType = createEDataType(SPACE_TYPE_OBJECT); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private boolean isInitialized = false; >- >- /** >- * Complete the initialization of the package and its meta-model. This >- * method is guarded to have no affect on any invocation but its first. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void initializePackageContents() >- { >- if (isInitialized) return; >- isInitialized = true; >- >- // Initialize package >- setName(eNAME); >- setNsPrefix(eNS_PREFIX); >- setNsURI(eNS_URI); >- >- // Obtain other dependent packages >- XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); >- >- // Add supertypes to classes >- >- // Initialize classes and features; add operations and parameters >- initEClass(xmlNamespaceDocumentRootEClass, XMLNamespaceDocumentRoot.class, "XMLNamespaceDocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); >- initEAttribute(getXMLNamespaceDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- initEReference(getXMLNamespaceDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- initEReference(getXMLNamespaceDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- initEAttribute(getXMLNamespaceDocumentRoot_Base(), theXMLTypePackage.getAnyURI(), "base", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- initEAttribute(getXMLNamespaceDocumentRoot_Id(), theXMLTypePackage.getID(), "id", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- initEAttribute(getXMLNamespaceDocumentRoot_Lang(), this.getLangType(), "lang", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- initEAttribute(getXMLNamespaceDocumentRoot_Space(), this.getSpaceType(), "space", "preserve", 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- >- // Initialize enums and add enum literals >- initEEnum(spaceTypeEEnum, SpaceType.class, "SpaceType"); >- addEEnumLiteral(spaceTypeEEnum, SpaceType.DEFAULT_LITERAL); >- addEEnumLiteral(spaceTypeEEnum, SpaceType.PRESERVE_LITERAL); >- >- // Initialize data types >- initEDataType(langTypeEDataType, String.class, "LangType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(langTypeNullEDataType, String.class, "LangTypeNull", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(spaceTypeObjectEDataType, SpaceType.class, "SpaceTypeObject", IS_SERIALIZABLE, IS_GENERATED_INSTANCE_CLASS); >- >- // Create resource >- createResource(eNS_URI); >- >- // Create annotations >- // http:///org/eclipse/emf/ecore/util/ExtendedMetaData >- createExtendedMetaDataAnnotations(); >- } >- >- /** >- * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected void createExtendedMetaDataAnnotations() >- { >- String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; >- addAnnotation >- (langTypeEDataType, >- source, >- new String[] >- { >- "name", "lang_._1_._type", >- "memberTypes", "http://www.eclipse.org/emf/2003/XMLType#language lang_._1_._type_._member_._1" >- }); >- addAnnotation >- (langTypeNullEDataType, >- source, >- new String[] >- { >- "name", "lang_._1_._type_._member_._1", >- "baseType", "http://www.eclipse.org/emf/2003/XMLType#string", >- "enumeration", "" >- }); >- addAnnotation >- (spaceTypeEEnum, >- source, >- new String[] >- { >- "name", "space_._type" >- }); >- addAnnotation >- (spaceTypeObjectEDataType, >- source, >- new String[] >- { >- "name", "space_._type:Object", >- "baseType", "space_._type" >- }); >- addAnnotation >- (xmlNamespaceDocumentRootEClass, >- source, >- new String[] >- { >- "name", "", >- "kind", "mixed" >- }); >- addAnnotation >- (getXMLNamespaceDocumentRoot_Mixed(), >- source, >- new String[] >- { >- "kind", "elementWildcard", >- "name", ":mixed" >- }); >- addAnnotation >- (getXMLNamespaceDocumentRoot_XMLNSPrefixMap(), >- source, >- new String[] >- { >- "kind", "attribute", >- "name", "xmlns:prefix" >- }); >- addAnnotation >- (getXMLNamespaceDocumentRoot_XSISchemaLocation(), >- source, >- new String[] >- { >- "kind", "attribute", >- "name", "xsi:schemaLocation" >- }); >- addAnnotation >- (getXMLNamespaceDocumentRoot_Base(), >- source, >- new String[] >- { >- "kind", "attribute", >- "name", "base", >- "namespace", "##targetNamespace" >- }); >- addAnnotation >- (getXMLNamespaceDocumentRoot_Id(), >- source, >- new String[] >- { >- "kind", "attribute", >- "name", "id", >- "namespace", "##targetNamespace" >- }); >- addAnnotation >- (getXMLNamespaceDocumentRoot_Lang(), >- source, >- new String[] >- { >- "kind", "attribute", >- "name", "lang", >- "namespace", "##targetNamespace" >- }); >- addAnnotation >- (getXMLNamespaceDocumentRoot_Space(), >- source, >- new String[] >- { >- "kind", "attribute", >- "name", "space", >- "namespace", "##targetNamespace" >- }); >- } >- >-} //XMLNamespacePackageImpl >Index: src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespaceFactoryImpl.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespaceFactoryImpl.java >diff -N src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespaceFactoryImpl.java >--- src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespaceFactoryImpl.java 23 Nov 2005 18:10:02 -0000 1.9 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,301 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLNamespaceFactoryImpl.java,v 1.9 2005/11/23 18:10:02 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.xml.namespace.impl; >- >- >-import org.eclipse.emf.ecore.EClass; >-import org.eclipse.emf.ecore.EDataType; >-import org.eclipse.emf.ecore.EObject; >-import org.eclipse.emf.ecore.EPackage; >- >-import org.eclipse.emf.ecore.impl.EFactoryImpl; >-import org.eclipse.emf.ecore.plugin.EcorePlugin; >- >-import org.eclipse.emf.ecore.util.Diagnostician; >-import org.eclipse.emf.ecore.xml.namespace.*; >-import org.eclipse.emf.ecore.xml.type.XMLTypeFactory; >-import org.eclipse.emf.ecore.xml.type.XMLTypePackage; >- >- >-/** >- * <!-- begin-user-doc --> >- * An implementation of the model <b>Factory</b>. >- * <!-- end-user-doc --> >- * @generated >- */ >-public class XMLNamespaceFactoryImpl extends EFactoryImpl implements XMLNamespaceFactory >-{ >- /** >- * Creates the default factory implementation. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static XMLNamespaceFactory init() >- { >- try >- { >- XMLNamespaceFactory theXMLNamespaceFactory = (XMLNamespaceFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.w3.org/XML/1998/namespace"); >- if (theXMLNamespaceFactory != null) >- { >- return theXMLNamespaceFactory; >- } >- } >- catch (Exception exception) >- { >- EcorePlugin.INSTANCE.log(exception); >- } >- return new XMLNamespaceFactoryImpl(); >- } >- >- /** >- * Creates an instance of the factory. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLNamespaceFactoryImpl() >- { >- super(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EObject create(EClass eClass) >- { >- switch (eClass.getClassifierID()) >- { >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT: return createXMLNamespaceDocumentRoot(); >- default: >- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); >- } >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object createFromString(EDataType eDataType, String initialValue) >- { >- switch (eDataType.getClassifierID()) >- { >- case XMLNamespacePackage.SPACE_TYPE: >- return createSpaceTypeFromString(eDataType, initialValue); >- case XMLNamespacePackage.LANG_TYPE: >- return createLangTypeFromString(eDataType, initialValue); >- case XMLNamespacePackage.LANG_TYPE_NULL: >- return createLangTypeNullFromString(eDataType, initialValue); >- case XMLNamespacePackage.SPACE_TYPE_OBJECT: >- return createSpaceTypeObjectFromString(eDataType, initialValue); >- default: >- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); >- } >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertToString(EDataType eDataType, Object instanceValue) >- { >- switch (eDataType.getClassifierID()) >- { >- case XMLNamespacePackage.SPACE_TYPE: >- return convertSpaceTypeToString(eDataType, instanceValue); >- case XMLNamespacePackage.LANG_TYPE: >- return convertLangTypeToString(eDataType, instanceValue); >- case XMLNamespacePackage.LANG_TYPE_NULL: >- return convertLangTypeNullToString(eDataType, instanceValue); >- case XMLNamespacePackage.SPACE_TYPE_OBJECT: >- return convertSpaceTypeObjectToString(eDataType, instanceValue); >- default: >- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); >- } >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLNamespaceDocumentRoot createXMLNamespaceDocumentRoot() >- { >- XMLNamespaceDocumentRootImpl xmlNamespaceDocumentRoot = new XMLNamespaceDocumentRootImpl(); >- return xmlNamespaceDocumentRoot; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public SpaceType createSpaceTypeFromString(EDataType eDataType, String initialValue) >- { >- SpaceType result = SpaceType.get(initialValue); >- if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertSpaceTypeToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String createLangTypeFromString(EDataType eDataType, String initialValue) >- { >- if (initialValue == null) return null; >- String result = null; >- RuntimeException exception = null; >- try >- { >- result = (String)XMLTypeFactory.eINSTANCE.createFromString(XMLTypePackage.Literals.LANGUAGE, initialValue); >- if (result != null && Diagnostician.INSTANCE.validate(eDataType, result, null, null)) >- { >- return result; >- } >- } >- catch (RuntimeException e) >- { >- exception = e; >- } >- try >- { >- result = (String)createLangTypeNullFromString(XMLNamespacePackage.Literals.LANG_TYPE_NULL, initialValue); >- if (result != null && Diagnostician.INSTANCE.validate(eDataType, result, null, null)) >- { >- return result; >- } >- } >- catch (RuntimeException e) >- { >- exception = e; >- } >- if (result != null || exception == null) return result; >- >- throw exception; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertLangTypeToString(EDataType eDataType, Object instanceValue) >- { >- if (instanceValue == null) return null; >- if (XMLTypePackage.Literals.LANGUAGE.isInstance(instanceValue)) >- { >- try >- { >- String value = XMLTypeFactory.eINSTANCE.convertToString(XMLTypePackage.Literals.LANGUAGE, instanceValue); >- if (value != null) return value; >- } >- catch (Exception e) >- { >- } >- } >- if (XMLNamespacePackage.Literals.LANG_TYPE_NULL.isInstance(instanceValue)) >- { >- try >- { >- String value = convertLangTypeNullToString(XMLNamespacePackage.Literals.LANG_TYPE_NULL, instanceValue); >- if (value != null) return value; >- } >- catch (Exception e) >- { >- } >- } >- throw new IllegalArgumentException("Invalid value: '"+instanceValue+"' for datatype :"+eDataType.getName()); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String createLangTypeNullFromString(EDataType eDataType, String initialValue) >- { >- return (String)XMLTypeFactory.eINSTANCE.createFromString(XMLTypePackage.Literals.STRING, initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertLangTypeNullToString(EDataType eDataType, Object instanceValue) >- { >- return XMLTypeFactory.eINSTANCE.convertToString(XMLTypePackage.Literals.STRING, instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public SpaceType createSpaceTypeObjectFromString(EDataType eDataType, String initialValue) >- { >- return (SpaceType)createSpaceTypeFromString(XMLNamespacePackage.Literals.SPACE_TYPE, initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertSpaceTypeObjectToString(EDataType eDataType, Object instanceValue) >- { >- return convertSpaceTypeToString(XMLNamespacePackage.Literals.SPACE_TYPE, instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLNamespacePackage getXMLNamespacePackage() >- { >- return (XMLNamespacePackage)getEPackage(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @deprecated >- * @generated >- */ >- public static XMLNamespacePackage getPackage() >- { >- return XMLNamespacePackage.eINSTANCE; >- } >- >-} //XMLNamespaceFactoryImpl >Index: src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespaceDocumentRootImpl.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespaceDocumentRootImpl.java >diff -N src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespaceDocumentRootImpl.java >--- src/org/eclipse/emf/ecore/xml/namespace/impl/XMLNamespaceDocumentRootImpl.java 25 Nov 2005 17:49:48 -0000 1.9 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,528 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLNamespaceDocumentRootImpl.java,v 1.9 2005/11/25 17:49:48 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.xml.namespace.impl; >- >- >-import org.eclipse.emf.common.notify.Notification; >-import org.eclipse.emf.common.notify.NotificationChain; >-import org.eclipse.emf.common.util.EMap; >-import org.eclipse.emf.ecore.EClass; >-import org.eclipse.emf.ecore.EStructuralFeature; >-import org.eclipse.emf.ecore.EcorePackage; >-import org.eclipse.emf.ecore.InternalEObject; >-import org.eclipse.emf.ecore.impl.ENotificationImpl; >-import org.eclipse.emf.ecore.impl.EObjectImpl; >-import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl; >-import org.eclipse.emf.ecore.util.BasicFeatureMap; >-import org.eclipse.emf.ecore.util.EcoreEMap; >-import org.eclipse.emf.ecore.util.FeatureMap; >-import org.eclipse.emf.ecore.util.InternalEList; >-import org.eclipse.emf.ecore.xml.namespace.SpaceType; >-import org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot; >-import org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage; >- >- >-/** >- * <!-- begin-user-doc --> >- * An implementation of the model object '<em><b>Document Root</b></em>'. >- * <!-- end-user-doc --> >- * <p> >- * The following features are implemented: >- * <ul> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getMixed <em>Mixed</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getXMLNSPrefixMap <em>XMLNS Prefix Map</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getXSISchemaLocation <em>XSI Schema Location</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getBase <em>Base</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getId <em>Id</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getLang <em>Lang</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getSpace <em>Space</em>}</li> >- * </ul> >- * </p> >- * >- * @generated >- */ >-public class XMLNamespaceDocumentRootImpl extends EObjectImpl implements XMLNamespaceDocumentRoot >-{ >- /** >- * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getMixed() >- * @generated >- * @ordered >- */ >- protected FeatureMap mixed = null; >- >- /** >- * The cached value of the '{@link #getXMLNSPrefixMap() <em>XMLNS Prefix Map</em>}' map. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getXMLNSPrefixMap() >- * @generated >- * @ordered >- */ >- protected EMap xMLNSPrefixMap = null; >- >- /** >- * The cached value of the '{@link #getXSISchemaLocation() <em>XSI Schema Location</em>}' map. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getXSISchemaLocation() >- * @generated >- * @ordered >- */ >- protected EMap xSISchemaLocation = null; >- >- /** >- * The default value of the '{@link #getBase() <em>Base</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getBase() >- * @generated >- * @ordered >- */ >- protected static final String BASE_EDEFAULT = null; >- >- /** >- * The cached value of the '{@link #getBase() <em>Base</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getBase() >- * @generated >- * @ordered >- */ >- protected String base = BASE_EDEFAULT; >- >- /** >- * The default value of the '{@link #getId() <em>Id</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getId() >- * @generated >- * @ordered >- */ >- protected static final String ID_EDEFAULT = null; >- >- /** >- * The cached value of the '{@link #getId() <em>Id</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getId() >- * @generated >- * @ordered >- */ >- protected String id = ID_EDEFAULT; >- >- /** >- * The default value of the '{@link #getLang() <em>Lang</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getLang() >- * @generated >- * @ordered >- */ >- protected static final String LANG_EDEFAULT = null; >- >- /** >- * The cached value of the '{@link #getLang() <em>Lang</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getLang() >- * @generated >- * @ordered >- */ >- protected String lang = LANG_EDEFAULT; >- >- /** >- * The default value of the '{@link #getSpace() <em>Space</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getSpace() >- * @generated >- * @ordered >- */ >- protected static final SpaceType SPACE_EDEFAULT = SpaceType.PRESERVE_LITERAL; >- >- /** >- * The cached value of the '{@link #getSpace() <em>Space</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getSpace() >- * @generated >- * @ordered >- */ >- protected SpaceType space = SPACE_EDEFAULT; >- >- /** >- * This is true if the Space attribute has been set. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @ordered >- */ >- protected boolean spaceESet = false; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLNamespaceDocumentRootImpl() >- { >- super(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected EClass eStaticClass() >- { >- return XMLNamespacePackage.Literals.XML_NAMESPACE_DOCUMENT_ROOT; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public FeatureMap getMixed() >- { >- if (mixed == null) >- { >- mixed = new BasicFeatureMap(this, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED); >- } >- return mixed; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EMap getXMLNSPrefixMap() >- { >- if (xMLNSPrefixMap == null) >- { >- xMLNSPrefixMap = new EcoreEMap(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY, EStringToStringMapEntryImpl.class, this, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP); >- } >- return xMLNSPrefixMap; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EMap getXSISchemaLocation() >- { >- if (xSISchemaLocation == null) >- { >- xSISchemaLocation = new EcoreEMap(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY, EStringToStringMapEntryImpl.class, this, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); >- } >- return xSISchemaLocation; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String getBase() >- { >- return base; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void setBase(String newBase) >- { >- String oldBase = base; >- base = newBase; >- if (eNotificationRequired()) >- eNotify(new ENotificationImpl(this, Notification.SET, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__BASE, oldBase, base)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String getId() >- { >- return id; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void setId(String newId) >- { >- String oldId = id; >- id = newId; >- if (eNotificationRequired()) >- eNotify(new ENotificationImpl(this, Notification.SET, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__ID, oldId, id)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String getLang() >- { >- return lang; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void setLang(String newLang) >- { >- String oldLang = lang; >- lang = newLang; >- if (eNotificationRequired()) >- eNotify(new ENotificationImpl(this, Notification.SET, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__LANG, oldLang, lang)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public SpaceType getSpace() >- { >- return space; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void setSpace(SpaceType newSpace) >- { >- SpaceType oldSpace = space; >- space = newSpace == null ? SPACE_EDEFAULT : newSpace; >- boolean oldSpaceESet = spaceESet; >- spaceESet = true; >- if (eNotificationRequired()) >- eNotify(new ENotificationImpl(this, Notification.SET, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE, oldSpace, space, !oldSpaceESet)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void unsetSpace() >- { >- SpaceType oldSpace = space; >- boolean oldSpaceESet = spaceESet; >- space = SPACE_EDEFAULT; >- spaceESet = false; >- if (eNotificationRequired()) >- eNotify(new ENotificationImpl(this, Notification.UNSET, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE, oldSpace, SPACE_EDEFAULT, oldSpaceESet)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean isSetSpace() >- { >- return spaceESet; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) >- { >- switch (featureID) >- { >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED: >- return ((InternalEList)getMixed()).basicRemove(otherEnd, msgs); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP: >- return ((InternalEList)getXMLNSPrefixMap()).basicRemove(otherEnd, msgs); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: >- return ((InternalEList)getXSISchemaLocation()).basicRemove(otherEnd, msgs); >- } >- return eDynamicInverseRemove(otherEnd, featureID, msgs); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object eGet(int featureID, boolean resolve, boolean coreType) >- { >- switch (featureID) >- { >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED: >- if (coreType) return getMixed(); >- return ((FeatureMap.Internal)getMixed()).getWrapper(); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP: >- if (coreType) return getXMLNSPrefixMap(); >- else return getXMLNSPrefixMap().map(); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: >- if (coreType) return getXSISchemaLocation(); >- else return getXSISchemaLocation().map(); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__BASE: >- return getBase(); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__ID: >- return getId(); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__LANG: >- return getLang(); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE: >- return getSpace(); >- } >- return eDynamicGet(featureID, resolve, coreType); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void eSet(int featureID, Object newValue) >- { >- switch (featureID) >- { >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED: >- ((FeatureMap.Internal)getMixed()).set(newValue); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP: >- ((EStructuralFeature.Setting)getXMLNSPrefixMap()).set(newValue); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: >- ((EStructuralFeature.Setting)getXSISchemaLocation()).set(newValue); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__BASE: >- setBase((String)newValue); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__ID: >- setId((String)newValue); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__LANG: >- setLang((String)newValue); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE: >- setSpace((SpaceType)newValue); >- return; >- } >- eDynamicSet(featureID, newValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void eUnset(int featureID) >- { >- switch (featureID) >- { >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED: >- getMixed().clear(); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP: >- getXMLNSPrefixMap().clear(); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: >- getXSISchemaLocation().clear(); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__BASE: >- setBase(BASE_EDEFAULT); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__ID: >- setId(ID_EDEFAULT); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__LANG: >- setLang(LANG_EDEFAULT); >- return; >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE: >- unsetSpace(); >- return; >- } >- eDynamicUnset(featureID); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean eIsSet(int featureID) >- { >- switch (featureID) >- { >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED: >- return mixed != null && !mixed.isEmpty(); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP: >- return xMLNSPrefixMap != null && !xMLNSPrefixMap.isEmpty(); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: >- return xSISchemaLocation != null && !xSISchemaLocation.isEmpty(); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__BASE: >- return BASE_EDEFAULT == null ? base != null : !BASE_EDEFAULT.equals(base); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__ID: >- return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__LANG: >- return LANG_EDEFAULT == null ? lang != null : !LANG_EDEFAULT.equals(lang); >- case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE: >- return isSetSpace(); >- } >- return eDynamicIsSet(featureID); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String toString() >- { >- if (eIsProxy()) return super.toString(); >- >- StringBuffer result = new StringBuffer(super.toString()); >- result.append(" (mixed: "); >- result.append(mixed); >- result.append(", base: "); >- result.append(base); >- result.append(", id: "); >- result.append(id); >- result.append(", lang: "); >- result.append(lang); >- result.append(", space: "); >- if (spaceESet) result.append(space); else result.append("<unset>"); >- result.append(')'); >- return result.toString(); >- } >- >-} //XMLNamespaceDocumentRootImpl >Index: src/org/eclipse/emf/ecore/xml/type/impl/XMLTypeFactoryImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/xml/type/impl/XMLTypeFactoryImpl.java,v >retrieving revision 1.23 >diff -u -r1.23 XMLTypeFactoryImpl.java >--- src/org/eclipse/emf/ecore/xml/type/impl/XMLTypeFactoryImpl.java 20 Mar 2006 20:11:47 -0000 1.23 >+++ src/org/eclipse/emf/ecore/xml/type/impl/XMLTypeFactoryImpl.java 16 Nov 2007 07:20:55 -0000 >@@ -1,2906 +1,686 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-2006 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLTypeFactoryImpl.java,v 1.23 2006/03/20 20:11:47 emerks Exp $ >- */ > package org.eclipse.emf.ecore.xml.type.impl; > >-import java.math.BigDecimal; >-import java.math.BigInteger; >-import java.text.DateFormat; >-import java.text.FieldPosition; >-import java.text.ParseException; >-import java.text.SimpleDateFormat; >-import java.util.ArrayList; >-import java.util.Date; >-import java.util.Iterator; >+//import java.math.BigDecimal; >+//import java.math.BigInteger; > import java.util.List; >-import java.util.StringTokenizer; > >+import org.eclipse.emf.common.notify.Notification; >+import org.eclipse.emf.common.util.EList; >+import org.eclipse.emf.common.util.TreeIterator; >+import org.eclipse.emf.ecore.EAnnotation; > import org.eclipse.emf.ecore.EClass; > import org.eclipse.emf.ecore.EDataType; > import org.eclipse.emf.ecore.EObject; > import org.eclipse.emf.ecore.EPackage; >+import org.eclipse.emf.ecore.EReference; >+import org.eclipse.emf.ecore.EStructuralFeature; >+import org.eclipse.emf.ecore.resource.Resource; >+import org.eclipse.emf.ecore.xml.type.AnyType; >+import org.eclipse.emf.ecore.xml.type.SimpleAnyType; >+import org.eclipse.emf.ecore.xml.type.XMLTypeDocumentRoot; >+import org.eclipse.emf.ecore.xml.type.XMLTypeFactory; >+import org.eclipse.emf.ecore.xml.type.XMLTypePackage; >+ >+public class XMLTypeFactoryImpl implements XMLTypeFactory { >+ >+ public static XMLTypeFactory init() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertAnySimpleType(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertAnyURI(String instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertBase64Binary(byte[] instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertBoolean(boolean instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertBooleanObject(Boolean instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertByte(byte instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertByteObject(Byte instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertDate(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertDateTime(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertDouble(double instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertDoubleObject(Double instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertDuration(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertENTITIES(List instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertENTITIESBase(List instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertENTITY(String instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertFloat(float instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertFloatObject(Float instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertGDay(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertGMonth(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertGMonthDay(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertGYear(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertGYearMonth(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertHexBinary(byte[] instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertID(String instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertIDREF(String instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertIDREFS(List instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertIDREFSBase(List instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertInt(int instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertIntObject(Integer instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertLanguage(String instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertLong(long instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertLongObject(Long instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertNCName(String instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertNMTOKEN(String instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertNMTOKENS(List instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertNMTOKENSBase(List instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertNOTATION(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertName(String instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertNormalizedString(String instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertQName(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertShort(short instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertShortObject(Short instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertString(String instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertTime(Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertToken(String instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertUnsignedByte(short instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertUnsignedByteObject(Short instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertUnsignedInt(long instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertUnsignedIntObject(Long instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertUnsignedShort(int instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertUnsignedShortObject(Integer instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createAnySimpleType(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public AnyType createAnyType() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String createAnyURI(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public byte[] createBase64Binary(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public boolean createBoolean(String literal) { >+ // TODO Auto-generated method stub >+ return false; >+ } >+ >+ public Boolean createBooleanObject(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public byte createByte(String literal) { >+ // TODO Auto-generated method stub >+ return 0; >+ } >+ >+ public Byte createByteObject(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createDate(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createDateTime(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public double createDouble(String literal) { >+ // TODO Auto-generated method stub >+ return 0; >+ } >+ >+ public Double createDoubleObject(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createDuration(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public List createENTITIES(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public List createENTITIESBase(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String createENTITY(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public float createFloat(String literal) { >+ // TODO Auto-generated method stub >+ return 0; >+ } >+ >+ public Float createFloatObject(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createGDay(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createGMonth(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createGMonthDay(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createGYear(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createGYearMonth(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public byte[] createHexBinary(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String createID(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String createIDREF(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public List createIDREFS(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public List createIDREFSBase(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public int createInt(String literal) { >+ // TODO Auto-generated method stub >+ return 0; >+ } >+ >+ public Integer createIntObject(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String createLanguage(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public long createLong(String literal) { >+ // TODO Auto-generated method stub >+ return 0; >+ } >+ >+ public Long createLongObject(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String createNCName(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String createNMTOKEN(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public List createNMTOKENS(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public List createNMTOKENSBase(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createNOTATION(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String createName(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String createNormalizedString(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createQName(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public short createShort(String literal) { >+ // TODO Auto-generated method stub >+ return 0; >+ } >+ >+ public Short createShortObject(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public SimpleAnyType createSimpleAnyType() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String createString(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createTime(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String createToken(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public short createUnsignedByte(String literal) { >+ // TODO Auto-generated method stub >+ return 0; >+ } >+ >+ public Short createUnsignedByteObject(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public long createUnsignedInt(String literal) { >+ // TODO Auto-generated method stub >+ return 0; >+ } >+ >+ public Long createUnsignedIntObject(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public int createUnsignedShort(String literal) { >+ // TODO Auto-generated method stub >+ return 0; >+ } >+ >+ public Integer createUnsignedShortObject(String literal) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public XMLTypeDocumentRoot createXMLTypeDocumentRoot() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public XMLTypePackage getXMLTypePackage() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String convertToString(EDataType dataType, Object instanceValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EObject create(EClass class1) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object createFromString(EDataType dataType, String literalValue) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EPackage getEPackage() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public void setEPackage(EPackage value) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public EAnnotation getEAnnotation(String source) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EList getEAnnotations() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public TreeIterator eAllContents() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EClass eClass() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EObject eContainer() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EStructuralFeature eContainingFeature() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EReference eContainmentFeature() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EList eContents() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EList eCrossReferences() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object eGet(EStructuralFeature feature) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object eGet(EStructuralFeature feature, boolean resolve) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public boolean eIsProxy() { >+ // TODO Auto-generated method stub >+ return false; >+ } >+ >+ public boolean eIsSet(EStructuralFeature feature) { >+ // TODO Auto-generated method stub >+ return false; >+ } >+ >+ public Resource eResource() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public void eSet(EStructuralFeature feature, Object newValue) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public void eUnset(EStructuralFeature feature) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public EList eAdapters() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public boolean eDeliver() { >+ // TODO Auto-generated method stub >+ return false; >+ } >+ >+ public void eNotify(Notification notification) { >+ // TODO Auto-generated method stub > >-import org.eclipse.emf.ecore.impl.EFactoryImpl; >-import org.eclipse.emf.ecore.plugin.EcorePlugin; >+ } > >-import org.eclipse.emf.ecore.xml.type.*; >-import org.eclipse.emf.ecore.xml.type.internal.QName; >-import org.eclipse.emf.ecore.xml.type.internal.XMLCalendar; >-import org.eclipse.emf.ecore.xml.type.internal.XMLDuration; >-import org.eclipse.emf.ecore.xml.type.internal.DataValue.Base64; >-import org.eclipse.emf.ecore.xml.type.internal.DataValue.HexBin; >- >-/** >- * <!-- begin-user-doc --> >- * An implementation of the model <b>Factory</b>. >- * <!-- end-user-doc --> >- * @generated >- */ >-public class XMLTypeFactoryImpl extends EFactoryImpl implements XMLTypeFactory >-{ >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createAnySimpleType(String literal) >- { >- return literal; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertAnySimpleType(Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createAnyURI(String literal) >- { >- // Per Schema 1.0 it is not clear if the result returned should be a valid URI. >- // For the future if we plant to surport IRIs then it is better not to massage >- // the initialValue. >- // We should thought consider where would be the best way to validate anyURI values -- EL >- >- /*initialValue = collapseWhiteSpace(initialValue); >- if (initialValue != null) >- { >- //encode special characters using XLink 5.4 algorithm >- initialValue = URI.encode(initialValue); >- // Support for relative URLs >- // According to Java 1.1: URLs may also be specified with a >- // String and the URL object that it is related to. >- try >- { >- new URI(URI.BASE_URI, initialValue); >- } >- catch (URI.MalformedURIException e) >- { >- throw new InvalidDatatypeValueException("Invalid anyURI value: '"+initialValue+"' :"+e.toString()); >- } >- }*/ >- return literal; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertAnyURI(String instanceValue) >- { >- return instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public byte[] createBase64Binary(String literal) >- { >- if (literal == null) return null; >- byte[] value = Base64.decode(collapseWhiteSpace(literal)); >- if (value == null) >- { >- throw new InvalidDatatypeValueException("Invalid base64Binary value: '" + literal + "'"); >- } >- return value; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertBase64Binary(byte[] instanceValue) >- { >- return instanceValue == null ? null : Base64.encode(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public boolean createBoolean(String initialValue) >- { >- return initialValue == null ? false : primitiveBooleanValueOf(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertBoolean(boolean instanceValue) >- { >- return instanceValue ? "true" : "false"; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Boolean createBooleanObject(String literal) >- { >- return literal == null ? null : booleanValueOf(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertBooleanObject(Boolean instanceValue) >- { >- return instanceValue == null ? null : convertBoolean(instanceValue.booleanValue()); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public byte createByte(String literal) >- { >- return literal == null ? 0 : Byte.parseByte(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertByte(byte instanceValue) >- { >- return Byte.toString(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Byte createByteObject(String literal) >- { >- return literal == null ? null : Byte.valueOf(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertByteObject(Byte instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createDate(String literal) >- { >- return literal == null ? null : new XMLCalendar(collapseWhiteSpace(literal), XMLCalendar.DATE); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDate(Object instanceValue) >- { >- if (instanceValue == null) >- { >- return null; >- } >- if (instanceValue instanceof Date) >- { >- // Bug 124306: we should rely on XMLCalendar to normalize Dave value, to ensure that all Date value >- // fields are taken into account. >- return new XMLCalendar((Date)instanceValue, XMLCalendar.DATE).toString(); >- } >- return instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createDateTime(String literal) >- { >- return literal == null ? null : new XMLCalendar(collapseWhiteSpace(literal), XMLCalendar.DATETIME); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDateTime(Object instanceValue) >- { >- if (instanceValue == null) >- { >- return null; >- } >- if (instanceValue instanceof Date) >- { >- return EDATE_FORMATS[0].format((Date)instanceValue); >- } >- return instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public BigDecimal createDecimal(String literal) >- { >- return literal == null ? null : new BigDecimal(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDecimal(BigDecimal instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public double createDouble(String literal) >- { >- return literal == null ? 0.0 : Double.parseDouble(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDouble(double instanceValue) >- { >- return Double.toString(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Double createDoubleObject(String literal) >- { >- return literal == null ? null : Double.valueOf(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDoubleObject(Double instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createDuration(String literal) >- { >- return literal == null ? null : new XMLDuration(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDuration(Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public List createENTITIES(String literal) >- { >- return createENTITIESBase(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List createENTITIESFromString(EDataType eDataType, String initialValue) >- { >- return (List)createENTITIESBaseFromString(XMLTypePackage.Literals.ENTITIES_BASE, initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertENTITIES(List instanceValue) >- { >- return convertENTITIESBase(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertENTITIESToString(EDataType eDataType, Object instanceValue) >- { >- return convertENTITIESBaseToString(XMLTypePackage.Literals.ENTITIES_BASE, instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List createENTITIESBase(String literal) >- { >- if (literal == null) return null; >- List result = new ArrayList(); >- for (StringTokenizer stringTokenizer = new StringTokenizer(literal); stringTokenizer.hasMoreTokens(); ) >- { >- String item = stringTokenizer.nextToken(); >- result.add(createENTITY(item)); >- } >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List createENTITIESBaseFromString(EDataType eDataType, String initialValue) >- { >- return createENTITIESBase(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertENTITIESBase(List instanceValue) >- { >- if (instanceValue == null) return null; >- if (instanceValue.isEmpty()) return ""; >- StringBuffer result = new StringBuffer(); >- for (Iterator i = instanceValue.iterator(); i.hasNext(); ) >- { >- result.append(convertENTITY((String)i.next())); >- result.append(' '); >- } >- return result.substring(0, result.length() - 1); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertENTITIESBaseToString(EDataType eDataType, Object instanceValue) >- { >- if (instanceValue == null) return null; >- List list = (List)instanceValue; >- if (list.isEmpty()) return ""; >- StringBuffer result = new StringBuffer(); >- for (Iterator i = list.iterator(); i.hasNext(); ) >- { >- result.append(convertENTITYToString(XMLTypePackage.Literals.ENTITY, i.next())); >- result.append(' '); >- } >- return result.substring(0, result.length() - 1); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createENTITY(String literal) >- { >- return literal; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertENTITY(String instanceValue) >- { >- return instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public float createFloat(String literal) >- { >- return literal == null ? 0.0F : Float.parseFloat(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertFloat(float instanceValue) >- { >- return Float.toString(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Float createFloatObject(String literal) >- { >- return literal == null ? null : Float.valueOf(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertFloatObject(Float instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createGDay(String literal) >- { >- return literal == null ? null : new XMLCalendar(collapseWhiteSpace(literal), XMLCalendar.GDAY); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertGDay(Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createGMonth(String literal) >- { >- return literal == null ? null : new XMLCalendar(collapseWhiteSpace(literal), XMLCalendar.GMONTH); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertGMonth(Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createGMonthDay(String literal) >- { >- return literal == null ? null : new XMLCalendar(collapseWhiteSpace(literal), XMLCalendar.GMONTHDAY); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertGMonthDay(Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createGYear(String literal) >- { >- return literal == null ? null : new XMLCalendar(collapseWhiteSpace(literal), XMLCalendar.GYEAR); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertGYear(Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createGYearMonth(String literal) >- { >- return literal == null ? null : new XMLCalendar(collapseWhiteSpace(literal), XMLCalendar.GYEARMONTH); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertGYearMonth(Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public byte[] createHexBinary(String literal) >- { >- if (literal == null) return null; >- byte[] value = HexBin.decode(collapseWhiteSpace(literal)); >- if (value == null) >- { >- throw new InvalidDatatypeValueException("Invalid hexBinary value: '" + literal + "'"); >- } >- return value; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertHexBinary(byte[] instanceValue) >- { >- return instanceValue == null ? null : HexBin.encode((byte[])instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createID(String literal) >- { >- return (String)createNCNameFromString(XMLTypePackage.Literals.NC_NAME, literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createIDFromString(EDataType eDataType, String initialValue) >- { >- return initialValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertID(String instanceValue) >- { >- return instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createIDREF(String literal) >- { >- return literal; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createIDREFFromString(EDataType eDataType, String initialValue) >- { >- return initialValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertIDREF(String instanceValue) >- { >- return instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public List createIDREFS(String literal) >- { >- return createIDREFSBase(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List createIDREFSFromString(EDataType eDataType, String initialValue) >- { >- return (List)createIDREFSBaseFromString(XMLTypePackage.Literals.IDREFS_BASE, initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertIDREFS(List instanceValue) >- { >- return convertIDREFSBase(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertIDREFSToString(EDataType eDataType, Object instanceValue) >- { >- return convertIDREFSBaseToString(XMLTypePackage.Literals.IDREFS_BASE, instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List createIDREFSBase(String literal) >- { >- if (literal == null) return null; >- List result = new ArrayList(); >- for (StringTokenizer stringTokenizer = new StringTokenizer(literal); stringTokenizer.hasMoreTokens(); ) >- { >- String item = stringTokenizer.nextToken(); >- result.add(createIDREF(item)); >- } >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List createIDREFSBaseFromString(EDataType eDataType, String initialValue) >- { >- return createIDREFSBase(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertIDREFSBase(List instanceValue) >- { >- if (instanceValue == null) return null; >- if (instanceValue.isEmpty()) return ""; >- StringBuffer result = new StringBuffer(); >- for (Iterator i = instanceValue.iterator(); i.hasNext(); ) >- { >- result.append(convertIDREF((String)i.next())); >- result.append(' '); >- } >- return result.substring(0, result.length() - 1); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertIDREFSBaseToString(EDataType eDataType, Object instanceValue) >- { >- return convertIDREFSBase((List)instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public int createInt(String initialValue) >- { >- return initialValue == null ? 0 : Integer.parseInt(collapseWhiteSpace(initialValue)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertInt(int instanceValue) >- { >- return Integer.toString(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public BigInteger createInteger(String literal) >- { >- return literal == null ? null : new BigInteger(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertInteger(BigInteger instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Integer createIntObject(String literal) >- { >- return literal == null ? null : Integer.valueOf(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertIntObject(Integer instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createLanguage(String literal) >- { >- return collapseWhiteSpace(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertLanguage(String instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public long createLong(String literal) >- { >- return literal == null ? 0L : Long.parseLong(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertLong(long instanceValue) >- { >- return Long.toString(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Long createLongObject(String literal) >- { >- return literal == null ? null : Long.valueOf(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertLongObject(Long instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createName(String literal) >- { >- return literal; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertName(String instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createNCName(String literal) >- { >- return literal; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNCName(String instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public BigInteger createNegativeInteger(String literal) >- { >- return (BigInteger)createNonPositiveIntegerFromString(XMLTypePackage.Literals.NON_POSITIVE_INTEGER, literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigInteger createNegativeIntegerFromString(EDataType eDataType, String initialValue) >- { >- return (BigInteger)createNonPositiveIntegerFromString(XMLTypePackage.Literals.NON_POSITIVE_INTEGER, initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertNegativeInteger(BigInteger instanceValue) >- { >- return convertNonPositiveInteger(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertNegativeIntegerToString(EDataType eDataType, Object instanceValue) >- { >- return convertNonPositiveIntegerToString(XMLTypePackage.Literals.NON_POSITIVE_INTEGER, instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createNMTOKEN(String literal) >- { >- if (literal == null) return null; >- return literal; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNMTOKEN(String instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List createNMTOKENS(String literal) >- { >- return createNMTOKENSBase(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List createNMTOKENSFromString(EDataType eDataType, String initialValue) >- { >- return (List)createNMTOKENSBaseFromString(XMLTypePackage.Literals.NMTOKENS_BASE, initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertNMTOKENS(List instanceValue) >- { >- return convertNMTOKENSBase(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertNMTOKENSToString(EDataType eDataType, Object instanceValue) >- { >- return convertNMTOKENSBaseToString(XMLTypePackage.Literals.NMTOKENS_BASE, instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List createNMTOKENSBase(String literal) >- { >- if (literal == null) return null; >- List result = new ArrayList(); >- for (StringTokenizer stringTokenizer = new StringTokenizer(literal); stringTokenizer.hasMoreTokens(); ) >- { >- String item = stringTokenizer.nextToken(); >- result.add(createNMTOKEN(item)); >- } >- return result; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public List createNMTOKENSBaseFromString(EDataType eDataType, String initialValue) >- { >- return createNMTOKENSBase(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertNMTOKENSBase(List instanceValue) >- { >- if (instanceValue == null) return null; >- if (instanceValue.isEmpty()) return ""; >- StringBuffer result = new StringBuffer(); >- for (Iterator i = instanceValue.iterator(); i.hasNext(); ) >- { >- result.append(convertNMTOKEN((String)i.next())); >- result.append(' '); >- } >- return result.substring(0, result.length() - 1); >- } >- >- public String convertNMTOKENSBaseToString(EDataType eDataType, Object instanceValue) >- { >- if (instanceValue == null) return null; >- List list = (List)instanceValue; >- if (list.isEmpty()) return ""; >- StringBuffer result = new StringBuffer(); >- for (Iterator i = list.iterator(); i.hasNext(); ) >- { >- result.append(convertNMTOKENToString(XMLTypePackage.Literals.NMTOKEN, i.next())); >- result.append(' '); >- } >- return result.substring(0, result.length() - 1); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public BigInteger createNonNegativeInteger(String literal) >- { >- return literal == null ? null : new BigInteger(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNonNegativeInteger(BigInteger instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public BigInteger createNonPositiveInteger(String literal) >- { >- return literal == null ? null : new BigInteger(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNonPositiveInteger(BigInteger instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createNormalizedString(String literal) >- { >- return replaceWhiteSpace(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNormalizedString(String instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createNOTATION(String literal) >- { >- return literal == null ? null : new QName(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNOTATION(Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigInteger createPositiveInteger(String literal) >- { >- return createNonNegativeInteger(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigInteger createPositiveIntegerFromString(EDataType eDataType, String initialValue) >- { >- return (BigInteger)createNonNegativeIntegerFromString(XMLTypePackage.Literals.NON_NEGATIVE_INTEGER, initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertPositiveInteger(BigInteger instanceValue) >- { >- return convertNonNegativeInteger(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertPositiveIntegerToString(EDataType eDataType, Object instanceValue) >- { >- return convertNonNegativeIntegerToString(XMLTypePackage.Literals.NON_NEGATIVE_INTEGER, instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createQName(String literal) >- { >- return literal == null ? null : new QName(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertQName(Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public short createShort(String literal) >- { >- return literal == null ? 0 : Short.parseShort(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertShort(short instanceValue) >- { >- return Short.toString(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Short createShortObject(String literal) >- { >- return literal == null ? null : Short.valueOf(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertShortObject(Short instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createString(String initialValue) >- { >- return initialValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertString(String instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createTime(String literal) >- { >- return literal == null ? null : new XMLCalendar(collapseWhiteSpace(literal), XMLCalendar.TIME); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertTime(Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createToken(String literal) >- { >- return collapseWhiteSpace(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertToken(String instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public short createUnsignedByte(String literal) >- { >- return literal == null ? 0 : Short.parseShort(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedByte(short instanceValue) >- { >- return Short.toString(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Short createUnsignedByteObject(String literal) >- { >- return literal == null ? null : new Short(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedByteObject(Short instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public long createUnsignedInt(String literal) >- { >- return literal == null ? 0 : Long.parseLong(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedInt(long instanceValue) >- { >- return Long.toString(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Long createUnsignedIntObject(String literal) >- { >- return literal == null ? null : Long.valueOf(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedIntObject(Long instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigInteger createUnsignedLong(String literal) >- { >- return createNonNegativeInteger(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public BigInteger createUnsignedLongFromString(EDataType eDataType, String initialValue) >- { >- return (BigInteger)createNonNegativeIntegerFromString(XMLTypePackage.Literals.NON_NEGATIVE_INTEGER, initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertUnsignedLong(BigInteger instanceValue) >- { >- return convertNonNegativeInteger(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertUnsignedLongToString(EDataType eDataType, Object instanceValue) >- { >- return convertNonNegativeIntegerToString(XMLTypePackage.Literals.NON_NEGATIVE_INTEGER, instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public int createUnsignedShort(String literal) >- { >- return literal == null ? 0 : Integer.parseInt(literal); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedShort(int instanceValue) >- { >- return Integer.toString(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Integer createUnsignedShortObject(String literal) >- { >- return literal == null ? null : Integer.valueOf(collapseWhiteSpace(literal)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedShortObject(Integer instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * Creates the default factory implementation. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static XMLTypeFactory init() >- { >- try >- { >- XMLTypeFactory theXMLTypeFactory = (XMLTypeFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/2003/XMLType"); >- if (theXMLTypeFactory != null) >- { >- return theXMLTypeFactory; >- } >- } >- catch (Exception exception) >- { >- EcorePlugin.INSTANCE.log(exception); >- } >- return new XMLTypeFactoryImpl(); >- } >- >- protected static final DateFormat [] EDATE_FORMATS = >- { >- new SafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"), >- new SafeSimpleDateFormat("yyyy-MM-ddZ") >- }; >- >- /** >- * Creates an instance of the factory. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeFactoryImpl() >- { >- super(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EObject create(EClass eClass) >- { >- switch (eClass.getClassifierID()) >- { >- case XMLTypePackage.ANY_TYPE: return createAnyType(); >- case XMLTypePackage.SIMPLE_ANY_TYPE: return createSimpleAnyType(); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT: return createXMLTypeDocumentRoot(); >- default: >- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); >- } >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object createFromString(EDataType eDataType, String initialValue) >- { >- switch (eDataType.getClassifierID()) >- { >- case XMLTypePackage.ANY_SIMPLE_TYPE: >- return createAnySimpleTypeFromString(eDataType, initialValue); >- case XMLTypePackage.ANY_URI: >- return createAnyURIFromString(eDataType, initialValue); >- case XMLTypePackage.BASE64_BINARY: >- return createBase64BinaryFromString(eDataType, initialValue); >- case XMLTypePackage.BOOLEAN: >- return createBooleanFromString(eDataType, initialValue); >- case XMLTypePackage.BOOLEAN_OBJECT: >- return createBooleanObjectFromString(eDataType, initialValue); >- case XMLTypePackage.BYTE: >- return createByteFromString(eDataType, initialValue); >- case XMLTypePackage.BYTE_OBJECT: >- return createByteObjectFromString(eDataType, initialValue); >- case XMLTypePackage.DATE: >- return createDateFromString(eDataType, initialValue); >- case XMLTypePackage.DATE_TIME: >- return createDateTimeFromString(eDataType, initialValue); >- case XMLTypePackage.DECIMAL: >- return createDecimalFromString(eDataType, initialValue); >- case XMLTypePackage.DOUBLE: >- return createDoubleFromString(eDataType, initialValue); >- case XMLTypePackage.DOUBLE_OBJECT: >- return createDoubleObjectFromString(eDataType, initialValue); >- case XMLTypePackage.DURATION: >- return createDurationFromString(eDataType, initialValue); >- case XMLTypePackage.ENTITIES: >- return createENTITIESFromString(eDataType, initialValue); >- case XMLTypePackage.ENTITIES_BASE: >- return createENTITIESBaseFromString(eDataType, initialValue); >- case XMLTypePackage.ENTITY: >- return createENTITYFromString(eDataType, initialValue); >- case XMLTypePackage.FLOAT: >- return createFloatFromString(eDataType, initialValue); >- case XMLTypePackage.FLOAT_OBJECT: >- return createFloatObjectFromString(eDataType, initialValue); >- case XMLTypePackage.GDAY: >- return createGDayFromString(eDataType, initialValue); >- case XMLTypePackage.GMONTH: >- return createGMonthFromString(eDataType, initialValue); >- case XMLTypePackage.GMONTH_DAY: >- return createGMonthDayFromString(eDataType, initialValue); >- case XMLTypePackage.GYEAR: >- return createGYearFromString(eDataType, initialValue); >- case XMLTypePackage.GYEAR_MONTH: >- return createGYearMonthFromString(eDataType, initialValue); >- case XMLTypePackage.HEX_BINARY: >- return createHexBinaryFromString(eDataType, initialValue); >- case XMLTypePackage.ID: >- return createIDFromString(eDataType, initialValue); >- case XMLTypePackage.IDREF: >- return createIDREFFromString(eDataType, initialValue); >- case XMLTypePackage.IDREFS: >- return createIDREFSFromString(eDataType, initialValue); >- case XMLTypePackage.IDREFS_BASE: >- return createIDREFSBaseFromString(eDataType, initialValue); >- case XMLTypePackage.INT: >- return createIntFromString(eDataType, initialValue); >- case XMLTypePackage.INTEGER: >- return createIntegerFromString(eDataType, initialValue); >- case XMLTypePackage.INT_OBJECT: >- return createIntObjectFromString(eDataType, initialValue); >- case XMLTypePackage.LANGUAGE: >- return createLanguageFromString(eDataType, initialValue); >- case XMLTypePackage.LONG: >- return createLongFromString(eDataType, initialValue); >- case XMLTypePackage.LONG_OBJECT: >- return createLongObjectFromString(eDataType, initialValue); >- case XMLTypePackage.NAME: >- return createNameFromString(eDataType, initialValue); >- case XMLTypePackage.NC_NAME: >- return createNCNameFromString(eDataType, initialValue); >- case XMLTypePackage.NEGATIVE_INTEGER: >- return createNegativeIntegerFromString(eDataType, initialValue); >- case XMLTypePackage.NMTOKEN: >- return createNMTOKENFromString(eDataType, initialValue); >- case XMLTypePackage.NMTOKENS: >- return createNMTOKENSFromString(eDataType, initialValue); >- case XMLTypePackage.NMTOKENS_BASE: >- return createNMTOKENSBaseFromString(eDataType, initialValue); >- case XMLTypePackage.NON_NEGATIVE_INTEGER: >- return createNonNegativeIntegerFromString(eDataType, initialValue); >- case XMLTypePackage.NON_POSITIVE_INTEGER: >- return createNonPositiveIntegerFromString(eDataType, initialValue); >- case XMLTypePackage.NORMALIZED_STRING: >- return createNormalizedStringFromString(eDataType, initialValue); >- case XMLTypePackage.NOTATION: >- return createNOTATIONFromString(eDataType, initialValue); >- case XMLTypePackage.POSITIVE_INTEGER: >- return createPositiveIntegerFromString(eDataType, initialValue); >- case XMLTypePackage.QNAME: >- return createQNameFromString(eDataType, initialValue); >- case XMLTypePackage.SHORT: >- return createShortFromString(eDataType, initialValue); >- case XMLTypePackage.SHORT_OBJECT: >- return createShortObjectFromString(eDataType, initialValue); >- case XMLTypePackage.STRING: >- return createStringFromString(eDataType, initialValue); >- case XMLTypePackage.TIME: >- return createTimeFromString(eDataType, initialValue); >- case XMLTypePackage.TOKEN: >- return createTokenFromString(eDataType, initialValue); >- case XMLTypePackage.UNSIGNED_BYTE: >- return createUnsignedByteFromString(eDataType, initialValue); >- case XMLTypePackage.UNSIGNED_BYTE_OBJECT: >- return createUnsignedByteObjectFromString(eDataType, initialValue); >- case XMLTypePackage.UNSIGNED_INT: >- return createUnsignedIntFromString(eDataType, initialValue); >- case XMLTypePackage.UNSIGNED_INT_OBJECT: >- return createUnsignedIntObjectFromString(eDataType, initialValue); >- case XMLTypePackage.UNSIGNED_LONG: >- return createUnsignedLongFromString(eDataType, initialValue); >- case XMLTypePackage.UNSIGNED_SHORT: >- return createUnsignedShortFromString(eDataType, initialValue); >- case XMLTypePackage.UNSIGNED_SHORT_OBJECT: >- return createUnsignedShortObjectFromString(eDataType, initialValue); >- default: >- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); >- } >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String convertToString(EDataType eDataType, Object instanceValue) >- { >- switch (eDataType.getClassifierID()) >- { >- case XMLTypePackage.ANY_SIMPLE_TYPE: >- return convertAnySimpleTypeToString(eDataType, instanceValue); >- case XMLTypePackage.ANY_URI: >- return convertAnyURIToString(eDataType, instanceValue); >- case XMLTypePackage.BASE64_BINARY: >- return convertBase64BinaryToString(eDataType, instanceValue); >- case XMLTypePackage.BOOLEAN: >- return convertBooleanToString(eDataType, instanceValue); >- case XMLTypePackage.BOOLEAN_OBJECT: >- return convertBooleanObjectToString(eDataType, instanceValue); >- case XMLTypePackage.BYTE: >- return convertByteToString(eDataType, instanceValue); >- case XMLTypePackage.BYTE_OBJECT: >- return convertByteObjectToString(eDataType, instanceValue); >- case XMLTypePackage.DATE: >- return convertDateToString(eDataType, instanceValue); >- case XMLTypePackage.DATE_TIME: >- return convertDateTimeToString(eDataType, instanceValue); >- case XMLTypePackage.DECIMAL: >- return convertDecimalToString(eDataType, instanceValue); >- case XMLTypePackage.DOUBLE: >- return convertDoubleToString(eDataType, instanceValue); >- case XMLTypePackage.DOUBLE_OBJECT: >- return convertDoubleObjectToString(eDataType, instanceValue); >- case XMLTypePackage.DURATION: >- return convertDurationToString(eDataType, instanceValue); >- case XMLTypePackage.ENTITIES: >- return convertENTITIESToString(eDataType, instanceValue); >- case XMLTypePackage.ENTITIES_BASE: >- return convertENTITIESBaseToString(eDataType, instanceValue); >- case XMLTypePackage.ENTITY: >- return convertENTITYToString(eDataType, instanceValue); >- case XMLTypePackage.FLOAT: >- return convertFloatToString(eDataType, instanceValue); >- case XMLTypePackage.FLOAT_OBJECT: >- return convertFloatObjectToString(eDataType, instanceValue); >- case XMLTypePackage.GDAY: >- return convertGDayToString(eDataType, instanceValue); >- case XMLTypePackage.GMONTH: >- return convertGMonthToString(eDataType, instanceValue); >- case XMLTypePackage.GMONTH_DAY: >- return convertGMonthDayToString(eDataType, instanceValue); >- case XMLTypePackage.GYEAR: >- return convertGYearToString(eDataType, instanceValue); >- case XMLTypePackage.GYEAR_MONTH: >- return convertGYearMonthToString(eDataType, instanceValue); >- case XMLTypePackage.HEX_BINARY: >- return convertHexBinaryToString(eDataType, instanceValue); >- case XMLTypePackage.ID: >- return convertIDToString(eDataType, instanceValue); >- case XMLTypePackage.IDREF: >- return convertIDREFToString(eDataType, instanceValue); >- case XMLTypePackage.IDREFS: >- return convertIDREFSToString(eDataType, instanceValue); >- case XMLTypePackage.IDREFS_BASE: >- return convertIDREFSBaseToString(eDataType, instanceValue); >- case XMLTypePackage.INT: >- return convertIntToString(eDataType, instanceValue); >- case XMLTypePackage.INTEGER: >- return convertIntegerToString(eDataType, instanceValue); >- case XMLTypePackage.INT_OBJECT: >- return convertIntObjectToString(eDataType, instanceValue); >- case XMLTypePackage.LANGUAGE: >- return convertLanguageToString(eDataType, instanceValue); >- case XMLTypePackage.LONG: >- return convertLongToString(eDataType, instanceValue); >- case XMLTypePackage.LONG_OBJECT: >- return convertLongObjectToString(eDataType, instanceValue); >- case XMLTypePackage.NAME: >- return convertNameToString(eDataType, instanceValue); >- case XMLTypePackage.NC_NAME: >- return convertNCNameToString(eDataType, instanceValue); >- case XMLTypePackage.NEGATIVE_INTEGER: >- return convertNegativeIntegerToString(eDataType, instanceValue); >- case XMLTypePackage.NMTOKEN: >- return convertNMTOKENToString(eDataType, instanceValue); >- case XMLTypePackage.NMTOKENS: >- return convertNMTOKENSToString(eDataType, instanceValue); >- case XMLTypePackage.NMTOKENS_BASE: >- return convertNMTOKENSBaseToString(eDataType, instanceValue); >- case XMLTypePackage.NON_NEGATIVE_INTEGER: >- return convertNonNegativeIntegerToString(eDataType, instanceValue); >- case XMLTypePackage.NON_POSITIVE_INTEGER: >- return convertNonPositiveIntegerToString(eDataType, instanceValue); >- case XMLTypePackage.NORMALIZED_STRING: >- return convertNormalizedStringToString(eDataType, instanceValue); >- case XMLTypePackage.NOTATION: >- return convertNOTATIONToString(eDataType, instanceValue); >- case XMLTypePackage.POSITIVE_INTEGER: >- return convertPositiveIntegerToString(eDataType, instanceValue); >- case XMLTypePackage.QNAME: >- return convertQNameToString(eDataType, instanceValue); >- case XMLTypePackage.SHORT: >- return convertShortToString(eDataType, instanceValue); >- case XMLTypePackage.SHORT_OBJECT: >- return convertShortObjectToString(eDataType, instanceValue); >- case XMLTypePackage.STRING: >- return convertStringToString(eDataType, instanceValue); >- case XMLTypePackage.TIME: >- return convertTimeToString(eDataType, instanceValue); >- case XMLTypePackage.TOKEN: >- return convertTokenToString(eDataType, instanceValue); >- case XMLTypePackage.UNSIGNED_BYTE: >- return convertUnsignedByteToString(eDataType, instanceValue); >- case XMLTypePackage.UNSIGNED_BYTE_OBJECT: >- return convertUnsignedByteObjectToString(eDataType, instanceValue); >- case XMLTypePackage.UNSIGNED_INT: >- return convertUnsignedIntToString(eDataType, instanceValue); >- case XMLTypePackage.UNSIGNED_INT_OBJECT: >- return convertUnsignedIntObjectToString(eDataType, instanceValue); >- case XMLTypePackage.UNSIGNED_LONG: >- return convertUnsignedLongToString(eDataType, instanceValue); >- case XMLTypePackage.UNSIGNED_SHORT: >- return convertUnsignedShortToString(eDataType, instanceValue); >- case XMLTypePackage.UNSIGNED_SHORT_OBJECT: >- return convertUnsignedShortObjectToString(eDataType, instanceValue); >- default: >- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); >- } >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public AnyType createAnyType() >- { >- AnyTypeImpl anyType = new AnyTypeImpl(); >- return anyType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public SimpleAnyType createSimpleAnyType() >- { >- SimpleAnyTypeImpl simpleAnyType = new SimpleAnyTypeImpl(); >- return simpleAnyType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeDocumentRoot createXMLTypeDocumentRoot() >- { >- XMLTypeDocumentRootImpl xmlTypeDocumentRoot = new XMLTypeDocumentRootImpl(); >- return xmlTypeDocumentRoot; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createAnySimpleTypeFromString(EDataType eDataType, String initialValue) >- { >- return createAnySimpleType(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertAnySimpleTypeToString(EDataType eDataType, Object instanceValue) >- { >- return convertAnySimpleType(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createAnyURIFromString(EDataType eDataType, String initialValue) >- { >- return createAnyURI(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertAnyURIToString(EDataType eDataType, Object instanceValue) >- { >- return convertAnyURI((String)instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public byte[] createBase64BinaryFromString(EDataType eDataType, String initialValue) >- { >- return createBase64Binary(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertBase64BinaryToString(EDataType eDataType, Object instanceValue) >- { >- return convertBase64Binary((byte[])instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Boolean createBooleanFromString(EDataType eDataType, String initialValue) >- { >- return createBooleanObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertBooleanToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Boolean createBooleanObjectFromString(EDataType eDataType, String initialValue) >- { >- return initialValue == null ? null : booleanValueOf(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertBooleanObjectToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public BigDecimal createDecimalFromString(EDataType eDataType, String initialValue) >- { >- return createDecimal(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDecimalToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public BigInteger createIntegerFromString(EDataType eDataType, String initialValue) >- { >- return createInteger(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertIntegerToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Integer createIntObjectFromString(EDataType eDataType, String initialValue) >- { >- return createIntObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertIntObjectToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Long createLongFromString(EDataType eDataType, String initialValue) >- { >- return createLongObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertLongToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Long createLongObjectFromString(EDataType eDataType, String initialValue) >- { >- return createLongObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertLongObjectToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Integer createIntFromString(EDataType eDataType, String initialValue) >- { >- return createIntObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertIntToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Short createShortFromString(EDataType eDataType, String initialValue) >- { >- return createShortObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertShortToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Short createShortObjectFromString(EDataType eDataType, String initialValue) >- { >- return createShortObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertShortObjectToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Byte createByteFromString(EDataType eDataType, String initialValue) >- { >- return createByteObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertByteToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Byte createByteObjectFromString(EDataType eDataType, String initialValue) >- { >- return createByteObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertByteObjectToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createDateFromString(EDataType eDataType, String initialValue) >- { >- return createDate(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDateToString(EDataType eDataType, Object instanceValue) >- { >- return convertDate(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createDateTimeFromString(EDataType eDataType, String initialValue) >- { >- return createDateTime(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDateTimeToString(EDataType eDataType, Object instanceValue) >- { >- return convertDateTime(instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createStringFromString(EDataType eDataType, String initialValue) >- { >- return initialValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertStringToString(EDataType eDataType, Object instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Double createDoubleFromString(EDataType eDataType, String initialValue) >- { >- return createDoubleObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDoubleToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Double createDoubleObjectFromString(EDataType eDataType, String initialValue) >- { >- return createDoubleObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDoubleObjectToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createDurationFromString(EDataType eDataType, String initialValue) >- { >- return createDuration(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertDurationToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createNormalizedStringFromString(EDataType eDataType, String initialValue) >- { >- return createNormalizedString(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNormalizedStringToString(EDataType eDataType, Object instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createTokenFromString(EDataType eDataType, String initialValue) >- { >- return createToken(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertTokenToString(EDataType eDataType, Object instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createNameFromString(EDataType eDataType, String initialValue) >- { >- // do not validate on load. Check validity using Diagnostician. >- return createName(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNameToString(EDataType eDataType, Object instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createNCNameFromString(EDataType eDataType, String initialValue) >- { >- // do not validate on load. Check validity using Diagnostician. >- return createNCName(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNCNameToString(EDataType eDataType, Object instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createENTITYFromString(EDataType eDataType, String initialValue) >- { >- return createENTITY(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertENTITYToString(EDataType eDataType, Object instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Float createFloatFromString(EDataType eDataType, String initialValue) >- { >- return createFloatObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertFloatToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Float createFloatObjectFromString(EDataType eDataType, String initialValue) >- { >- return createFloatObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertFloatObjectToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createGDayFromString(EDataType eDataType, String initialValue) >- { >- return createGDay(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertGDayToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createGMonthFromString(EDataType eDataType, String initialValue) >- { >- return createGMonth(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertGMonthToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createGMonthDayFromString(EDataType eDataType, String initialValue) >- { >- return createGMonthDay(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertGMonthDayToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createGYearFromString(EDataType eDataType, String initialValue) >- { >- return createGYear(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertGYearToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createGYearMonthFromString(EDataType eDataType, String initialValue) >- { >- return createGYearMonth(initialValue); >-} >+ public void eSetDeliver(boolean deliver) { >+ // TODO Auto-generated method stub > >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertGYearMonthToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public byte[] createHexBinaryFromString(EDataType eDataType, String initialValue) >- { >- return createHexBinary(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertHexBinaryToString(EDataType eDataType, Object instanceValue) >- { >- return convertHexBinary((byte[])instanceValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertIDToString(EDataType eDataType, Object instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertIDREFToString(EDataType eDataType, Object instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createLanguageFromString(EDataType eDataType, String initialValue) >- { >- return createLanguage(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertLanguageToString(EDataType eDataType, Object instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public BigInteger createNonPositiveIntegerFromString(EDataType eDataType, String initialValue) >- { >- return createNonPositiveInteger(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNonPositiveIntegerToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String createNMTOKENFromString(EDataType eDataType, String initialValue) >- { >- return createNMTOKEN(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNMTOKENToString(EDataType eDataType, Object instanceValue) >- { >- return (String)instanceValue; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public BigInteger createNonNegativeIntegerFromString(EDataType eDataType, String initialValue) >- { >- return createNonNegativeInteger(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNonNegativeIntegerToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createNOTATIONFromString(EDataType eDataType, String initialValue) >- { >- return createNOTATION(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertNOTATIONToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createQNameFromString(EDataType eDataType, String initialValue) >- { >- return createQName(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertQNameToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object createTimeFromString(EDataType eDataType, String initialValue) >- { >- return createTime(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertTimeToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Long createUnsignedIntFromString(EDataType eDataType, String initialValue) >- { >- return createUnsignedIntObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedIntToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Long createUnsignedIntObjectFromString(EDataType eDataType, String initialValue) >- { >- return createUnsignedIntObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedIntObjectToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Integer createUnsignedShortFromString(EDataType eDataType, String initialValue) >- { >- return createUnsignedShortObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedShortToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Integer createUnsignedShortObjectFromString(EDataType eDataType, String initialValue) >- { >- return initialValue == null ? null : Integer.valueOf(collapseWhiteSpace(initialValue)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedShortObjectToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Short createUnsignedByteFromString(EDataType eDataType, String initialValue) >- { >- return createUnsignedByteObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedByteToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Short createUnsignedByteObjectFromString(EDataType eDataType, String initialValue) >- { >- return createUnsignedByteObject(initialValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String convertUnsignedByteObjectToString(EDataType eDataType, Object instanceValue) >- { >- return instanceValue == null ? null : instanceValue.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypePackage getXMLTypePackage() >- { >- return (XMLTypePackage)getEPackage(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @deprecated >- * @generated >- */ >- public static XMLTypePackage getPackage() >- { >- return XMLTypePackage.eINSTANCE; >- } >- >- protected Boolean booleanValueOf(String initialValue) >- { >- initialValue = collapseWhiteSpace(initialValue); >- if ("true".equals(initialValue) || "1".equals(initialValue)) >- { >- return Boolean.TRUE; >- } >- else if ("false".equals(initialValue) || "0".equals(initialValue)) >- { >- return Boolean.FALSE; >- } >- throw new InvalidDatatypeValueException("Invalid boolean value: '" + initialValue + "'"); >- } >- >- protected boolean primitiveBooleanValueOf(String initialValue) >- { >- initialValue = collapseWhiteSpace(initialValue); >- if ("true".equals(initialValue) || "1".equals(initialValue)) >- { >- return true; >- } >- else if ("false".equals(initialValue) || "0".equals(initialValue)) >- { >- return false; >- } >- throw new InvalidDatatypeValueException("Invalid boolean value: '" + initialValue + "'"); >- } >- >- private static class SafeSimpleDateFormat extends SimpleDateFormat >- { >- public SafeSimpleDateFormat(String pattern) >- { >- super(pattern); >- } >- >- public synchronized Date parse(String source) throws ParseException >- { >- return super.parse(source); >- } >- >- public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos) >- { >- StringBuffer result = super.format(date, toAppendTo, pos); >- result.insert(result.length() - 2, ":"); >- return result; >- } >- } >+ } > >-} //XMLTypeFactoryImpl >+} >Index: src/org/eclipse/emf/ecore/xml/type/impl/XMLTypeDocumentRootImpl.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/type/impl/XMLTypeDocumentRootImpl.java >diff -N src/org/eclipse/emf/ecore/xml/type/impl/XMLTypeDocumentRootImpl.java >--- src/org/eclipse/emf/ecore/xml/type/impl/XMLTypeDocumentRootImpl.java 25 Nov 2005 17:49:49 -0000 1.9 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,388 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLTypeDocumentRootImpl.java,v 1.9 2005/11/25 17:49:49 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.xml.type.impl; >- >- >-import org.eclipse.emf.common.notify.NotificationChain; >-import org.eclipse.emf.common.util.EMap; >-import org.eclipse.emf.ecore.EClass; >-import org.eclipse.emf.ecore.EStructuralFeature; >-import org.eclipse.emf.ecore.EcorePackage; >-import org.eclipse.emf.ecore.InternalEObject; >-import org.eclipse.emf.ecore.impl.EObjectImpl; >-import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl; >-import org.eclipse.emf.ecore.util.BasicFeatureMap; >-import org.eclipse.emf.ecore.util.EcoreEMap; >-import org.eclipse.emf.ecore.util.FeatureMap; >-import org.eclipse.emf.ecore.util.InternalEList; >-import org.eclipse.emf.ecore.xml.type.XMLTypeDocumentRoot; >-import org.eclipse.emf.ecore.xml.type.XMLTypePackage; >- >- >-/** >- * <!-- begin-user-doc --> >- * An implementation of the model object '<em><b>Document Root</b></em>'. >- * <!-- end-user-doc --> >- * <p> >- * The following features are implemented: >- * <ul> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.XMLTypeDocumentRootImpl#getMixed <em>Mixed</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.XMLTypeDocumentRootImpl#getXMLNSPrefixMap <em>XMLNS Prefix Map</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.XMLTypeDocumentRootImpl#getXSISchemaLocation <em>XSI Schema Location</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.XMLTypeDocumentRootImpl#getCDATA <em>CDATA</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.XMLTypeDocumentRootImpl#getComment <em>Comment</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.XMLTypeDocumentRootImpl#getText <em>Text</em>}</li> >- * </ul> >- * </p> >- * >- * @generated >- */ >-public class XMLTypeDocumentRootImpl extends EObjectImpl implements XMLTypeDocumentRoot >-{ >- /** >- * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getMixed() >- * @generated >- * @ordered >- */ >- protected FeatureMap mixed = null; >- >- /** >- * The cached value of the '{@link #getXMLNSPrefixMap() <em>XMLNS Prefix Map</em>}' map. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getXMLNSPrefixMap() >- * @generated >- * @ordered >- */ >- protected EMap xMLNSPrefixMap = null; >- >- /** >- * The cached value of the '{@link #getXSISchemaLocation() <em>XSI Schema Location</em>}' map. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getXSISchemaLocation() >- * @generated >- * @ordered >- */ >- protected EMap xSISchemaLocation = null; >- >- /** >- * The default value of the '{@link #getCDATA() <em>CDATA</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getCDATA() >- * @generated >- * @ordered >- */ >- protected static final String CDATA_EDEFAULT = null; >- >- /** >- * The default value of the '{@link #getComment() <em>Comment</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getComment() >- * @generated >- * @ordered >- */ >- protected static final String COMMENT_EDEFAULT = null; >- >- /** >- * The default value of the '{@link #getText() <em>Text</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getText() >- * @generated >- * @ordered >- */ >- protected static final String TEXT_EDEFAULT = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected XMLTypeDocumentRootImpl() >- { >- super(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected EClass eStaticClass() >- { >- return XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public FeatureMap getMixed() >- { >- if (mixed == null) >- { >- mixed = new BasicFeatureMap(this, XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__MIXED); >- } >- return mixed; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EMap getXMLNSPrefixMap() >- { >- if (xMLNSPrefixMap == null) >- { >- xMLNSPrefixMap = new EcoreEMap(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY, EStringToStringMapEntryImpl.class, this, XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP); >- } >- return xMLNSPrefixMap; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EMap getXSISchemaLocation() >- { >- if (xSISchemaLocation == null) >- { >- xSISchemaLocation = new EcoreEMap(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY, EStringToStringMapEntryImpl.class, this, XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); >- } >- return xSISchemaLocation; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String getText() >- { >- return (String)getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, true); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void setText(String newText) >- { >- ((FeatureMap.Internal)getMixed()).set(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, newText); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) >- { >- switch (featureID) >- { >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__MIXED: >- return ((InternalEList)getMixed()).basicRemove(otherEnd, msgs); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP: >- return ((InternalEList)getXMLNSPrefixMap()).basicRemove(otherEnd, msgs); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: >- return ((InternalEList)getXSISchemaLocation()).basicRemove(otherEnd, msgs); >- } >- return eDynamicInverseRemove(otherEnd, featureID, msgs); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object eGet(int featureID, boolean resolve, boolean coreType) >- { >- switch (featureID) >- { >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__MIXED: >- if (coreType) return getMixed(); >- return ((FeatureMap.Internal)getMixed()).getWrapper(); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP: >- if (coreType) return getXMLNSPrefixMap(); >- else return getXMLNSPrefixMap().map(); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: >- if (coreType) return getXSISchemaLocation(); >- else return getXSISchemaLocation().map(); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__CDATA: >- return getCDATA(); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__COMMENT: >- return getComment(); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__TEXT: >- return getText(); >- } >- return eDynamicGet(featureID, resolve, coreType); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void eSet(int featureID, Object newValue) >- { >- switch (featureID) >- { >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__MIXED: >- ((FeatureMap.Internal)getMixed()).set(newValue); >- return; >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP: >- ((EStructuralFeature.Setting)getXMLNSPrefixMap()).set(newValue); >- return; >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: >- ((EStructuralFeature.Setting)getXSISchemaLocation()).set(newValue); >- return; >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__CDATA: >- setCDATA((String)newValue); >- return; >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__COMMENT: >- setComment((String)newValue); >- return; >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__TEXT: >- setText((String)newValue); >- return; >- } >- eDynamicSet(featureID, newValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void eUnset(int featureID) >- { >- switch (featureID) >- { >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__MIXED: >- getMixed().clear(); >- return; >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP: >- getXMLNSPrefixMap().clear(); >- return; >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: >- getXSISchemaLocation().clear(); >- return; >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__CDATA: >- setCDATA(CDATA_EDEFAULT); >- return; >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__COMMENT: >- setComment(COMMENT_EDEFAULT); >- return; >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__TEXT: >- setText(TEXT_EDEFAULT); >- return; >- } >- eDynamicUnset(featureID); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean eIsSet(int featureID) >- { >- switch (featureID) >- { >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__MIXED: >- return mixed != null && !mixed.isEmpty(); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP: >- return xMLNSPrefixMap != null && !xMLNSPrefixMap.isEmpty(); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: >- return xSISchemaLocation != null && !xSISchemaLocation.isEmpty(); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__CDATA: >- return CDATA_EDEFAULT == null ? getCDATA() != null : !CDATA_EDEFAULT.equals(getCDATA()); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__COMMENT: >- return COMMENT_EDEFAULT == null ? getComment() != null : !COMMENT_EDEFAULT.equals(getComment()); >- case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__TEXT: >- return TEXT_EDEFAULT == null ? getText() != null : !TEXT_EDEFAULT.equals(getText()); >- } >- return eDynamicIsSet(featureID); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String getCDATA() >- { >- return (String)getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, true); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void setCDATA(String newCDATA) >- { >- ((FeatureMap.Internal)getMixed()).set(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, newCDATA); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String getComment() >- { >- return (String)getMixed().get(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, true); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void setComment(String newComment) >- { >- ((FeatureMap.Internal)getMixed()).set(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, newComment); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String toString() >- { >- if (eIsProxy()) return super.toString(); >- >- StringBuffer result = new StringBuffer(super.toString()); >- result.append(" (mixed: "); >- result.append(mixed); >- result.append(')'); >- return result.toString(); >- } >- >-} //DocumentRootImpl >Index: src/org/eclipse/emf/ecore/xml/type/impl/XMLTypePackageImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/xml/type/impl/XMLTypePackageImpl.java,v >retrieving revision 1.16 >diff -u -r1.16 XMLTypePackageImpl.java >--- src/org/eclipse/emf/ecore/xml/type/impl/XMLTypePackageImpl.java 2 Dec 2005 18:07:47 -0000 1.16 >+++ src/org/eclipse/emf/ecore/xml/type/impl/XMLTypePackageImpl.java 16 Nov 2007 07:20:55 -0000 >@@ -1,2147 +1,557 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLTypePackageImpl.java,v 1.16 2005/12/02 18:07:47 davidms Exp $ >- */ > package org.eclipse.emf.ecore.xml.type.impl; > >- >-import java.math.BigDecimal; >-import java.math.BigInteger; >-import java.util.List; >- >+import org.eclipse.emf.common.notify.Notification; >+import org.eclipse.emf.common.util.EList; >+import org.eclipse.emf.common.util.TreeIterator; >+import org.eclipse.emf.ecore.EAnnotation; > import org.eclipse.emf.ecore.EAttribute; > import org.eclipse.emf.ecore.EClass; >+import org.eclipse.emf.ecore.EClassifier; > import org.eclipse.emf.ecore.EDataType; >+import org.eclipse.emf.ecore.EFactory; >+import org.eclipse.emf.ecore.EObject; > import org.eclipse.emf.ecore.EPackage; > import org.eclipse.emf.ecore.EReference; >-import org.eclipse.emf.ecore.EValidator; >- >-import org.eclipse.emf.ecore.impl.EPackageImpl; >-import org.eclipse.emf.ecore.xml.type.AnyType; >-import org.eclipse.emf.ecore.xml.type.SimpleAnyType; >-import org.eclipse.emf.ecore.xml.type.XMLTypeDocumentRoot; >+import org.eclipse.emf.ecore.EStructuralFeature; >+import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.emf.ecore.xml.type.XMLTypeFactory; > import org.eclipse.emf.ecore.xml.type.XMLTypePackage; > >+public class XMLTypePackageImpl implements XMLTypePackage { > >-import org.eclipse.emf.ecore.xml.type.util.XMLTypeValidator; >+ public static XMLTypePackage init() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getAnySimpleType() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EClass getAnyType() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EAttribute getAnyType_Any() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EAttribute getAnyType_AnyAttribute() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EAttribute getAnyType_Mixed() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getAnyURI() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getBase64Binary() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getBoolean() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getBooleanObject() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getByte() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getByteObject() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getDate() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getDateTime() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getDecimal() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getDouble() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getDoubleObject() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getDuration() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getENTITIES() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getENTITIESBase() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getENTITY() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getFloat() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getFloatObject() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getGDay() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getGMonth() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getGMonthDay() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getGYear() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getGYearMonth() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getHexBinary() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getID() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getIDREF() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getIDREFS() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getIDREFSBase() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getInt() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getIntObject() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getInteger() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getLanguage() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getLong() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getLongObject() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getNCName() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getNMTOKEN() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getNMTOKENS() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getNMTOKENSBase() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getNOTATION() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getName_() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getNegativeInteger() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getNonNegativeInteger() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getNonPositiveInteger() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getNormalizedString() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getPositiveInteger() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getQName() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getShort() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getShortObject() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EClass getSimpleAnyType() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EReference getSimpleAnyType_InstanceType() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EAttribute getSimpleAnyType_RawValue() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EAttribute getSimpleAnyType_Value() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getString() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getTime() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getToken() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getUnsignedByte() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getUnsignedByteObject() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getUnsignedInt() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getUnsignedIntObject() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getUnsignedLong() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getUnsignedShort() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EDataType getUnsignedShortObject() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EClass getXMLTypeDocumentRoot() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EAttribute getXMLTypeDocumentRoot_CDATA() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EAttribute getXMLTypeDocumentRoot_Comment() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EAttribute getXMLTypeDocumentRoot_Mixed() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EAttribute getXMLTypeDocumentRoot_Text() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EReference getXMLTypeDocumentRoot_XMLNSPrefixMap() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EReference getXMLTypeDocumentRoot_XSISchemaLocation() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EClassifier getEClassifier(String name) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EList getEClassifiers() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EFactory getEFactoryInstance() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EList getESubpackages() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EPackage getESuperPackage() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String getNsPrefix() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public String getNsURI() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public void setEFactoryInstance(EFactory value) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public void setNsPrefix(String value) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public void setNsURI(String value) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public String getName() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public void setName(String value) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public EAnnotation getEAnnotation(String source) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EList getEAnnotations() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public TreeIterator eAllContents() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EClass eClass() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EObject eContainer() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EStructuralFeature eContainingFeature() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EReference eContainmentFeature() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EList eContents() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public EList eCrossReferences() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object eGet(EStructuralFeature feature) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public Object eGet(EStructuralFeature feature, boolean resolve) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public boolean eIsProxy() { >+ // TODO Auto-generated method stub >+ return false; >+ } >+ >+ public boolean eIsSet(EStructuralFeature feature) { >+ // TODO Auto-generated method stub >+ return false; >+ } >+ >+ public Resource eResource() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public void eSet(EStructuralFeature feature, Object newValue) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public void eUnset(EStructuralFeature feature) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public EList eAdapters() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ public boolean eDeliver() { >+ // TODO Auto-generated method stub >+ return false; >+ } >+ >+ public void eNotify(Notification notification) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public void eSetDeliver(boolean deliver) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public XMLTypeFactory getXMLTypeFactory() { >+ // TODO Auto-generated method stub >+ return null; >+ } > >-/** >- * <!-- begin-user-doc --> >- * An implementation of the model <b>Package</b>. >- * <!-- end-user-doc --> >- * @generated >- */ >-public class XMLTypePackageImpl extends EPackageImpl implements XMLTypePackage >-{ >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EClass anyTypeEClass = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EClass simpleAnyTypeEClass = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EClass xmlTypeDocumentRootEClass = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType anySimpleTypeEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType anyURIEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType base64BinaryEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType booleanEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType booleanObjectEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType decimalEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType integerEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType intObjectEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType longEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType longObjectEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType intEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType shortEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType shortObjectEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType byteEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType byteObjectEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType dateEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType dateTimeEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType stringEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType doubleEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType doubleObjectEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType durationEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType entitiesBaseEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType normalizedStringEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType tokenEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType nameEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType ncNameEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType entityEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType entitiesEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType floatEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType floatObjectEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType gDayEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType gMonthEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType gMonthDayEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType gYearEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType gYearMonthEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType hexBinaryEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType idEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType idrefEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType idrefsBaseEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType idrefsEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType languageEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType nonPositiveIntegerEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType negativeIntegerEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType nmtokenEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType nmtokensBaseEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType nmtokensEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType nonNegativeIntegerEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType notationEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType positiveIntegerEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType qNameEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType timeEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType unsignedLongEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType unsignedIntEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType unsignedIntObjectEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType unsignedShortEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType unsignedShortObjectEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType unsignedByteEDataType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private EDataType unsignedByteObjectEDataType = null; >- >- /** >- * Creates an instance of the model <b>Package</b>, registered with >- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package >- * package URI value. >- * <p>Note: the correct way to create the package is via the static >- * factory method {@link #init init()}, which also performs >- * initialization of the package, or returns the registered package, >- * if one already exists. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.EPackage.Registry >- * @see org.eclipse.emf.ecore.xml.type.XMLTypePackage#eNS_URI >- * @see #init() >- * @generated >- */ >- private XMLTypePackageImpl() >- { >- super(eNS_URI, XMLTypeFactory.eINSTANCE); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private static boolean isInited = false; >- >- /** >- * Creates, registers, and initializes the <b>Package</b> for this >- * model, and for any others upon which it depends. Simple >- * dependencies are satisfied by calling this method on all >- * dependent packages before doing anything else. This method drives >- * initialization for interdependent packages directly, in parallel >- * with this package, itself. >- * <p>Of this package and its interdependencies, all packages which >- * have not yet been registered by their URI values are first created >- * and registered. The packages are then initialized in two steps: >- * meta-model objects for all of the packages are created before any >- * are initialized, since one package's meta-model objects may refer to >- * those of another. >- * <p>Invocation of this method will not affect any packages that have >- * already been initialized. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #eNS_URI >- * @see #createPackageContents() >- * @see #initializePackageContents() >- * @generated >- */ >- public static XMLTypePackage init() >- { >- if (isInited) return (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); >- >- // Obtain or create and register package >- XMLTypePackageImpl theXMLTypePackage = (XMLTypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof XMLTypePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new XMLTypePackageImpl()); >- >- isInited = true; >- >- // Create package meta-data objects >- theXMLTypePackage.createPackageContents(); >- >- // Initialize created meta-data >- theXMLTypePackage.initializePackageContents(); >- >- // Register package validator >- EValidator.Registry.INSTANCE.put >- (theXMLTypePackage, >- new EValidator.Descriptor() >- { >- public EValidator getEValidator() >- { >- return XMLTypeValidator.INSTANCE; >- } >- }); >- >- // Mark meta-data to indicate it can't be changed >- theXMLTypePackage.freeze(); >- >- return theXMLTypePackage; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EClass getAnyType() >- { >- return anyTypeEClass; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getAnyType_Mixed() >- { >- return (EAttribute)anyTypeEClass.getEStructuralFeatures().get(0); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getAnyType_Any() >- { >- return (EAttribute)anyTypeEClass.getEStructuralFeatures().get(1); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getAnyType_AnyAttribute() >- { >- return (EAttribute)anyTypeEClass.getEStructuralFeatures().get(2); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EClass getSimpleAnyType() >- { >- return simpleAnyTypeEClass; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getSimpleAnyType_RawValue() >- { >- return (EAttribute)simpleAnyTypeEClass.getEStructuralFeatures().get(0); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getSimpleAnyType_Value() >- { >- return (EAttribute)simpleAnyTypeEClass.getEStructuralFeatures().get(1); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EReference getSimpleAnyType_InstanceType() >- { >- return (EReference)simpleAnyTypeEClass.getEStructuralFeatures().get(2); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EClass getXMLTypeDocumentRoot() >- { >- return xmlTypeDocumentRootEClass; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getXMLTypeDocumentRoot_Mixed() >- { >- return (EAttribute)xmlTypeDocumentRootEClass.getEStructuralFeatures().get(0); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EReference getXMLTypeDocumentRoot_XMLNSPrefixMap() >- { >- return (EReference)xmlTypeDocumentRootEClass.getEStructuralFeatures().get(1); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EReference getXMLTypeDocumentRoot_XSISchemaLocation() >- { >- return (EReference)xmlTypeDocumentRootEClass.getEStructuralFeatures().get(2); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getXMLTypeDocumentRoot_CDATA() >- { >- return (EAttribute)xmlTypeDocumentRootEClass.getEStructuralFeatures().get(3); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getXMLTypeDocumentRoot_Comment() >- { >- return (EAttribute)xmlTypeDocumentRootEClass.getEStructuralFeatures().get(4); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EAttribute getXMLTypeDocumentRoot_Text() >- { >- return (EAttribute)xmlTypeDocumentRootEClass.getEStructuralFeatures().get(5); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getAnySimpleType() >- { >- return anySimpleTypeEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getAnyURI() >- { >- return anyURIEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getBase64Binary() >- { >- return base64BinaryEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getBoolean() >- { >- return booleanEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getBooleanObject() >- { >- return booleanObjectEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getDecimal() >- { >- return decimalEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getInteger() >- { >- return integerEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getIntObject() >- { >- return intObjectEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getLong() >- { >- return longEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getLongObject() >- { >- return longObjectEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getInt() >- { >- return intEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getShort() >- { >- return shortEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getShortObject() >- { >- return shortObjectEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getByte() >- { >- return byteEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getByteObject() >- { >- return byteObjectEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getDate() >- { >- return dateEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getDateTime() >- { >- return dateTimeEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getString() >- { >- return stringEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getDouble() >- { >- return doubleEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getDoubleObject() >- { >- return doubleObjectEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getDuration() >- { >- return durationEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getENTITIESBase() >- { >- return entitiesBaseEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getNormalizedString() >- { >- return normalizedStringEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getToken() >- { >- return tokenEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getName_() >- { >- return nameEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getNCName() >- { >- return ncNameEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getENTITY() >- { >- return entityEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getENTITIES() >- { >- return entitiesEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getFloat() >- { >- return floatEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getFloatObject() >- { >- return floatObjectEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getGDay() >- { >- return gDayEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getGMonth() >- { >- return gMonthEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getGMonthDay() >- { >- return gMonthDayEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getGYear() >- { >- return gYearEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getGYearMonth() >- { >- return gYearMonthEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getHexBinary() >- { >- return hexBinaryEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getID() >- { >- return idEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getIDREF() >- { >- return idrefEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getIDREFSBase() >- { >- return idrefsBaseEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getIDREFS() >- { >- return idrefsEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getLanguage() >- { >- return languageEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getNonPositiveInteger() >- { >- return nonPositiveIntegerEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getNegativeInteger() >- { >- return negativeIntegerEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getNMTOKEN() >- { >- return nmtokenEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getNMTOKENSBase() >- { >- return nmtokensBaseEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getNMTOKENS() >- { >- return nmtokensEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getNonNegativeInteger() >- { >- return nonNegativeIntegerEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getNOTATION() >- { >- return notationEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getPositiveInteger() >- { >- return positiveIntegerEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getQName() >- { >- return qNameEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getTime() >- { >- return timeEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getUnsignedLong() >- { >- return unsignedLongEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getUnsignedInt() >- { >- return unsignedIntEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getUnsignedIntObject() >- { >- return unsignedIntObjectEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getUnsignedShort() >- { >- return unsignedShortEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getUnsignedShortObject() >- { >- return unsignedShortObjectEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getUnsignedByte() >- { >- return unsignedByteEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getUnsignedByteObject() >- { >- return unsignedByteObjectEDataType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public XMLTypeFactory getXMLTypeFactory() >- { >- return (XMLTypeFactory)getEFactoryInstance(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private boolean isCreated = false; >- >- /** >- * Creates the meta-model objects for the package. This method is >- * guarded to have no affect on any invocation but its first. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void createPackageContents() >- { >- if (isCreated) return; >- isCreated = true; >- >- // Create classes and their features >- anyTypeEClass = createEClass(ANY_TYPE); >- createEAttribute(anyTypeEClass, ANY_TYPE__MIXED); >- createEAttribute(anyTypeEClass, ANY_TYPE__ANY); >- createEAttribute(anyTypeEClass, ANY_TYPE__ANY_ATTRIBUTE); >- >- simpleAnyTypeEClass = createEClass(SIMPLE_ANY_TYPE); >- createEAttribute(simpleAnyTypeEClass, SIMPLE_ANY_TYPE__RAW_VALUE); >- createEAttribute(simpleAnyTypeEClass, SIMPLE_ANY_TYPE__VALUE); >- createEReference(simpleAnyTypeEClass, SIMPLE_ANY_TYPE__INSTANCE_TYPE); >- >- xmlTypeDocumentRootEClass = createEClass(XML_TYPE_DOCUMENT_ROOT); >- createEAttribute(xmlTypeDocumentRootEClass, XML_TYPE_DOCUMENT_ROOT__MIXED); >- createEReference(xmlTypeDocumentRootEClass, XML_TYPE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP); >- createEReference(xmlTypeDocumentRootEClass, XML_TYPE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); >- createEAttribute(xmlTypeDocumentRootEClass, XML_TYPE_DOCUMENT_ROOT__CDATA); >- createEAttribute(xmlTypeDocumentRootEClass, XML_TYPE_DOCUMENT_ROOT__COMMENT); >- createEAttribute(xmlTypeDocumentRootEClass, XML_TYPE_DOCUMENT_ROOT__TEXT); >- >- // Create data types >- anySimpleTypeEDataType = createEDataType(ANY_SIMPLE_TYPE); >- anyURIEDataType = createEDataType(ANY_URI); >- base64BinaryEDataType = createEDataType(BASE64_BINARY); >- booleanEDataType = createEDataType(BOOLEAN); >- booleanObjectEDataType = createEDataType(BOOLEAN_OBJECT); >- byteEDataType = createEDataType(BYTE); >- byteObjectEDataType = createEDataType(BYTE_OBJECT); >- dateEDataType = createEDataType(DATE); >- dateTimeEDataType = createEDataType(DATE_TIME); >- decimalEDataType = createEDataType(DECIMAL); >- doubleEDataType = createEDataType(DOUBLE); >- doubleObjectEDataType = createEDataType(DOUBLE_OBJECT); >- durationEDataType = createEDataType(DURATION); >- entitiesEDataType = createEDataType(ENTITIES); >- entitiesBaseEDataType = createEDataType(ENTITIES_BASE); >- entityEDataType = createEDataType(ENTITY); >- floatEDataType = createEDataType(FLOAT); >- floatObjectEDataType = createEDataType(FLOAT_OBJECT); >- gDayEDataType = createEDataType(GDAY); >- gMonthEDataType = createEDataType(GMONTH); >- gMonthDayEDataType = createEDataType(GMONTH_DAY); >- gYearEDataType = createEDataType(GYEAR); >- gYearMonthEDataType = createEDataType(GYEAR_MONTH); >- hexBinaryEDataType = createEDataType(HEX_BINARY); >- idEDataType = createEDataType(ID); >- idrefEDataType = createEDataType(IDREF); >- idrefsEDataType = createEDataType(IDREFS); >- idrefsBaseEDataType = createEDataType(IDREFS_BASE); >- intEDataType = createEDataType(INT); >- integerEDataType = createEDataType(INTEGER); >- intObjectEDataType = createEDataType(INT_OBJECT); >- languageEDataType = createEDataType(LANGUAGE); >- longEDataType = createEDataType(LONG); >- longObjectEDataType = createEDataType(LONG_OBJECT); >- nameEDataType = createEDataType(NAME); >- ncNameEDataType = createEDataType(NC_NAME); >- negativeIntegerEDataType = createEDataType(NEGATIVE_INTEGER); >- nmtokenEDataType = createEDataType(NMTOKEN); >- nmtokensEDataType = createEDataType(NMTOKENS); >- nmtokensBaseEDataType = createEDataType(NMTOKENS_BASE); >- nonNegativeIntegerEDataType = createEDataType(NON_NEGATIVE_INTEGER); >- nonPositiveIntegerEDataType = createEDataType(NON_POSITIVE_INTEGER); >- normalizedStringEDataType = createEDataType(NORMALIZED_STRING); >- notationEDataType = createEDataType(NOTATION); >- positiveIntegerEDataType = createEDataType(POSITIVE_INTEGER); >- qNameEDataType = createEDataType(QNAME); >- shortEDataType = createEDataType(SHORT); >- shortObjectEDataType = createEDataType(SHORT_OBJECT); >- stringEDataType = createEDataType(STRING); >- timeEDataType = createEDataType(TIME); >- tokenEDataType = createEDataType(TOKEN); >- unsignedByteEDataType = createEDataType(UNSIGNED_BYTE); >- unsignedByteObjectEDataType = createEDataType(UNSIGNED_BYTE_OBJECT); >- unsignedIntEDataType = createEDataType(UNSIGNED_INT); >- unsignedIntObjectEDataType = createEDataType(UNSIGNED_INT_OBJECT); >- unsignedLongEDataType = createEDataType(UNSIGNED_LONG); >- unsignedShortEDataType = createEDataType(UNSIGNED_SHORT); >- unsignedShortObjectEDataType = createEDataType(UNSIGNED_SHORT_OBJECT); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private boolean isInitialized = false; >- >- /** >- * Complete the initialization of the package and its meta-model. This >- * method is guarded to have no affect on any invocation but its first. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void initializePackageContents() >- { >- if (isInitialized) return; >- isInitialized = true; >- >- // Initialize package >- setName(eNAME); >- setNsPrefix(eNS_PREFIX); >- setNsURI(eNS_URI); >- >- // Obtain other dependent packages >- XMLTypePackage theXMLTypePackage_1 = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); >- >- // Add supertypes to classes >- simpleAnyTypeEClass.getESuperTypes().add(this.getAnyType()); >- >- // Initialize classes and features; add operations and parameters >- initEClass(anyTypeEClass, AnyType.class, "AnyType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); >- initEAttribute(getAnyType_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, AnyType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- initEAttribute(getAnyType_Any(), ecorePackage.getEFeatureMapEntry(), "any", null, 0, -1, AnyType.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, IS_ORDERED); >- initEAttribute(getAnyType_AnyAttribute(), ecorePackage.getEFeatureMapEntry(), "anyAttribute", null, 0, -1, AnyType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- >- initEClass(simpleAnyTypeEClass, SimpleAnyType.class, "SimpleAnyType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); >- initEAttribute(getSimpleAnyType_RawValue(), theXMLTypePackage_1.getString(), "rawValue", null, 0, 1, SimpleAnyType.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, IS_ORDERED); >- initEAttribute(getSimpleAnyType_Value(), theXMLTypePackage_1.getAnySimpleType(), "value", null, 0, 1, SimpleAnyType.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, IS_ORDERED); >- initEReference(getSimpleAnyType_InstanceType(), ecorePackage.getEDataType(), null, "instanceType", null, 1, 1, SimpleAnyType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- >- initEClass(xmlTypeDocumentRootEClass, XMLTypeDocumentRoot.class, "XMLTypeDocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); >- initEAttribute(getXMLTypeDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- initEReference(getXMLTypeDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- initEReference(getXMLTypeDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >- initEAttribute(getXMLTypeDocumentRoot_CDATA(), this.getString(), "cDATA", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, IS_ORDERED); >- initEAttribute(getXMLTypeDocumentRoot_Comment(), this.getString(), "comment", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, IS_ORDERED); >- initEAttribute(getXMLTypeDocumentRoot_Text(), this.getString(), "text", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, IS_ORDERED); >- >- // Initialize data types >- initEDataType(anySimpleTypeEDataType, Object.class, "AnySimpleType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(anyURIEDataType, String.class, "AnyURI", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(base64BinaryEDataType, byte[].class, "Base64Binary", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(booleanEDataType, boolean.class, "Boolean", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(booleanObjectEDataType, Boolean.class, "BooleanObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(byteEDataType, byte.class, "Byte", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(byteObjectEDataType, Byte.class, "ByteObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(dateEDataType, Object.class, "Date", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(dateTimeEDataType, Object.class, "DateTime", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(decimalEDataType, BigDecimal.class, "Decimal", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(doubleEDataType, double.class, "Double", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(doubleObjectEDataType, Double.class, "DoubleObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(durationEDataType, Object.class, "Duration", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(entitiesEDataType, List.class, "ENTITIES", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(entitiesBaseEDataType, List.class, "ENTITIESBase", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(entityEDataType, String.class, "ENTITY", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(floatEDataType, float.class, "Float", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(floatObjectEDataType, Float.class, "FloatObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(gDayEDataType, Object.class, "GDay", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(gMonthEDataType, Object.class, "GMonth", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(gMonthDayEDataType, Object.class, "GMonthDay", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(gYearEDataType, Object.class, "GYear", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(gYearMonthEDataType, Object.class, "GYearMonth", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(hexBinaryEDataType, byte[].class, "HexBinary", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(idEDataType, String.class, "ID", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(idrefEDataType, String.class, "IDREF", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(idrefsEDataType, List.class, "IDREFS", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(idrefsBaseEDataType, List.class, "IDREFSBase", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(intEDataType, int.class, "Int", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(integerEDataType, BigInteger.class, "Integer", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(intObjectEDataType, Integer.class, "IntObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(languageEDataType, String.class, "Language", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(longEDataType, long.class, "Long", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(longObjectEDataType, Long.class, "LongObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(nameEDataType, String.class, "Name", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(ncNameEDataType, String.class, "NCName", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(negativeIntegerEDataType, BigInteger.class, "NegativeInteger", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(nmtokenEDataType, String.class, "NMTOKEN", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(nmtokensEDataType, List.class, "NMTOKENS", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(nmtokensBaseEDataType, List.class, "NMTOKENSBase", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(nonNegativeIntegerEDataType, BigInteger.class, "NonNegativeInteger", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(nonPositiveIntegerEDataType, BigInteger.class, "NonPositiveInteger", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(normalizedStringEDataType, String.class, "NormalizedString", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(notationEDataType, Object.class, "NOTATION", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(positiveIntegerEDataType, BigInteger.class, "PositiveInteger", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(qNameEDataType, Object.class, "QName", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(shortEDataType, short.class, "Short", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(shortObjectEDataType, Short.class, "ShortObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(stringEDataType, String.class, "String", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(timeEDataType, Object.class, "Time", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(tokenEDataType, String.class, "Token", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(unsignedByteEDataType, short.class, "UnsignedByte", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(unsignedByteObjectEDataType, Short.class, "UnsignedByteObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(unsignedIntEDataType, long.class, "UnsignedInt", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(unsignedIntObjectEDataType, Long.class, "UnsignedIntObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(unsignedLongEDataType, BigInteger.class, "UnsignedLong", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(unsignedShortEDataType, int.class, "UnsignedShort", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- initEDataType(unsignedShortObjectEDataType, Integer.class, "UnsignedShortObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >- >- // Create resource >- createResource(eNS_URI); >- >- // Create annotations >- // http:///org/eclipse/emf/ecore/util/ExtendedMetaData >- createExtendedMetaDataAnnotations(); >- } >- >- /** >- * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected void createExtendedMetaDataAnnotations() >- { >- String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; >- addAnnotation >- (anySimpleTypeEDataType, >- source, >- new String[] >- { >- "name", "anySimpleType" >- }); >- addAnnotation >- (anyTypeEClass, >- source, >- new String[] >- { >- "name", "anyType", >- "kind", "mixed" >- }); >- addAnnotation >- (getAnyType_Mixed(), >- source, >- new String[] >- { >- "kind", "elementWildcard", >- "name", ":mixed" >- }); >- addAnnotation >- (getAnyType_Any(), >- source, >- new String[] >- { >- "kind", "elementWildcard", >- "wildcards", "##any", >- "name", ":1", >- "processing", "lax" >- }); >- addAnnotation >- (getAnyType_AnyAttribute(), >- source, >- new String[] >- { >- "kind", "attributeWildcard", >- "wildcards", "##any", >- "name", ":2", >- "processing", "lax" >- }); >- addAnnotation >- (anyURIEDataType, >- source, >- new String[] >- { >- "name", "anyURI", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (base64BinaryEDataType, >- source, >- new String[] >- { >- "name", "base64Binary", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (booleanEDataType, >- source, >- new String[] >- { >- "name", "boolean", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (booleanObjectEDataType, >- source, >- new String[] >- { >- "name", "boolean:Object", >- "baseType", "boolean" >- }); >- addAnnotation >- (byteEDataType, >- source, >- new String[] >- { >- "name", "byte" >- }); >- addAnnotation >- (byteObjectEDataType, >- source, >- new String[] >- { >- "name", "byte:Object", >- "baseType", "byte" >- }); >- addAnnotation >- (dateEDataType, >- source, >- new String[] >- { >- "name", "date", >- "baseType", "anySimpleType", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (dateTimeEDataType, >- source, >- new String[] >- { >- "name", "dateTime", >- "baseType", "anySimpleType", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (decimalEDataType, >- source, >- new String[] >- { >- "name", "decimal", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (doubleEDataType, >- source, >- new String[] >- { >- "name", "double", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (doubleObjectEDataType, >- source, >- new String[] >- { >- "name", "double:Object", >- "baseType", "double" >- }); >- addAnnotation >- (durationEDataType, >- source, >- new String[] >- { >- "name", "duration", >- "baseType", "anySimpleType", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (entitiesEDataType, >- source, >- new String[] >- { >- "name", "ENTITIES", >- "baseType", "ENTITIES_._base", >- "minLength", "1" >- }); >- addAnnotation >- (entitiesBaseEDataType, >- source, >- new String[] >- { >- "name", "ENTITIES_._base", >- "itemType", "ENTITY" >- }); >- addAnnotation >- (entityEDataType, >- source, >- new String[] >- { >- "name", "ENTITY", >- "baseType", "NCName" >- }); >- addAnnotation >- (floatEDataType, >- source, >- new String[] >- { >- "name", "float", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (floatObjectEDataType, >- source, >- new String[] >- { >- "name", "float:Object", >- "baseType", "float" >- }); >- addAnnotation >- (gDayEDataType, >- source, >- new String[] >- { >- "name", "gDay", >- "baseType", "anySimpleType", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (gMonthEDataType, >- source, >- new String[] >- { >- "name", "gMonth", >- "baseType", "anySimpleType", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (gMonthDayEDataType, >- source, >- new String[] >- { >- "name", "gMonthDay", >- "baseType", "anySimpleType", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (gYearEDataType, >- source, >- new String[] >- { >- "name", "gYear", >- "baseType", "anySimpleType", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (gYearMonthEDataType, >- source, >- new String[] >- { >- "name", "gYearMonth", >- "baseType", "anySimpleType", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (hexBinaryEDataType, >- source, >- new String[] >- { >- "name", "hexBinary", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (idEDataType, >- source, >- new String[] >- { >- "name", "ID", >- "baseType", "NCName" >- }); >- addAnnotation >- (idrefEDataType, >- source, >- new String[] >- { >- "name", "IDREF", >- "baseType", "NCName" >- }); >- addAnnotation >- (idrefsEDataType, >- source, >- new String[] >- { >- "name", "IDREFS", >- "baseType", "IDREFS_._base", >- "minLength", "1" >- }); >- addAnnotation >- (idrefsBaseEDataType, >- source, >- new String[] >- { >- "name", "IDREFS_._base", >- "itemType", "IDREF" >- }); >- addAnnotation >- (intEDataType, >- source, >- new String[] >- { >- "name", "int" >- }); >- addAnnotation >- (integerEDataType, >- source, >- new String[] >- { >- "name", "integer" >- }); >- addAnnotation >- (intObjectEDataType, >- source, >- new String[] >- { >- "name", "int:Object", >- "baseType", "int" >- }); >- addAnnotation >- (languageEDataType, >- source, >- new String[] >- { >- "name", "language", >- "baseType", "token", >- "pattern", "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*" >- }); >- addAnnotation >- (longEDataType, >- source, >- new String[] >- { >- "name", "long" >- }); >- addAnnotation >- (longObjectEDataType, >- source, >- new String[] >- { >- "name", "long:Object", >- "baseType", "long" >- }); >- addAnnotation >- (nameEDataType, >- source, >- new String[] >- { >- "name", "Name", >- "baseType", "token", >- "pattern", "\\i\\c*" >- }); >- addAnnotation >- (ncNameEDataType, >- source, >- new String[] >- { >- "name", "NCName", >- "baseType", "Name", >- "pattern", "[\\i-[:]][\\c-[:]]*" >- }); >- addAnnotation >- (negativeIntegerEDataType, >- source, >- new String[] >- { >- "name", "negativeInteger", >- "baseType", "nonPositiveInteger", >- "maxInclusive", "-1" >- }); >- addAnnotation >- (nmtokenEDataType, >- source, >- new String[] >- { >- "name", "NMTOKEN", >- "baseType", "token", >- "pattern", "\\c+" >- }); >- addAnnotation >- (nmtokensEDataType, >- source, >- new String[] >- { >- "name", "NMTOKENS", >- "baseType", "NMTOKENS_._base", >- "minLength", "1" >- }); >- addAnnotation >- (nmtokensBaseEDataType, >- source, >- new String[] >- { >- "name", "NMTOKENS_._base", >- "itemType", "NMTOKEN" >- }); >- addAnnotation >- (nonNegativeIntegerEDataType, >- source, >- new String[] >- { >- "name", "nonNegativeInteger", >- "baseType", "integer", >- "minInclusive", "0" >- }); >- addAnnotation >- (nonPositiveIntegerEDataType, >- source, >- new String[] >- { >- "name", "nonPositiveInteger", >- "baseType", "integer", >- "maxInclusive", "0" >- }); >- addAnnotation >- (normalizedStringEDataType, >- source, >- new String[] >- { >- "name", "normalizedString", >- "baseType", "string", >- "whiteSpace", "replace" >- }); >- addAnnotation >- (notationEDataType, >- source, >- new String[] >- { >- "name", "NOTATION", >- "baseType", "anySimpleType", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (positiveIntegerEDataType, >- source, >- new String[] >- { >- "name", "positiveInteger", >- "baseType", "nonNegativeInteger", >- "minInclusive", "1" >- }); >- addAnnotation >- (qNameEDataType, >- source, >- new String[] >- { >- "name", "QName", >- "baseType", "anySimpleType", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (shortEDataType, >- source, >- new String[] >- { >- "name", "short" >- }); >- addAnnotation >- (shortObjectEDataType, >- source, >- new String[] >- { >- "name", "short:Object", >- "baseType", "short" >- }); >- addAnnotation >- (simpleAnyTypeEClass, >- source, >- new String[] >- { >- "name", "simpleAnyType", >- "kind", "simple" >- }); >- addAnnotation >- (getSimpleAnyType_RawValue(), >- source, >- new String[] >- { >- "name", ":3", >- "kind", "simple" >- }); >- addAnnotation >- (getSimpleAnyType_Value(), >- source, >- new String[] >- { >- "name", ":4", >- "kind", "simple" >- }); >- addAnnotation >- (getSimpleAnyType_InstanceType(), >- source, >- new String[] >- { >- "name", ":5", >- "kind", "simple" >- }); >- addAnnotation >- (stringEDataType, >- source, >- new String[] >- { >- "name", "string", >- "whiteSpace", "preserve" >- }); >- addAnnotation >- (timeEDataType, >- source, >- new String[] >- { >- "name", "time", >- "baseType", "anySimpleType", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (tokenEDataType, >- source, >- new String[] >- { >- "name", "token", >- "baseType", "normalizedString", >- "whiteSpace", "collapse" >- }); >- addAnnotation >- (unsignedByteEDataType, >- source, >- new String[] >- { >- "name", "unsignedByte", >- "maxInclusive", "255", >- "minInclusive", "0" >- }); >- addAnnotation >- (unsignedByteObjectEDataType, >- source, >- new String[] >- { >- "name", "unsignedByte:Object", >- "baseType", "unsignedByte" >- }); >- addAnnotation >- (unsignedIntEDataType, >- source, >- new String[] >- { >- "name", "unsignedInt", >- "maxInclusive", "4294967295", >- "minInclusive", "0" >- }); >- addAnnotation >- (unsignedIntObjectEDataType, >- source, >- new String[] >- { >- "name", "unsignedInt:Object", >- "baseType", "unsignedInt" >- }); >- addAnnotation >- (unsignedLongEDataType, >- source, >- new String[] >- { >- "name", "unsignedLong", >- "baseType", "nonNegativeInteger", >- "maxInclusive", "18446744073709551615", >- "minInclusive", "0" >- }); >- addAnnotation >- (unsignedShortEDataType, >- source, >- new String[] >- { >- "name", "unsignedShort", >- "maxInclusive", "65535", >- "minInclusive", "0" >- }); >- addAnnotation >- (unsignedShortObjectEDataType, >- source, >- new String[] >- { >- "name", "unsignedShort:Object", >- "baseType", "unsignedShort" >- }); >- addAnnotation >- (xmlTypeDocumentRootEClass, >- source, >- new String[] >- { >- "name", "", >- "kind", "mixed" >- }); >- addAnnotation >- (getXMLTypeDocumentRoot_Mixed(), >- source, >- new String[] >- { >- "kind", "elementWildcard", >- "name", ":mixed" >- }); >- addAnnotation >- (getXMLTypeDocumentRoot_XMLNSPrefixMap(), >- source, >- new String[] >- { >- "kind", "attribute", >- "name", "xmlns:prefix" >- }); >- addAnnotation >- (getXMLTypeDocumentRoot_XSISchemaLocation(), >- source, >- new String[] >- { >- "kind", "attribute", >- "name", "xsi:schemaLocation" >- }); >- addAnnotation >- (getXMLTypeDocumentRoot_CDATA(), >- source, >- new String[] >- { >- "kind", "element", >- "name", "cDATA", >- "namespace", "##targetNamespace" >- }); >- addAnnotation >- (getXMLTypeDocumentRoot_Comment(), >- source, >- new String[] >- { >- "kind", "element", >- "name", "comment", >- "namespace", "##targetNamespace" >- }); >- addAnnotation >- (getXMLTypeDocumentRoot_Text(), >- source, >- new String[] >- { >- "kind", "element", >- "name", "text", >- "namespace", "##targetNamespace" >- }); >- } >- >- /** >- * Initializes the annotations for <b>null</b>. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- protected void createNullAnnotations() >- { >- } >-} //XMLTypePackageImpl >+} >Index: src/org/eclipse/emf/ecore/xml/type/impl/SimpleAnyTypeImpl.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/type/impl/SimpleAnyTypeImpl.java >diff -N src/org/eclipse/emf/ecore/xml/type/impl/SimpleAnyTypeImpl.java >--- src/org/eclipse/emf/ecore/xml/type/impl/SimpleAnyTypeImpl.java 23 Nov 2005 18:10:02 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,288 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: SimpleAnyTypeImpl.java,v 1.6 2005/11/23 18:10:02 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.xml.type.impl; >- >-import java.util.Iterator; >- >-import org.eclipse.emf.common.notify.Notification; >-import org.eclipse.emf.ecore.EClass; >-import org.eclipse.emf.ecore.EDataType; >-import org.eclipse.emf.ecore.impl.ENotificationImpl; >-import org.eclipse.emf.ecore.util.EcoreUtil; >-import org.eclipse.emf.ecore.util.FeatureMap; >-import org.eclipse.emf.ecore.xml.type.SimpleAnyType; >-import org.eclipse.emf.ecore.xml.type.XMLTypePackage; >- >-/** >- * <!-- begin-user-doc --> >- * An implementation of the model object '<em><b>Simple Any Type</b></em>'. >- * <!-- end-user-doc --> >- * <p> >- * The following features are implemented: >- * <ul> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.SimpleAnyTypeImpl#getRawValue <em>Raw Value</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.SimpleAnyTypeImpl#getValue <em>Value</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.SimpleAnyTypeImpl#getInstanceType <em>Instance Type</em>}</li> >- * </ul> >- * </p> >- * >- * @generated >- */ >-public class SimpleAnyTypeImpl extends AnyTypeImpl implements SimpleAnyType >-{ >- /** >- * The default value of the '{@link #getRawValue() <em>Raw Value</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getRawValue() >- * @generated >- * @ordered >- */ >- protected static final String RAW_VALUE_EDEFAULT = null; >- >- /** >- * The default value of the '{@link #getValue() <em>Value</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getValue() >- * @generated >- * @ordered >- */ >- protected static final Object VALUE_EDEFAULT = null; >- >- /** >- * The cached value of the '{@link #getInstanceType() <em>Instance Type</em>}' reference. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getInstanceType() >- * @generated >- * @ordered >- */ >- protected EDataType instanceType = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected SimpleAnyTypeImpl() >- { >- super(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected EClass eStaticClass() >- { >- return XMLTypePackage.Literals.SIMPLE_ANY_TYPE; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public String getRawValue() >- { >- StringBuffer value = new StringBuffer(); >- for (Iterator i = getMixed().iterator(); i.hasNext(); ) >- { >- FeatureMap.Entry entry = (FeatureMap.Entry)i.next(); >- if (entry.getEStructuralFeature() == XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text()) >- { >- value.append(entry.getValue()); >- } >- } >- return value.toString(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public void setRawValue(String newRawValue) >- { >- getMixed().clear(); >- if (newRawValue != null) >- { >- getMixed().add(XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text(), newRawValue); >- } >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public Object getValue() >- { >- return EcoreUtil.createFromString(instanceType, getRawValue()); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated NOT >- */ >- public void setValue(Object newValue) >- { >- setRawValue(EcoreUtil.convertToString(instanceType, newValue)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public EDataType getInstanceType() >- { >- return instanceType; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void setInstanceType(EDataType newInstanceType) >- { >- EDataType oldInstanceType = instanceType; >- instanceType = newInstanceType; >- if (eNotificationRequired()) >- eNotify(new ENotificationImpl(this, Notification.SET, XMLTypePackage.SIMPLE_ANY_TYPE__INSTANCE_TYPE, oldInstanceType, instanceType)); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object eGet(int featureID, boolean resolve, boolean coreType) >- { >- switch (featureID) >- { >- case XMLTypePackage.SIMPLE_ANY_TYPE__MIXED: >- if (coreType) return getMixed(); >- return ((FeatureMap.Internal)getMixed()).getWrapper(); >- case XMLTypePackage.SIMPLE_ANY_TYPE__ANY: >- if (coreType) return getAny(); >- return ((FeatureMap.Internal)getAny()).getWrapper(); >- case XMLTypePackage.SIMPLE_ANY_TYPE__ANY_ATTRIBUTE: >- if (coreType) return getAnyAttribute(); >- return ((FeatureMap.Internal)getAnyAttribute()).getWrapper(); >- case XMLTypePackage.SIMPLE_ANY_TYPE__RAW_VALUE: >- return getRawValue(); >- case XMLTypePackage.SIMPLE_ANY_TYPE__VALUE: >- return getValue(); >- case XMLTypePackage.SIMPLE_ANY_TYPE__INSTANCE_TYPE: >- return getInstanceType(); >- } >- return eDynamicGet(featureID, resolve, coreType); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void eSet(int featureID, Object newValue) >- { >- switch (featureID) >- { >- case XMLTypePackage.SIMPLE_ANY_TYPE__MIXED: >- ((FeatureMap.Internal)getMixed()).set(newValue); >- return; >- case XMLTypePackage.SIMPLE_ANY_TYPE__ANY: >- ((FeatureMap.Internal)getAny()).set(newValue); >- return; >- case XMLTypePackage.SIMPLE_ANY_TYPE__ANY_ATTRIBUTE: >- ((FeatureMap.Internal)getAnyAttribute()).set(newValue); >- return; >- case XMLTypePackage.SIMPLE_ANY_TYPE__RAW_VALUE: >- setRawValue((String)newValue); >- return; >- case XMLTypePackage.SIMPLE_ANY_TYPE__VALUE: >- setValue((Object)newValue); >- return; >- case XMLTypePackage.SIMPLE_ANY_TYPE__INSTANCE_TYPE: >- setInstanceType((EDataType)newValue); >- return; >- } >- eDynamicSet(featureID, newValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void eUnset(int featureID) >- { >- switch (featureID) >- { >- case XMLTypePackage.SIMPLE_ANY_TYPE__MIXED: >- getMixed().clear(); >- return; >- case XMLTypePackage.SIMPLE_ANY_TYPE__ANY: >- getAny().clear(); >- return; >- case XMLTypePackage.SIMPLE_ANY_TYPE__ANY_ATTRIBUTE: >- getAnyAttribute().clear(); >- return; >- case XMLTypePackage.SIMPLE_ANY_TYPE__RAW_VALUE: >- setRawValue(RAW_VALUE_EDEFAULT); >- return; >- case XMLTypePackage.SIMPLE_ANY_TYPE__VALUE: >- setValue(VALUE_EDEFAULT); >- return; >- case XMLTypePackage.SIMPLE_ANY_TYPE__INSTANCE_TYPE: >- setInstanceType((EDataType)null); >- return; >- } >- eDynamicUnset(featureID); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean eIsSet(int featureID) >- { >- switch (featureID) >- { >- case XMLTypePackage.SIMPLE_ANY_TYPE__MIXED: >- return mixed != null && !mixed.isEmpty(); >- case XMLTypePackage.SIMPLE_ANY_TYPE__ANY: >- return !getAny().isEmpty(); >- case XMLTypePackage.SIMPLE_ANY_TYPE__ANY_ATTRIBUTE: >- return anyAttribute != null && !anyAttribute.isEmpty(); >- case XMLTypePackage.SIMPLE_ANY_TYPE__RAW_VALUE: >- return RAW_VALUE_EDEFAULT == null ? getRawValue() != null : !RAW_VALUE_EDEFAULT.equals(getRawValue()); >- case XMLTypePackage.SIMPLE_ANY_TYPE__VALUE: >- return VALUE_EDEFAULT == null ? getValue() != null : !VALUE_EDEFAULT.equals(getValue()); >- case XMLTypePackage.SIMPLE_ANY_TYPE__INSTANCE_TYPE: >- return instanceType != null; >- } >- return eDynamicIsSet(featureID); >- } >- >-} //SimpleAnyTypeImpl >Index: src/org/eclipse/emf/ecore/xml/type/impl/AnyTypeImpl.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/type/impl/AnyTypeImpl.java >diff -N src/org/eclipse/emf/ecore/xml/type/impl/AnyTypeImpl.java >--- src/org/eclipse/emf/ecore/xml/type/impl/AnyTypeImpl.java 25 Nov 2005 17:49:49 -0000 1.7 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,246 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: AnyTypeImpl.java,v 1.7 2005/11/25 17:49:49 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.xml.type.impl; >- >-import org.eclipse.emf.common.notify.NotificationChain; >-import org.eclipse.emf.ecore.EClass; >-import org.eclipse.emf.ecore.InternalEObject; >-import org.eclipse.emf.ecore.impl.EObjectImpl; >-import org.eclipse.emf.ecore.util.BasicFeatureMap; >-import org.eclipse.emf.ecore.util.FeatureMap; >-import org.eclipse.emf.ecore.util.InternalEList; >-import org.eclipse.emf.ecore.xml.type.AnyType; >-import org.eclipse.emf.ecore.xml.type.XMLTypePackage; >- >-/** >- * <!-- begin-user-doc --> >- * An implementation of the model object '<em><b>Any Type</b></em>'. >- * <!-- end-user-doc --> >- * <p> >- * The following features are implemented: >- * <ul> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl#getMixed <em>Mixed</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl#getAny <em>Any</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl#getAnyAttribute <em>Any Attribute</em>}</li> >- * </ul> >- * </p> >- * >- * @generated >- */ >-public class AnyTypeImpl extends EObjectImpl implements AnyType >-{ >- /** >- * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getMixed() >- * @generated >- * @ordered >- */ >- protected FeatureMap mixed = null; >- >- /** >- * The cached value of the '{@link #getAnyAttribute() <em>Any Attribute</em>}' attribute list. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #getAnyAttribute() >- * @generated >- * @ordered >- */ >- protected FeatureMap anyAttribute = null; >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected AnyTypeImpl() >- { >- super(); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- protected EClass eStaticClass() >- { >- return XMLTypePackage.Literals.ANY_TYPE; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public FeatureMap getMixed() >- { >- if (mixed == null) >- { >- mixed = new BasicFeatureMap(this, XMLTypePackage.ANY_TYPE__MIXED); >- } >- return mixed; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public FeatureMap getAny() >- { >- return (FeatureMap)((FeatureMap)getMixed()).list(XMLTypePackage.Literals.ANY_TYPE__ANY); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public FeatureMap getAnyAttribute() >- { >- if (anyAttribute == null) >- { >- anyAttribute = new BasicFeatureMap(this, XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE); >- } >- return anyAttribute; >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) >- { >- switch (featureID) >- { >- case XMLTypePackage.ANY_TYPE__MIXED: >- return ((InternalEList)getMixed()).basicRemove(otherEnd, msgs); >- case XMLTypePackage.ANY_TYPE__ANY: >- return ((InternalEList)getAny()).basicRemove(otherEnd, msgs); >- case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: >- return ((InternalEList)getAnyAttribute()).basicRemove(otherEnd, msgs); >- } >- return eDynamicInverseRemove(otherEnd, featureID, msgs); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public Object eGet(int featureID, boolean resolve, boolean coreType) >- { >- switch (featureID) >- { >- case XMLTypePackage.ANY_TYPE__MIXED: >- if (coreType) return getMixed(); >- return ((FeatureMap.Internal)getMixed()).getWrapper(); >- case XMLTypePackage.ANY_TYPE__ANY: >- if (coreType) return getAny(); >- return ((FeatureMap.Internal)getAny()).getWrapper(); >- case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: >- if (coreType) return getAnyAttribute(); >- return ((FeatureMap.Internal)getAnyAttribute()).getWrapper(); >- } >- return eDynamicGet(featureID, resolve, coreType); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void eSet(int featureID, Object newValue) >- { >- switch (featureID) >- { >- case XMLTypePackage.ANY_TYPE__MIXED: >- ((FeatureMap.Internal)getMixed()).set(newValue); >- return; >- case XMLTypePackage.ANY_TYPE__ANY: >- ((FeatureMap.Internal)getAny()).set(newValue); >- return; >- case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: >- ((FeatureMap.Internal)getAnyAttribute()).set(newValue); >- return; >- } >- eDynamicSet(featureID, newValue); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public void eUnset(int featureID) >- { >- switch (featureID) >- { >- case XMLTypePackage.ANY_TYPE__MIXED: >- getMixed().clear(); >- return; >- case XMLTypePackage.ANY_TYPE__ANY: >- getAny().clear(); >- return; >- case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: >- getAnyAttribute().clear(); >- return; >- } >- eDynamicUnset(featureID); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public boolean eIsSet(int featureID) >- { >- switch (featureID) >- { >- case XMLTypePackage.ANY_TYPE__MIXED: >- return mixed != null && !mixed.isEmpty(); >- case XMLTypePackage.ANY_TYPE__ANY: >- return !getAny().isEmpty(); >- case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: >- return anyAttribute != null && !anyAttribute.isEmpty(); >- } >- return eDynamicIsSet(featureID); >- } >- >- /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public String toString() >- { >- if (eIsProxy()) return super.toString(); >- >- StringBuffer result = new StringBuffer(super.toString()); >- result.append(" (mixed: "); >- result.append(mixed); >- result.append(", anyAttribute: "); >- result.append(anyAttribute); >- result.append(')'); >- return result.toString(); >- } >- >-} //AnyTypeImpl >Index: src/org/eclipse/emf/ecore/xml/namespace/XMLNamespaceDocumentRoot.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/namespace/XMLNamespaceDocumentRoot.java >diff -N src/org/eclipse/emf/ecore/xml/namespace/XMLNamespaceDocumentRoot.java >--- src/org/eclipse/emf/ecore/xml/namespace/XMLNamespaceDocumentRoot.java 23 Sep 2005 17:46:24 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,241 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLNamespaceDocumentRoot.java,v 1.6 2005/09/23 17:46:24 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.xml.namespace; >- >- >-import org.eclipse.emf.common.util.EMap; >-import org.eclipse.emf.ecore.EObject; >-import org.eclipse.emf.ecore.util.FeatureMap; >- >- >-/** >- * <!-- begin-user-doc --> >- * A representation of the model object '<em><b>Document Root</b></em>'. >- * <!-- end-user-doc --> >- * >- * <p> >- * The following features are supported: >- * <ul> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getMixed <em>Mixed</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getXMLNSPrefixMap <em>XMLNS Prefix Map</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getXSISchemaLocation <em>XSI Schema Location</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getBase <em>Base</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getId <em>Id</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getLang <em>Lang</em>}</li> >- * <li>{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getSpace <em>Space</em>}</li> >- * </ul> >- * </p> >- * >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage#getXMLNamespaceDocumentRoot() >- * @model extendedMetaData="name='' kind='mixed'" >- * @generated >- */ >-public interface XMLNamespaceDocumentRoot extends EObject >-{ >- /** >- * Returns the value of the '<em><b>Mixed</b></em>' attribute list. >- * The list contents are of type {@link org.eclipse.emf.ecore.util.FeatureMap.Entry}. >- * <!-- begin-user-doc --> >- * <p> >- * If the meaning of the '<em>Mixed</em>' attribute list isn't clear, >- * there really should be more of a description here... >- * </p> >- * <!-- end-user-doc --> >- * @return the value of the '<em>Mixed</em>' attribute list. >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage#getXMLNamespaceDocumentRoot_Mixed() >- * @model unique="false" dataType="org.eclipse.emf.ecore.EFeatureMapEntry" many="true" >- * extendedMetaData="kind='elementWildcard' name=':mixed'" >- * @generated >- */ >- FeatureMap getMixed(); >- >- /** >- * Returns the value of the '<em><b>XMLNS Prefix Map</b></em>' map. >- * The key is of type {@link java.lang.String}, >- * and the value is of type {@link java.lang.String}, >- * <!-- begin-user-doc --> >- * <p> >- * If the meaning of the '<em>XMLNS Prefix Map</em>' map isn't clear, >- * there really should be more of a description here... >- * </p> >- * <!-- end-user-doc --> >- * @return the value of the '<em>XMLNS Prefix Map</em>' map. >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage#getXMLNamespaceDocumentRoot_XMLNSPrefixMap() >- * @model mapType="org.eclipse.emf.ecore.EStringToStringMapEntry" keyType="java.lang.String" valueType="java.lang.String" transient="true" >- * extendedMetaData="kind='attribute' name='xmlns:prefix'" >- * @generated >- */ >- EMap getXMLNSPrefixMap(); >- >- /** >- * Returns the value of the '<em><b>XSI Schema Location</b></em>' map. >- * The key is of type {@link java.lang.String}, >- * and the value is of type {@link java.lang.String}, >- * <!-- begin-user-doc --> >- * <p> >- * If the meaning of the '<em>XSI Schema Location</em>' map isn't clear, >- * there really should be more of a description here... >- * </p> >- * <!-- end-user-doc --> >- * @return the value of the '<em>XSI Schema Location</em>' map. >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage#getXMLNamespaceDocumentRoot_XSISchemaLocation() >- * @model mapType="org.eclipse.emf.ecore.EStringToStringMapEntry" keyType="java.lang.String" valueType="java.lang.String" transient="true" >- * extendedMetaData="kind='attribute' name='xsi:schemaLocation'" >- * @generated >- */ >- EMap getXSISchemaLocation(); >- >- /** >- * Returns the value of the '<em><b>Base</b></em>' attribute. >- * <!-- begin-user-doc --> >- * <p> >- * If the meaning of the '<em>Base</em>' attribute isn't clear, >- * there really should be more of a description here... >- * </p> >- * <!-- end-user-doc --> >- * @return the value of the '<em>Base</em>' attribute. >- * @see #setBase(String) >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage#getXMLNamespaceDocumentRoot_Base() >- * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.AnyURI" >- * extendedMetaData="kind='attribute' name='base' namespace='##targetNamespace'" >- * @generated >- */ >- String getBase(); >- >- /** >- * Sets the value of the '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getBase <em>Base</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param value the new value of the '<em>Base</em>' attribute. >- * @see #getBase() >- * @generated >- */ >- void setBase(String value); >- >- /** >- * Returns the value of the '<em><b>Id</b></em>' attribute. >- * <!-- begin-user-doc --> >- * <p> >- * If the meaning of the '<em>Id</em>' attribute isn't clear, >- * there really should be more of a description here... >- * </p> >- * <!-- end-user-doc --> >- * @return the value of the '<em>Id</em>' attribute. >- * @see #setId(String) >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage#getXMLNamespaceDocumentRoot_Id() >- * @model unique="false" id="true" dataType="org.eclipse.emf.ecore.xml.type.ID" >- * extendedMetaData="kind='attribute' name='id' namespace='##targetNamespace'" >- * @generated >- */ >- String getId(); >- >- /** >- * Sets the value of the '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getId <em>Id</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param value the new value of the '<em>Id</em>' attribute. >- * @see #getId() >- * @generated >- */ >- void setId(String value); >- >- /** >- * Returns the value of the '<em><b>Lang</b></em>' attribute. >- * <!-- begin-user-doc --> >- * <p> >- * If the meaning of the '<em>Lang</em>' attribute isn't clear, >- * there really should be more of a description here... >- * </p> >- * <!-- end-user-doc --> >- * @return the value of the '<em>Lang</em>' attribute. >- * @see #setLang(String) >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage#getXMLNamespaceDocumentRoot_Lang() >- * @model unique="false" dataType="org.eclipse.emf.ecore.xml.namespace.LangType" >- * extendedMetaData="kind='attribute' name='lang' namespace='##targetNamespace'" >- * @generated >- */ >- String getLang(); >- >- /** >- * Sets the value of the '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getLang <em>Lang</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param value the new value of the '<em>Lang</em>' attribute. >- * @see #getLang() >- * @generated >- */ >- void setLang(String value); >- >- /** >- * Returns the value of the '<em><b>Space</b></em>' attribute. >- * The default value is <code>"preserve"</code>. >- * The literals are from the enumeration {@link org.eclipse.emf.ecore.xml.namespace.SpaceType}. >- * <!-- begin-user-doc --> >- * <p> >- * If the meaning of the '<em>Space</em>' attribute isn't clear, >- * there really should be more of a description here... >- * </p> >- * <!-- end-user-doc --> >- * @return the value of the '<em>Space</em>' attribute. >- * @see org.eclipse.emf.ecore.xml.namespace.SpaceType >- * @see #isSetSpace() >- * @see #unsetSpace() >- * @see #setSpace(SpaceType) >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage#getXMLNamespaceDocumentRoot_Space() >- * @model default="preserve" unique="false" unsettable="true" >- * extendedMetaData="kind='attribute' name='space' namespace='##targetNamespace'" >- * @generated >- */ >- SpaceType getSpace(); >- >- /** >- * Sets the value of the '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getSpace <em>Space</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @param value the new value of the '<em>Space</em>' attribute. >- * @see org.eclipse.emf.ecore.xml.namespace.SpaceType >- * @see #isSetSpace() >- * @see #unsetSpace() >- * @see #getSpace() >- * @generated >- */ >- void setSpace(SpaceType value); >- >- /** >- * Unsets the value of the '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getSpace <em>Space</em>}' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #isSetSpace() >- * @see #getSpace() >- * @see #setSpace(SpaceType) >- * @generated >- */ >- void unsetSpace(); >- >- /** >- * Returns whether the value of the '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getSpace <em>Space</em>}' attribute is set. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return whether the value of the '<em>Space</em>' attribute is set. >- * @see #unsetSpace() >- * @see #getSpace() >- * @see #setSpace(SpaceType) >- * @generated >- */ >- boolean isSetSpace(); >- >-} // DocumentRoot >Index: src/org/eclipse/emf/ecore/xml/namespace/XMLNamespaceFactory.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/namespace/XMLNamespaceFactory.java >diff -N src/org/eclipse/emf/ecore/xml/namespace/XMLNamespaceFactory.java >--- src/org/eclipse/emf/ecore/xml/namespace/XMLNamespaceFactory.java 23 Nov 2005 13:56:58 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,56 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLNamespaceFactory.java,v 1.3 2005/11/23 13:56:58 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.xml.namespace; >- >-import org.eclipse.emf.ecore.EFactory; >- >-/** >- * <!-- begin-user-doc --> >- * The <b>Factory</b> for the model. >- * It provides a create method for each non-abstract class of the model. >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage >- * @generated >- */ >-public interface XMLNamespaceFactory extends EFactory{ >- /** >- * The singleton instance of the factory. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- XMLNamespaceFactory eINSTANCE = org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceFactoryImpl.init(); >- >- /** >- * Returns a new object of class '<em>Document Root</em>'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return a new object of class '<em>Document Root</em>'. >- * @generated >- */ >- XMLNamespaceDocumentRoot createXMLNamespaceDocumentRoot(); >- >- /** >- * Returns the package supported by this factory. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the package supported by this factory. >- * @generated >- */ >- XMLNamespacePackage getXMLNamespacePackage(); >- >-} //XMLNamespaceFactory >Index: src/org/eclipse/emf/ecore/xml/namespace/SpaceType.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/namespace/SpaceType.java >diff -N src/org/eclipse/emf/ecore/xml/namespace/SpaceType.java >--- src/org/eclipse/emf/ecore/xml/namespace/SpaceType.java 8 Nov 2005 12:59:06 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,172 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-2004 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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: SpaceType.java,v 1.3 2005/11/08 12:59:06 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.xml.namespace; >- >-import java.util.Arrays; >-import java.util.Collections; >-import java.util.List; >- >-import org.eclipse.emf.common.util.AbstractEnumerator; >- >-/** >- * <!-- begin-user-doc --> >- * A representation of the literals of the enumeration '<em><b>Space Type</b></em>', >- * and utility methods for working with them. >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage#getSpaceType() >- * @model >- * @generated >- */ >-public final class SpaceType extends AbstractEnumerator >-{ >- /** >- * The '<em><b>Default</b></em>' literal value. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #DEFAULT_LITERAL >- * @model name="default" >- * @generated >- * @ordered >- */ >- public static final int DEFAULT = 0; >- >- /** >- * The '<em><b>Preserve</b></em>' literal value. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see #PRESERVE_LITERAL >- * @model name="preserve" >- * @generated >- * @ordered >- */ >- public static final int PRESERVE = 1; >- >- /** >- * The '<em><b>Default</b></em>' literal object. >- * <!-- begin-user-doc --> >- * <p> >- * If the meaning of '<em><b>Default</b></em>' literal object isn't clear, >- * there really should be more of a description here... >- * </p> >- * <!-- end-user-doc --> >- * @see #DEFAULT >- * @generated >- * @ordered >- */ >- public static final SpaceType DEFAULT_LITERAL = new SpaceType(DEFAULT, "default", "default"); >- >- /** >- * The '<em><b>Preserve</b></em>' literal object. >- * <!-- begin-user-doc --> >- * <p> >- * If the meaning of '<em><b>Preserve</b></em>' literal object isn't clear, >- * there really should be more of a description here... >- * </p> >- * <!-- end-user-doc --> >- * @see #PRESERVE >- * @generated >- * @ordered >- */ >- public static final SpaceType PRESERVE_LITERAL = new SpaceType(PRESERVE, "preserve", "preserve"); >- >- /** >- * An array of all the '<em><b>Space Type</b></em>' enumerators. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private static final SpaceType[] VALUES_ARRAY = >- new SpaceType[] >- { >- DEFAULT_LITERAL, >- PRESERVE_LITERAL, >- }; >- >- /** >- * A public read-only list of all the '<em><b>Space Type</b></em>' enumerators. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); >- >- /** >- * Returns the '<em><b>Space Type</b></em>' literal with the specified literal value. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static SpaceType get(String literal) >- { >- for (int i = 0; i < VALUES_ARRAY.length; ++i) >- { >- SpaceType result = VALUES_ARRAY[i]; >- if (result.toString().equals(literal)) >- { >- return result; >- } >- } >- return null; >- } >- >- /** >- * Returns the '<em><b>Space Type</b></em>' literal with the specified name. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static SpaceType getByName(String name) >- { >- for (int i = 0; i < VALUES_ARRAY.length; ++i) >- { >- SpaceType result = VALUES_ARRAY[i]; >- if (result.getName().equals(name)) >- { >- return result; >- } >- } >- return null; >- } >- >- /** >- * Returns the '<em><b>Space Type</b></em>' literal with the specified integer value. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- public static SpaceType get(int value) >- { >- switch (value) >- { >- case DEFAULT: return DEFAULT_LITERAL; >- case PRESERVE: return PRESERVE_LITERAL; >- } >- return null; >- } >- >- /** >- * Only this class can construct instances. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- private SpaceType(int value, String name, String literal) >- { >- super(value, name, literal); >- } >- >-} //SpaceType >Index: src/org/eclipse/emf/ecore/xml/namespace/XMLNamespacePackage.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/xml/namespace/XMLNamespacePackage.java >diff -N src/org/eclipse/emf/ecore/xml/namespace/XMLNamespacePackage.java >--- src/org/eclipse/emf/ecore/xml/namespace/XMLNamespacePackage.java 23 Nov 2005 18:10:02 -0000 1.8 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,463 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2003-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 - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: XMLNamespacePackage.java,v 1.8 2005/11/23 18:10:02 emerks Exp $ >- */ >-package org.eclipse.emf.ecore.xml.namespace; >- >- >-import org.eclipse.emf.ecore.EAttribute; >-import org.eclipse.emf.ecore.EClass; >-import org.eclipse.emf.ecore.EDataType; >-import org.eclipse.emf.ecore.EEnum; >-import org.eclipse.emf.ecore.EPackage; >-import org.eclipse.emf.ecore.EReference; >- >- >-/** >- * <!-- begin-user-doc --> >- * The <b>Package</b> for the model. >- * It contains accessors for the meta objects to represent >- * <ul> >- * <li>each class,</li> >- * <li>each feature of each class,</li> >- * <li>each enum,</li> >- * <li>and each data type</li> >- * </ul> >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespaceFactory >- * @model kind="package" >- * @generated >- */ >-public interface XMLNamespacePackage extends EPackage{ >- /** >- * The package name. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- String eNAME = "namespace"; >- >- /** >- * The package namespace URI. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- String eNS_URI = "http://www.w3.org/XML/1998/namespace"; >- >- /** >- * The package namespace name. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- String eNS_PREFIX = "xml"; >- >- /** >- * The singleton instance of the package. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- XMLNamespacePackage eINSTANCE = org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespacePackageImpl.init(); >- >- /** >- * The meta object id for the '{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl <em>Document Root</em>}' class. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespacePackageImpl#getXMLNamespaceDocumentRoot() >- * @generated >- */ >- int XML_NAMESPACE_DOCUMENT_ROOT = 0; >- >- /** >- * The feature id for the '<em><b>Mixed</b></em>' attribute list. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @ordered >- */ >- int XML_NAMESPACE_DOCUMENT_ROOT__MIXED = 0; >- >- /** >- * The feature id for the '<em><b>XMLNS Prefix Map</b></em>' map. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @ordered >- */ >- int XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP = 1; >- >- /** >- * The feature id for the '<em><b>XSI Schema Location</b></em>' map. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @ordered >- */ >- int XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = 2; >- >- /** >- * The feature id for the '<em><b>Base</b></em>' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @ordered >- */ >- int XML_NAMESPACE_DOCUMENT_ROOT__BASE = 3; >- >- /** >- * The feature id for the '<em><b>Id</b></em>' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @ordered >- */ >- int XML_NAMESPACE_DOCUMENT_ROOT__ID = 4; >- >- /** >- * The feature id for the '<em><b>Lang</b></em>' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @ordered >- */ >- int XML_NAMESPACE_DOCUMENT_ROOT__LANG = 5; >- >- /** >- * The feature id for the '<em><b>Space</b></em>' attribute. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @ordered >- */ >- int XML_NAMESPACE_DOCUMENT_ROOT__SPACE = 6; >- >- /** >- * The number of structural features of the '<em>Document Root</em>' class. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- * @ordered >- */ >- int XML_NAMESPACE_DOCUMENT_ROOT_FEATURE_COUNT = 7; >- >- /** >- * The meta object id for the '{@link org.eclipse.emf.ecore.xml.namespace.SpaceType <em>Space Type</em>}' enum. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.namespace.SpaceType >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespacePackageImpl#getSpaceType() >- * @generated >- */ >- int SPACE_TYPE = 1; >- >- /** >- * The meta object id for the '<em>Lang Type</em>' data type. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see java.lang.String >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespacePackageImpl#getLangType() >- * @generated >- */ >- int LANG_TYPE = 2; >- >- /** >- * The meta object id for the '<em>Lang Type Null</em>' data type. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see java.lang.String >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespacePackageImpl#getLangTypeNull() >- * @generated >- */ >- int LANG_TYPE_NULL = 3; >- >- /** >- * The meta object id for the '<em>Space Type Object</em>' data type. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.namespace.SpaceType >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespacePackageImpl#getSpaceTypeObject() >- * @generated >- */ >- int SPACE_TYPE_OBJECT = 4; >- >- >- /** >- * Returns the meta object for class '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot <em>Document Root</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for class '<em>Document Root</em>'. >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot >- * @generated >- */ >- EClass getXMLNamespaceDocumentRoot(); >- >- /** >- * Returns the meta object for the attribute list '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getMixed <em>Mixed</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for the attribute list '<em>Mixed</em>'. >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getMixed() >- * @see #getXMLNamespaceDocumentRoot() >- * @generated >- */ >- EAttribute getXMLNamespaceDocumentRoot_Mixed(); >- >- /** >- * Returns the meta object for the map '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getXMLNSPrefixMap <em>XMLNS Prefix Map</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for the map '<em>XMLNS Prefix Map</em>'. >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getXMLNSPrefixMap() >- * @see #getXMLNamespaceDocumentRoot() >- * @generated >- */ >- EReference getXMLNamespaceDocumentRoot_XMLNSPrefixMap(); >- >- /** >- * Returns the meta object for the map '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getXSISchemaLocation <em>XSI Schema Location</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for the map '<em>XSI Schema Location</em>'. >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getXSISchemaLocation() >- * @see #getXMLNamespaceDocumentRoot() >- * @generated >- */ >- EReference getXMLNamespaceDocumentRoot_XSISchemaLocation(); >- >- /** >- * Returns the meta object for the attribute '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getBase <em>Base</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for the attribute '<em>Base</em>'. >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getBase() >- * @see #getXMLNamespaceDocumentRoot() >- * @generated >- */ >- EAttribute getXMLNamespaceDocumentRoot_Base(); >- >- /** >- * Returns the meta object for the attribute '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getId <em>Id</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for the attribute '<em>Id</em>'. >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getId() >- * @see #getXMLNamespaceDocumentRoot() >- * @generated >- */ >- EAttribute getXMLNamespaceDocumentRoot_Id(); >- >- /** >- * Returns the meta object for the attribute '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getLang <em>Lang</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for the attribute '<em>Lang</em>'. >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getLang() >- * @see #getXMLNamespaceDocumentRoot() >- * @generated >- */ >- EAttribute getXMLNamespaceDocumentRoot_Lang(); >- >- /** >- * Returns the meta object for the attribute '{@link org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getSpace <em>Space</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for the attribute '<em>Space</em>'. >- * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot#getSpace() >- * @see #getXMLNamespaceDocumentRoot() >- * @generated >- */ >- EAttribute getXMLNamespaceDocumentRoot_Space(); >- >- /** >- * Returns the meta object for enum '{@link org.eclipse.emf.ecore.xml.namespace.SpaceType <em>Space Type</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for enum '<em>Space Type</em>'. >- * @see org.eclipse.emf.ecore.xml.namespace.SpaceType >- * @generated >- */ >- EEnum getSpaceType(); >- >- /** >- * Returns the meta object for data type '{@link java.lang.String <em>Lang Type</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for data type '<em>Lang Type</em>'. >- * @see java.lang.String >- * @model instanceClass="java.lang.String" >- * extendedMetaData="name='lang_._1_._type' memberTypes='http://www.eclipse.org/emf/2003/XMLType#language lang_._1_._type_._member_._1'" >- * @generated >- */ >- EDataType getLangType(); >- >- /** >- * Returns the meta object for data type '{@link java.lang.String <em>Lang Type Null</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for data type '<em>Lang Type Null</em>'. >- * @see java.lang.String >- * @model instanceClass="java.lang.String" >- * extendedMetaData="name='lang_._1_._type_._member_._1' baseType='http://www.eclipse.org/emf/2003/XMLType#string' enumeration=''" >- * @generated >- */ >- EDataType getLangTypeNull(); >- >- /** >- * Returns the meta object for data type '{@link org.eclipse.emf.ecore.xml.namespace.SpaceType <em>Space Type Object</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for data type '<em>Space Type Object</em>'. >- * @see org.eclipse.emf.ecore.xml.namespace.SpaceType >- * @model instanceClass="org.eclipse.emf.ecore.xml.namespace.SpaceType" >- * extendedMetaData="name='space_._type:Object' baseType='space_._type'" >- * @generated >- */ >- EDataType getSpaceTypeObject(); >- >- /** >- * Returns the factory that creates the instances of the model. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the factory that creates the instances of the model. >- * @generated >- */ >- XMLNamespaceFactory getXMLNamespaceFactory(); >- >- /** >- * <!-- begin-user-doc --> >- * Defines literals for the meta objects that represent >- * <ul> >- * <li>each class,</li> >- * <li>each feature of each class,</li> >- * <li>each enum,</li> >- * <li>and each data type</li> >- * </ul> >- * <!-- end-user-doc --> >- * @generated >- */ >- interface Literals >- { >- /** >- * The meta object literal for the '{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl <em>Document Root</em>}' class. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespacePackageImpl#getXMLNamespaceDocumentRoot() >- * @generated >- */ >- EClass XML_NAMESPACE_DOCUMENT_ROOT = eINSTANCE.getXMLNamespaceDocumentRoot(); >- >- /** >- * The meta object literal for the '<em><b>Mixed</b></em>' attribute list feature. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- EAttribute XML_NAMESPACE_DOCUMENT_ROOT__MIXED = eINSTANCE.getXMLNamespaceDocumentRoot_Mixed(); >- >- /** >- * The meta object literal for the '<em><b>XMLNS Prefix Map</b></em>' map feature. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- EReference XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP = eINSTANCE.getXMLNamespaceDocumentRoot_XMLNSPrefixMap(); >- >- /** >- * The meta object literal for the '<em><b>XSI Schema Location</b></em>' map feature. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- EReference XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = eINSTANCE.getXMLNamespaceDocumentRoot_XSISchemaLocation(); >- >- /** >- * The meta object literal for the '<em><b>Base</b></em>' attribute feature. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- EAttribute XML_NAMESPACE_DOCUMENT_ROOT__BASE = eINSTANCE.getXMLNamespaceDocumentRoot_Base(); >- >- /** >- * The meta object literal for the '<em><b>Id</b></em>' attribute feature. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- EAttribute XML_NAMESPACE_DOCUMENT_ROOT__ID = eINSTANCE.getXMLNamespaceDocumentRoot_Id(); >- >- /** >- * The meta object literal for the '<em><b>Lang</b></em>' attribute feature. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- EAttribute XML_NAMESPACE_DOCUMENT_ROOT__LANG = eINSTANCE.getXMLNamespaceDocumentRoot_Lang(); >- >- /** >- * The meta object literal for the '<em><b>Space</b></em>' attribute feature. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @generated >- */ >- EAttribute XML_NAMESPACE_DOCUMENT_ROOT__SPACE = eINSTANCE.getXMLNamespaceDocumentRoot_Space(); >- >- /** >- * The meta object literal for the '{@link org.eclipse.emf.ecore.xml.namespace.SpaceType <em>Space Type</em>}' enum. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.namespace.SpaceType >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespacePackageImpl#getSpaceType() >- * @generated >- */ >- EEnum SPACE_TYPE = eINSTANCE.getSpaceType(); >- >- /** >- * The meta object literal for the '<em>Lang Type</em>' data type. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see java.lang.String >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespacePackageImpl#getLangType() >- * @generated >- */ >- EDataType LANG_TYPE = eINSTANCE.getLangType(); >- >- /** >- * The meta object literal for the '<em>Lang Type Null</em>' data type. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see java.lang.String >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespacePackageImpl#getLangTypeNull() >- * @generated >- */ >- EDataType LANG_TYPE_NULL = eINSTANCE.getLangTypeNull(); >- >- /** >- * The meta object literal for the '<em>Space Type Object</em>' data type. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see org.eclipse.emf.ecore.xml.namespace.SpaceType >- * @see org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespacePackageImpl#getSpaceTypeObject() >- * @generated >- */ >- EDataType SPACE_TYPE_OBJECT = eINSTANCE.getSpaceTypeObject(); >- >- } >- >-} //XMLNamespacePackage >Index: src/org/eclipse/emf/ecore/EcorePackage.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/EcorePackage.java,v >retrieving revision 1.9.2.1 >diff -u -r1.9.2.1 EcorePackage.java >--- src/org/eclipse/emf/ecore/EcorePackage.java 9 Jan 2007 06:09:51 -0000 1.9.2.1 >+++ src/org/eclipse/emf/ecore/EcorePackage.java 16 Nov 2007 07:20:50 -0000 >@@ -1816,26 +1816,26 @@ > * @ordered > */ > int ESTRING_TO_STRING_MAP_ENTRY_FEATURE_COUNT = 2; >- >- /** >- * The meta object id for the '<em>EBig Decimal</em>' data type. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see java.math.BigDecimal >- * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEBigDecimal() >- * @generated >- */ >- int EBIG_DECIMAL = 18; >- >- /** >- * The meta object id for the '<em>EBig Integer</em>' data type. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see java.math.BigInteger >- * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEBigInteger() >- * @generated >- */ >- int EBIG_INTEGER = 19; >+//XXX GWT CHANGE No Big-Values >+// /** >+// * The meta object id for the '<em>EBig Decimal</em>' data type. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @see java.math.BigDecimal >+// * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEBigDecimal() >+// * @generated >+// */ >+// int EBIG_DECIMAL = 18; >+// >+// /** >+// * The meta object id for the '<em>EBig Integer</em>' data type. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @see java.math.BigInteger >+// * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEBigInteger() >+// * @generated >+// */ >+// int EBIG_INTEGER = 19; > > /** > * The meta object id for the '<em>EE List</em>' data type. >@@ -3069,30 +3069,30 @@ > * @generated > */ > EAttribute getEStringToStringMapEntry_Value(); >- >- /** >- * Returns the meta object for data type '{@link java.math.BigDecimal <em>EBig Decimal</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for data type '<em>EBig Decimal</em>'. >- * @see java.math.BigDecimal >- * @model instanceClass="java.math.BigDecimal" >- * extendedMetaData="baseType='http://www.w3.org/2001/XMLSchema#decimal'" >- * @generated >- */ >- EDataType getEBigDecimal(); >- >- /** >- * Returns the meta object for data type '{@link java.math.BigInteger <em>EBig Integer</em>}'. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @return the meta object for data type '<em>EBig Integer</em>'. >- * @see java.math.BigInteger >- * @model instanceClass="java.math.BigInteger" >- * extendedMetaData="baseType='http://www.w3.org/2001/XMLSchema#integer'" >- * @generated >- */ >- EDataType getEBigInteger(); >+//XXX GWT CHANGE No Big-Values >+// /** >+// * Returns the meta object for data type '{@link java.math.BigDecimal <em>EBig Decimal</em>}'. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @return the meta object for data type '<em>EBig Decimal</em>'. >+// * @see java.math.BigDecimal >+// * @model instanceClass="java.math.BigDecimal" >+// * extendedMetaData="baseType='http://www.w3.org/2001/XMLSchema#decimal'" >+// * @generated >+// */ >+// EDataType getEBigDecimal(); >+// >+// /** >+// * Returns the meta object for data type '{@link java.math.BigInteger <em>EBig Integer</em>}'. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @return the meta object for data type '<em>EBig Integer</em>'. >+// * @see java.math.BigInteger >+// * @model instanceClass="java.math.BigInteger" >+// * extendedMetaData="baseType='http://www.w3.org/2001/XMLSchema#integer'" >+// * @generated >+// */ >+// EDataType getEBigInteger(); > > /** > * Returns the meta object for data type '{@link org.eclipse.emf.common.util.EList <em>EE List</em>}'. >@@ -4162,26 +4162,26 @@ > * @generated > */ > EAttribute ESTRING_TO_STRING_MAP_ENTRY__VALUE = eINSTANCE.getEStringToStringMapEntry_Value(); >- >- /** >- * The meta object literal for the '<em>EBig Decimal</em>' data type. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see java.math.BigDecimal >- * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEBigDecimal() >- * @generated >- */ >- EDataType EBIG_DECIMAL = eINSTANCE.getEBigDecimal(); >- >- /** >- * The meta object literal for the '<em>EBig Integer</em>' data type. >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * @see java.math.BigInteger >- * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEBigInteger() >- * @generated >- */ >- EDataType EBIG_INTEGER = eINSTANCE.getEBigInteger(); >+//XXX GWT CHANGE No Big-Values >+// /** >+// * The meta object literal for the '<em>EBig Decimal</em>' data type. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @see java.math.BigDecimal >+// * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEBigDecimal() >+// * @generated >+// */ >+// EDataType EBIG_DECIMAL = eINSTANCE.getEBigDecimal(); >+// >+// /** >+// * The meta object literal for the '<em>EBig Integer</em>' data type. >+// * <!-- begin-user-doc --> >+// * <!-- end-user-doc --> >+// * @see java.math.BigInteger >+// * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEBigInteger() >+// * @generated >+// */ >+// EDataType EBIG_INTEGER = eINSTANCE.getEBigInteger(); > > /** > * The meta object literal for the '<em>EBoolean</em>' data type. >Index: .classpath >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/.classpath,v >retrieving revision 1.1 >diff -u -r1.1 .classpath >--- .classpath 6 Mar 2004 17:31:31 -0000 1.1 >+++ .classpath 16 Nov 2007 07:20:49 -0000 >@@ -1,7 +1,9 @@ > <?xml version="1.0" encoding="UTF-8"?> > <classpath> >- <classpathentry kind="src" path="src/"/> >- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> >- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> >- <classpathentry kind="output" path="bin"/> >+ <classpathentry kind="src" path="src"/> >+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> >+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> >+ <classpathentry kind="lib" path="/org.eclipse.equinox.common.gwt/dist/org.eclipse.equinox.common.jar"/> >+ <classpathentry kind="lib" path="libs/gwt-widgets-0.1.5.jar"/> >+ <classpathentry kind="output" path="bin"/> > </classpath> >Index: src/org/eclipse/emf/ecore/EMFEcoreLib.gwt.xml >=================================================================== >RCS file: src/org/eclipse/emf/ecore/EMFEcoreLib.gwt.xml >diff -N src/org/eclipse/emf/ecore/EMFEcoreLib.gwt.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/ecore/EMFEcoreLib.gwt.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,8 @@ >+<module> >+ <!-- Inherit the core Web Toolkit stuff. --> >+ <inherits name='com.google.gwt.user.User'/> >+ <inherits name='org.eclipse.core.RuntimeCoreLib' /> >+ <inherits name='org.eclipse.emf.EMFCommonLib' /> >+ >+ <source path="ecore" /> >+</module>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 209435
:
82686
|
82692
|
83042
|
83043
|
83203
|
83204
|
92951
|
92953