org.gvsig.tools.dynobject.impl
Class MultiDynObjectSet

java.lang.Object
  extended by org.gvsig.tools.dynobject.impl.MultiDynObjectSet
All Implemented Interfaces:
Disposable, DynObjectSet, Observable, IndexedVisitable, Visitable

public class MultiDynObjectSet
extends Object
implements DynObjectSet

Façade for a list of DynObjectSets as if they were an only contiguous set of DynObjects.

Version:
$Id$
Author:
gvSIG Team

Nested Class Summary
static class MultiDynObjectSet.MultiDynObjectSetDisposableIterator
           
 
Nested classes/interfaces inherited from interface org.gvsig.tools.dynobject.DynObjectSet
DynObjectSet.Notification
 
Constructor Summary
MultiDynObjectSet(DynObjectSet[] innerSets)
          Creates a new MultiDynObjectSet with the list of DynObjectSets to façade.
 
Method Summary
 void accept(Visitor visitor)
          Provides each value of this container to the provided Visitor.
 void accept(Visitor visitor, long firstValueIndex)
          Provides each value of this container to the provided Visitor, beginning from the provided index position.
 void addObserver(Observer o)
           
 void delete(DynObject dynObject)
          Deletes a DynObject from this set.
 void deleteObserver(Observer o)
           
 void deleteObservers()
           
 void dispose()
          Disposes the current object, to allow it to close and dispose any used resources.
 long getSize()
          Returns the number of DynObject(s) contained in this DynObjectSet.
 boolean isDeleteEnabled()
          Tells if DynObject deletion is enabled into this set.
 boolean isEmpty()
          Indicates whether this DynObjectSet contains zero DynObjects.
 boolean isUpdateEnabled()
          Tells if DynObject updates are enabled into this set.
 DisposableIterator iterator()
          Returns an iterator over the elements in this collection, in the order (if any) defined when the collection was obtained.
 DisposableIterator iterator(long index)
          Returns an iterator over the elements in this collection, in the order (if any) defined when the collection was obtained.
 void update(DynObject dynObject)
          Updates a DynObject from this set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiDynObjectSet

public MultiDynObjectSet(DynObjectSet[] innerSets)
Creates a new MultiDynObjectSet with the list of DynObjectSets to façade.

Method Detail

dispose

public void dispose()
Description copied from interface: Disposable
Disposes the current object, to allow it to close and dispose any used resources.

NOTE:After calling this method, the object may not be usable anymore.

Specified by:
dispose in interface Disposable

accept

public void accept(Visitor visitor,
                   long firstValueIndex)
            throws BaseException
Description copied from interface: IndexedVisitable
Provides each value of this container to the provided Visitor, beginning from the provided index position.

Specified by:
accept in interface IndexedVisitable
Parameters:
visitor - the visitor to apply to each value.
firstValueIndex - index of first element to be visited by the Visitor
Throws:
BaseException - if there is an error while performing the visit

accept

public void accept(Visitor visitor)
            throws BaseException
Description copied from interface: Visitable
Provides each value of this container to the provided Visitor.

Specified by:
accept in interface Visitable
Parameters:
visitor - the visitor to apply to each value.
Throws:
BaseException - if there is an error while performing the visit

getSize

public long getSize()
             throws BaseException
Description copied from interface: DynObjectSet
Returns the number of DynObject(s) contained in this DynObjectSet.

Specified by:
getSize in interface DynObjectSet
Returns:
number of DynObject(s) contained in this DynObjectSet.
Throws:
BaseException

iterator

public DisposableIterator iterator(long index)
                            throws BaseException
Description copied from interface: DynObjectSet
Returns an iterator over the elements in this collection, in the order (if any) defined when the collection was obtained. The iterator starts at the specified position in this collection. The specified index indicates the first element that would be returned by an initial call to the next method. An initial call to the previous method would return the element with the specified index minus one.

NOTE: if you use this method to get the iterator, you must get sure the iterator is disposed (@see Disposable.dispose()) in any case, even if an error occurs while getting the data. It is recommended to use the accept methods instead, which handle everything for you. Take into account the accept methods may use a fast iterator to get the DynObjects.

Specified by:
iterator in interface DynObjectSet
Parameters:
index - index of first element to be returned from the iterator (by a call to the next method).
Returns:
an iterator of the elements in this collection (in proper sequence), starting at the specified position in the collection.
Throws:
BaseException - if the index is out of range (index < 0 || index > size()).
See Also:
Visitable.accept(org.gvsig.tools.visitor.Visitor), IndexedVisitable.accept(org.gvsig.tools.visitor.Visitor, long)

iterator

public DisposableIterator iterator()
                            throws BaseException
Description copied from interface: DynObjectSet
Returns an iterator over the elements in this collection, in the order (if any) defined when the collection was obtained.

NOTE: if you use this method to get the iterator, you must get sure the iterator is disposed (@see Disposable.dispose()) in any case, even if an error occurs while getting the data. It is recommended to use the accept methods instead, which handle everything for you. Take into account the accept methods may use a fast iterator to get the DynObjects.

Specified by:
iterator in interface DynObjectSet
Returns:
an iterator of the elements in this collection (in proper sequence).
Throws:
BaseException
See Also:
Visitable.accept(org.gvsig.tools.visitor.Visitor), IndexedVisitable.accept(org.gvsig.tools.visitor.Visitor, long)

isEmpty

public boolean isEmpty()
                throws BaseException
Description copied from interface: DynObjectSet
Indicates whether this DynObjectSet contains zero DynObjects.

Specified by:
isEmpty in interface DynObjectSet
Returns:
true if this DynObjectSet is empty, false otherwise.
Throws:
BaseException

addObserver

public void addObserver(Observer o)
Specified by:
addObserver in interface Observable

deleteObserver

public void deleteObserver(Observer o)
Specified by:
deleteObserver in interface Observable

deleteObservers

public void deleteObservers()
Specified by:
deleteObservers in interface Observable

isDeleteEnabled

public boolean isDeleteEnabled()
Description copied from interface: DynObjectSet
Tells if DynObject deletion is enabled into this set.

Specified by:
isDeleteEnabled in interface DynObjectSet
Returns:
if DynObject deletion is enabled into this set

delete

public void delete(DynObject dynObject)
            throws BaseException
Description copied from interface: DynObjectSet
Deletes a DynObject from this set. Depending on the inner set implementation that may mean also the data will be removed from a persistent state.

Specified by:
delete in interface DynObjectSet
Parameters:
dynObject - to remove
Throws:
BaseException - if there is an error removing the DynObject

isUpdateEnabled

public boolean isUpdateEnabled()
Description copied from interface: DynObjectSet
Tells if DynObject updates are enabled into this set.

Specified by:
isUpdateEnabled in interface DynObjectSet
Returns:
if DynObject updates are enabled into this set

update

public void update(DynObject dynObject)
            throws BaseException
Description copied from interface: DynObjectSet
Updates a DynObject from this set. Depending on the inner set implementation that may mean also the data will be updated in a persistent state.

Specified by:
update in interface DynObjectSet
Parameters:
dynObject - to update
Throws:
BaseException - if there is an error updating the DynObject


Copyright © 2004-2011 gvSIG. All Rights Reserved.