Class ConverterCollections.ConverterCollection<F,​T>

    • Field Detail

      • m_col

        protected Collection<F> m_col
        The underlying Collection.
      • m_convUp

        protected Converter<F,​T> m_convUp
        The Converter from the underlying Collection to this Collection.
      • m_convDown

        protected Converter<T,​F> m_convDown
        The Converter from this Collection to the underlying Collection.
    • Constructor Detail

      • ConverterCollection

        public ConverterCollection​(Collection<F> col,
                                   Converter<F,​T> convUp,
                                   Converter<T,​F> convDown)
        Constructor.
        Parameters:
        col - the underlying Collection
        convUp - the Converter from the underlying Collection
        convDown - the Converter to the underlying Collection
    • Method Detail

      • toArray

        public <E> E[] toArray​(E[] aoDest)
        Specified by:
        toArray in interface Collection<F>
      • add

        public boolean add​(T o)
        Specified by:
        add in interface Collection<F>
      • equals

        public boolean equals​(Object o)
        Compares the specified object with this collection for equality.

        Obeys the general contract of Collection.equals.

        Specified by:
        equals in interface Collection<F>
        Overrides:
        equals in class Object
        Parameters:
        o - Object to be compared for equality with this Collection
        Returns:
        true if the specified object is equal to this Collection
      • toString

        public String toString()
        Return a String description for this collection.
        Overrides:
        toString in class Object
        Returns:
        a String description of the Collection
      • invalidate

        public void invalidate()
        Drop references to the underlying Collection and the Converters.
      • instantiateCollection

        protected <T,​F> Collection<T> instantiateCollection​(Collection<F> col,
                                                                  Converter<F,​T> convUp,
                                                                  Converter<T,​F> convDown)
        Create a Converter Collection.
        Type Parameters:
        F - the type of elements in the underlying Collection
        T - the type that the elements should be converted to
        Parameters:
        col - the underlying Collection
        convUp - the Converter to view the underlying Collection through
        convDown - the Converter to pass items down to the underlying Collection through
        Returns:
        a Converter Collection
      • instantiateIterator

        protected Iterator<T> instantiateIterator​(Iterator<F> iter,
                                                  Converter<F,​T> conv)
        Create a Converter Iterator.
        Parameters:
        iter - the underlying Iterator
        conv - the Converter to view the underlying Iterator through
        Returns:
        a Converter Iterator
      • getCollection

        public Collection<F> getCollection()
        Return the underlying Collection.
        Returns:
        the underlying Collection
      • getConverterUp

        public Converter<F,​T> getConverterUp()
        Return the Converter used to view the underlying Collection's values through.
        Returns:
        the Converter from the underlying Collection
      • getConverterDown

        public Converter<T,​F> getConverterDown()
        Return the Converter used to pass values down to the underlying Collection.
        Returns:
        the Converter to the underlying Collection