org.eclipse.emf.ecore.resource.impl
Class URIMappingRegistryImpl

java.lang.Object
  extended by org.eclipse.emf.common.util.BasicEMap<URI,URI>
      extended by org.eclipse.emf.ecore.resource.impl.URIMappingRegistryImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.util.Map.Entry<URI,URI>>, java.util.Collection<java.util.Map.Entry<URI,URI>>, java.util.List<java.util.Map.Entry<URI,URI>>, EList<java.util.Map.Entry<URI,URI>>, EMap<URI,URI>

public class URIMappingRegistryImpl
extends BasicEMap<URI,URI>

An extensible implementation of a URI mapping registry.

See Also:
Serialized Form

Nested Class Summary
protected  class URIMappingRegistryImpl.MappingEntryImpl
          An extended implementation that maintains a bit indicating if the entry represents a folder to folder mapping.
protected  class URIMappingRegistryImpl.URIMapImpl
          A map that is a ExtensibleURIConverterImpl.URIMap.
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.util.BasicEMap
BasicEMap.BasicEMapIterator<U>, BasicEMap.BasicEMapKeyIterator, BasicEMap.BasicEMapValueIterator, BasicEMap.DelegatingMap, BasicEMap.Entry<K,V>, BasicEMap.EntryImpl, BasicEMap.View<K,V>
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.util.EMap
EMap.InternalMapView<K,V>
 
Field Summary
static URIMappingRegistryImpl INSTANCE
          The implementation of the global mapping registry.
protected  BasicEList<java.util.List<BasicEMap.Entry<URI,URI>>> prefixMaps
          A list of lists of prefix URIs; it is indexed by segment count to yield a list of prefixes of that length.
 
Fields inherited from class org.eclipse.emf.common.util.BasicEMap
delegateEList, entryData, modCount, size, view
 
Constructor Summary
URIMappingRegistryImpl()
          Creates an instance.
 
Method Summary
protected  URI delegatedGetURI(URI uri)
          Returns the mapped URI for the given URI, when standard alternatives fail.
protected  void didAdd(BasicEMap.Entry<URI,URI> entry)
          Checks for folder mappings to populate the prefix maps.
protected  void didClear(BasicEList<BasicEMap.Entry<URI,URI>>[] oldEntryData)
          Discards all the prefix maps.
protected  void didModify(BasicEMap.Entry<URI,URI> entry, URI oldValue)
          Checks for folder mappings to update the prefix maps.
protected  void didRemove(BasicEMap.Entry<URI,URI> entry)
          Checks for folder mappings to cleanup the prefix maps.
 URI getURI(URI uri)
          Returns the remapped URI, or the URI itself.
 java.util.Map<URI,URI> map()
          Returns a map view that implements ExtensibleURIConverterImpl.URIMap.
protected  BasicEMap.Entry<URI,URI> newEntry(int hash, URI key, URI value)
          Creates an URIMappingRegistryImpl.MappingEntryImpl.
protected  void validateKey(URI key)
          Validates that the key is a URI.
protected  void validateValue(URI value)
          Validates that the value is a URI.
 
Methods inherited from class org.eclipse.emf.common.util.BasicEMap
add, add, addAll, addAll, clear, clone, contains, containsAll, containsKey, containsValue, doClear, doMove, doPut, doRemove, ensureEntryDataExists, entryForKey, entryIndexForKey, entrySet, equals, get, get, grow, hashCode, hashOf, indexOf, indexOf, indexOfKey, initializeDelegateEList, isEmpty, iterator, keySet, lastIndexOf, listIterator, listIterator, move, move, newEntryData, newList, put, putAll, putAll, putEntry, remove, remove, removeAll, removeEntry, removeKey, resolve, retainAll, set, size, subList, toArray, toArray, toString, useEqualsForKey, useEqualsForValue, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INSTANCE

public static final URIMappingRegistryImpl INSTANCE
The implementation of the global mapping registry.

See Also:
URIConverter.URI_MAP

prefixMaps

protected BasicEList<java.util.List<BasicEMap.Entry<URI,URI>>> prefixMaps
A list of lists of prefix URIs; it is indexed by segment count to yield a list of prefixes of that length.

Constructor Detail

URIMappingRegistryImpl

public URIMappingRegistryImpl()
Creates an instance.

Method Detail

newEntry

protected BasicEMap.Entry<URI,URI> newEntry(int hash,
                                            URI key,
                                            URI value)
Creates an URIMappingRegistryImpl.MappingEntryImpl.

Overrides:
newEntry in class BasicEMap<URI,URI>
Parameters:
hash - the cached hash code of the key.
key - the key.
value - the value.
Returns:
a new entry.
See Also:
BasicEMap.newList()

getURI

public URI getURI(URI uri)
Returns the remapped URI, or the URI itself. This implementation uses the map to find an exact match. Failing that, it matches the prefixMaps prefixes in order. And failing that, it delegates to delegatedGetURI.

Parameters:
uri - the URI to remap.
Returns:
the remapped URI, or the URI itself.

delegatedGetURI

protected URI delegatedGetURI(URI uri)
Returns the mapped URI for the given URI, when standard alternatives fail.

This implementation returns uri.

Parameters:
uri - the URI.
Returns:
the mapped URI.
See Also:
getURI(URI)

map

public java.util.Map<URI,URI> map()
Returns a map view that implements ExtensibleURIConverterImpl.URIMap.

Specified by:
map in interface EMap<URI,URI>
Overrides:
map in class BasicEMap<URI,URI>
Returns:
a map view.

validateKey

protected void validateKey(URI key)
Validates that the key is a URI.

Overrides:
validateKey in class BasicEMap<URI,URI>
Parameters:
key - the new key.

validateValue

protected void validateValue(URI value)
Validates that the value is a URI.

Overrides:
validateValue in class BasicEMap<URI,URI>
Parameters:
value - the new value.

didAdd

protected void didAdd(BasicEMap.Entry<URI,URI> entry)
Checks for folder mappings to populate the prefix maps.

Overrides:
didAdd in class BasicEMap<URI,URI>
Parameters:
entry - the added entry.

didModify

protected void didModify(BasicEMap.Entry<URI,URI> entry,
                         URI oldValue)
Checks for folder mappings to update the prefix maps.

Overrides:
didModify in class BasicEMap<URI,URI>
Parameters:
entry - the new entry.

didRemove

protected void didRemove(BasicEMap.Entry<URI,URI> entry)
Checks for folder mappings to cleanup the prefix maps.

Overrides:
didRemove in class BasicEMap<URI,URI>
Parameters:
entry - the removed entry.

didClear

protected void didClear(BasicEList<BasicEMap.Entry<URI,URI>>[] oldEntryData)
Discards all the prefix maps.

Overrides:
didClear in class BasicEMap<URI,URI>
Parameters:
oldEntryData - the removed entries.

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.