Class GpxExtensionCollection

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      GpxExtension add​(java.lang.String prefix, java.lang.String key)
      Creates and adds a new GpxExtension from the given parameters.
      GpxExtension add​(java.lang.String prefix, java.lang.String key, java.lang.String value)
      Creates and adds a new GpxExtension from the given parameters.
      boolean add​(GpxExtension gpx)  
      boolean addAll​(java.util.Collection<? extends GpxExtension> extensions)  
      void addFlat​(java.lang.String[] chain, java.lang.String value)
      Adds an extension from a flat chain without prefix, e.g.
      GpxExtension addIfNotPresent​(java.lang.String prefix, java.lang.String key)
      Creates and adds a new GpxExtension, if it hasn't been added yet.
      GpxExtension addOrUpdate​(java.lang.String prefix, java.lang.String key, java.lang.String value)
      Creates and adds a new GpxExtension or updates its value and shows it if already present.
      void clear()  
      void closeChild​(java.lang.String qName, java.lang.String value)
      Sets the value for the last child and pops it from the stack, so the next one will be added to its parent.
      GpxExtension find​(java.lang.String prefix, java.lang.String key)
      Searches recursively for the extension with the given prefix and key in all children
      void findAndRemove​(java.lang.String prefix, java.lang.String key)
      Searches and removes recursively all extensions with the given prefix and key in all children
      GpxExtension get​(java.lang.String prefix, java.lang.String key)
      Gets the extension with the given prefix and key
      GpxExtensionCollection getAll​(java.lang.String prefix, java.lang.String key)
      Gets all extensions with the given prefix and key
      java.util.stream.Stream<java.lang.String> getPrefixesStream()
      Gets all prefixes of direct (writable) children
      boolean isVisible()
      Determines if this collection contains writable extensions.
      void openChild​(java.lang.String namespaceURI, java.lang.String qName, org.xml.sax.Attributes atts)
      Adds a child extension to the last extension and pushes it to the stack.
      void remove​(java.lang.String prefix, java.lang.String key)
      Removes all GpxExtensions with the given prefix and key in direct children
      void removeAllWithPrefix​(java.lang.String prefix)
      Removes all extensions with the given prefix in direct children
      java.util.stream.Stream<GpxExtension> stream​(java.lang.String prefix, java.lang.String key)
      Gets a stream with all extensions with the given prefix and key
      • Methods inherited from class java.util.ArrayList

        add, addAll, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Method Detail

      • openChild

        public void openChild​(java.lang.String namespaceURI,
                              java.lang.String qName,
                              org.xml.sax.Attributes atts)
        Adds a child extension to the last extension and pushes it to the stack.
        Parameters:
        namespaceURI - the URI of the XML namespace, used to determine supported extensions (josm, gpxx, gpxd) regardless of the prefix.
        qName - the qualified name of the XML element including prefix
        atts - the attributes
      • closeChild

        public void closeChild​(java.lang.String qName,
                               java.lang.String value)
        Sets the value for the last child and pops it from the stack, so the next one will be added to its parent. A warning is issued if the qualified name does not equal the currently opened child.
        Parameters:
        qName - the qualified name
        value - the value
      • add

        public GpxExtension add​(java.lang.String prefix,
                                java.lang.String key)
        Creates and adds a new GpxExtension from the given parameters.
        Parameters:
        prefix - the prefix
        key - the key/tag
        Returns:
        the added GpxExtension
      • add

        public GpxExtension add​(java.lang.String prefix,
                                java.lang.String key,
                                java.lang.String value)
        Creates and adds a new GpxExtension from the given parameters.
        Parameters:
        prefix - the prefix
        key - the key/tag
        value - the value, can be null
        Returns:
        the added GpxExtension
      • addIfNotPresent

        public GpxExtension addIfNotPresent​(java.lang.String prefix,
                                            java.lang.String key)
        Creates and adds a new GpxExtension, if it hasn't been added yet. Shows it if it has.
        Parameters:
        prefix - the prefix
        key - the key/tag
        Returns:
        the added or found GpxExtension
        See Also:
        GpxExtension.show()
      • addOrUpdate

        public GpxExtension addOrUpdate​(java.lang.String prefix,
                                        java.lang.String key,
                                        java.lang.String value)
        Creates and adds a new GpxExtension or updates its value and shows it if already present.
        Parameters:
        prefix - the prefix
        key - the key/tag
        value - the value
        Returns:
        the added or found GpxExtension
        See Also:
        GpxExtension.show()
      • addAll

        public boolean addAll​(java.util.Collection<? extends GpxExtension> extensions)
        Specified by:
        addAll in interface java.util.Collection<GpxExtension>
        Specified by:
        addAll in interface java.util.List<GpxExtension>
        Overrides:
        addAll in class java.util.ArrayList<GpxExtension>
      • addFlat

        public void addFlat​(java.lang.String[] chain,
                            java.lang.String value)
        Adds an extension from a flat chain without prefix, e.g. when converting from OSM
        Parameters:
        chain - the full key chain, e.g. ["extension", "gpxx", "TrackExtension", "DisplayColor"]
        value - the value
      • get

        public GpxExtension get​(java.lang.String prefix,
                                java.lang.String key)
        Gets the extension with the given prefix and key
        Parameters:
        prefix - the prefix
        key - the key/tag
        Returns:
        the GpxExtension if found or null
      • getAll

        public GpxExtensionCollection getAll​(java.lang.String prefix,
                                             java.lang.String key)
        Gets all extensions with the given prefix and key
        Parameters:
        prefix - the prefix
        key - the key/tag
        Returns:
        a GpxExtensionCollection with the extensions, empty collection if none found
      • stream

        public java.util.stream.Stream<GpxExtensionstream​(java.lang.String prefix,
                                                            java.lang.String key)
        Gets a stream with all extensions with the given prefix and key
        Parameters:
        prefix - the prefix
        key - the key/tag
        Returns:
        the Stream<GpxExtension>
      • find

        public GpxExtension find​(java.lang.String prefix,
                                 java.lang.String key)
        Searches recursively for the extension with the given prefix and key in all children
        Parameters:
        prefix - the prefix to look for
        key - the key to look for
        Returns:
        the extension if found, otherwise null
      • findAndRemove

        public void findAndRemove​(java.lang.String prefix,
                                  java.lang.String key)
        Searches and removes recursively all extensions with the given prefix and key in all children
        Parameters:
        prefix - the prefix to look for
        key - the key to look for
      • remove

        public void remove​(java.lang.String prefix,
                           java.lang.String key)
        Removes all GpxExtensions with the given prefix and key in direct children
        Parameters:
        prefix - the prefix
        key - the key/tag
      • removeAllWithPrefix

        public void removeAllWithPrefix​(java.lang.String prefix)
        Removes all extensions with the given prefix in direct children
        Parameters:
        prefix - the prefix
      • getPrefixesStream

        public java.util.stream.Stream<java.lang.String> getPrefixesStream()
        Gets all prefixes of direct (writable) children
        Returns:
        stream with the prefixes
      • isVisible

        public boolean isVisible()
        Determines if this collection contains writable extensions.
        Returns:
        true if this collection contains writable extensions
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<GpxExtension>
        Specified by:
        clear in interface java.util.List<GpxExtension>
        Overrides:
        clear in class java.util.ArrayList<GpxExtension>