Class IterableRemoteCollection<T>

  • Type Parameters:
    T - the type of elements in this collection
    All Implemented Interfaces:
    RemoteCollection<T>, TptRemote, RemoteIterable<T>, java.io.Serializable, java.lang.Iterable<T>, java.rmi.Remote
    Direct Known Subclasses:
    IterableRemoteList

    public class IterableRemoteCollection<T>
    extends java.lang.Object
    implements RemoteCollection<T>, java.lang.Iterable<T>, java.io.Serializable
    A wrapper obejct to provide iterable functionallity for a RemoteCollection. Since all methods of a Remote interface must throw a RemoteException we cannot implement Iterable directly.
    This wrapper has the same interface as a RemoteCollection and additionally implements the Iterable interface. Since the methods of the latter do not throw RemoteException this Object cannot be exported as a RemoteObject.
    Author:
    Copyright (c) 2014-2024 Piketec GmbH - MIT License (MIT) - All rights reserved
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      IterableRemoteCollection<T> asIterable()
      Provides an Iterable view of this RemoteIterable.
      void clear()
      Remove all elements from this collection.
      boolean contains​(T o)
      Returns truee if this collection contains the specified element.
      boolean containsAll​(java.util.Collection<? extends T> c)
      Returns true if this collection contains all the elements in the given collection.
      void delete​(T element)
      Delete an element from the list.
      boolean deleteAll​(java.util.Collection<?> c)
      Removes all of this collection's elements that are contained in the given collection.
      java.util.Collection<T> getItems()
      Returns all items of this RemoteCollection.
      boolean isEmpty()
      Returns true if this collection contains no elements.
      java.util.Iterator<T> iterator()  
      RemoteIterator<T> remoteIterator()
      Provides a remote iterator that has the same interface as Iterator but every method can throw a RemoteException as required by Java RMI.
      boolean retainAll​(java.util.Collection<?> c)
      Removes all of this collection's elements that are not contained in the specified collection.
      int size()
      Returns the number of elements in this collection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • IterableRemoteCollection

        public IterableRemoteCollection​(RemoteCollection<T> delegate)
        An iterable view on a RemoteCollection. Most likely not needed by API users.
        Parameters:
        delegate - The remote list for which an iterable view is needed.
        See Also:
        RemoteCollection.asIterable()
    • Method Detail

      • remoteIterator

        public RemoteIterator<T> remoteIterator()
                                         throws java.rmi.RemoteException
        Description copied from interface: RemoteIterable
        Provides a remote iterator that has the same interface as Iterator but every method can throw a RemoteException as required by Java RMI. This method is most likely not relevant for API users but needed for RemoteIterable.asIterable().
        Specified by:
        remoteIterator in interface RemoteIterable<T>
        Returns:
        a remote iterator
        Throws:
        java.rmi.RemoteException - remote communication problem
        See Also:
        RemoteIterable.asIterable()
      • delete

        public void delete​(T element)
                    throws ApiException,
                           java.rmi.RemoteException
        Description copied from interface: RemoteCollection
        Delete an element from the list. This function directly deletes the corresponding element in TPT.

        If multiple RemoteCollections refer to the same collection in TPT, the TPT object will be deleted from the collection as soon as this method is called with any of those and the change is reflected in all of them.

        Specified by:
        delete in interface RemoteCollection<T>
        Parameters:
        element - The element to remove.
        Throws:
        java.rmi.RemoteException - remote communication problem
        ApiException
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>
      • size

        public int size()
                 throws java.rmi.RemoteException
        Description copied from interface: RemoteCollection
        Returns the number of elements in this collection.
        Specified by:
        size in interface RemoteCollection<T>
        Returns:
        the number of elements in this collection
        Throws:
        java.rmi.RemoteException - remote communication problem
      • isEmpty

        public boolean isEmpty()
                        throws java.rmi.RemoteException
        Description copied from interface: RemoteCollection
        Returns true if this collection contains no elements.
        Specified by:
        isEmpty in interface RemoteCollection<T>
        Returns:
        true if this collection contains no elements
        Throws:
        java.rmi.RemoteException - remote communication problem
      • contains

        public boolean contains​(T o)
                         throws java.rmi.RemoteException
        Description copied from interface: RemoteCollection
        Returns truee if this collection contains the specified element.
        Specified by:
        contains in interface RemoteCollection<T>
        Parameters:
        o - element whose presence in this collection is to be tested
        Returns:
        truee if this collection contains the specified element
        Throws:
        java.rmi.RemoteException - remote communication problem
      • containsAll

        public boolean containsAll​(java.util.Collection<? extends T> c)
                            throws java.rmi.RemoteException
        Description copied from interface: RemoteCollection
        Returns true if this collection contains all the elements in the given collection.
        Specified by:
        containsAll in interface RemoteCollection<T>
        Parameters:
        c - collection of elements whose presence in this collection is to be tested
        Returns:
        truee if this collection contains all the specified elements
        Throws:
        java.rmi.RemoteException - remote communication problem
      • deleteAll

        public boolean deleteAll​(java.util.Collection<?> c)
                          throws java.rmi.RemoteException
        Description copied from interface: RemoteCollection
        Removes all of this collection's elements that are contained in the given collection.
        Specified by:
        deleteAll in interface RemoteCollection<T>
        Parameters:
        c - collection containing elements to be removed from this collection
        Returns:
        true if this collection was changed as a result of the call
        Throws:
        java.rmi.RemoteException - remote communication problem
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
                          throws java.rmi.RemoteException
        Description copied from interface: RemoteCollection
        Removes all of this collection's elements that are not contained in the specified collection.
        Specified by:
        retainAll in interface RemoteCollection<T>
        Parameters:
        c - collection containing elements to be retained in this collection
        Returns:
        true if this collection was changed as a result of the call
        Throws:
        java.rmi.RemoteException - remote communication problem
      • clear

        public void clear()
                   throws java.rmi.RemoteException
        Description copied from interface: RemoteCollection
        Remove all elements from this collection.
        Specified by:
        clear in interface RemoteCollection<T>
        Throws:
        java.rmi.RemoteException - remote communication problem