## org.exist.xmldb
Class MapResourceSet

    java.lang.Object
      org.exist.xmldb.MapResourceSet

All Implemented Interfaces:
  ResourceSet

public class MapResourceSet
extends java.lang.Object
implements ResourceSet

Implementation of ResourceSet (a container of Resource objects), using internally both a Map and a Vector. The Map is keyed by the Id of each resource.

Author:
  Jean-Marc Vanel (2 April 2003)

Constructor Summary
`MapResourceSet()`
`MapResourceSet(java.util.Map resources)` Constructor
`MapResourceSet(ResourceSet rs)` Constructor

Method Summary
`void` `addResource(Resource resource)` Adds a resource to the container
`void` `clear()` Make the container empty
`ResourceIterator` `getIterator()` Gets the iterator property
`ResourceIterator` `getIterator(long start)` Gets the iterator property, starting from a given position
`Resource` `getMembersAsResource()` Gets the membersAsResource property of the object
`Resource` `getResource(long pos)` Gets the resource at a given position.
`java.util.Map` `getResourcesMap()`
`long` `getSize()` Gets the size property
`void` `removeResource(long pos)` Removes the resource at a given position.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.xmldb.api.base.ResourceSet
`addAll, getResource, removeResource`

Constructor Detail

### MapResourceSet

    public MapResourceSet()

### MapResourceSet

    public MapResourceSet(java.util.Map resources)

  Constructor

### MapResourceSet

    public MapResourceSet(ResourceSet rs)
                   throws XMLDBException

  Constructor

Method Detail

### getResourcesMap

    public java.util.Map getResourcesMap()

### addResource

    public void addResource(Resource resource)
                     throws XMLDBException

  Adds a resource to the container

  Specified by:
    `addResource` in interface `ResourceSet`
  Parameters:
    `resource` - The resource to be added to the object
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### clear

    public void clear()
               throws XMLDBException

  Make the container empty

  Specified by:
    `clear` in interface `ResourceSet`
  Throws:
    `XMLDBException`

### getIterator

    public ResourceIterator getIterator()
                                 throws XMLDBException

  Gets the iterator property

  Specified by:
    `getIterator` in interface `ResourceSet`
  Returns:
    The iterator value
  Throws:
    `XMLDBException`

### getIterator

    public ResourceIterator getIterator(long start)
                                 throws XMLDBException

  Gets the iterator property, starting from a given position

  Parameters:
    `start` - starting position>0 for the iterator
  Returns:
    The iterator value
  Throws:
    `XMLDBException` - thrown if pos is out of range

### getMembersAsResource

    public Resource getMembersAsResource()
                                  throws XMLDBException

  Gets the membersAsResource property of the object

  Specified by:
    `getMembersAsResource` in interface `ResourceSet`
  Returns:
    The membersAsResource value
  Throws:
    `XMLDBException` - Description of the Exception

### getResource

    public Resource getResource(long pos)
                         throws XMLDBException

  Gets the resource at a given position.

  Parameters:
    `pos` - position > 0
  Returns:
    The resource value
  Throws:
    `XMLDBException` - thrown if pos is out of range

### getSize

    public long getSize()
                 throws XMLDBException

  Gets the size property

  Specified by:
    `getSize` in interface `ResourceSet`
  Returns:
    The size value
  Throws:
    `XMLDBException`

### removeResource

    public void removeResource(long pos)
                        throws XMLDBException

  Removes the resource at a given position.

  Parameters:
    `pos` - position > 0
  Throws:
    `XMLDBException` - thrown if pos is out of range

Copyright (C) Wolfgang Meier. All rights reserved.