Package org.openstreetmap.josm.data.gpx
Class GpxExtensionCollection
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<GpxExtension>,Collection<GpxExtension>,List<GpxExtension>,RandomAccess
Class extending
ArrayList<GpxExtension>.
Can be used to collect GpxExtensions while reading GPX files, see GpxReader- Since:
- 15496
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stack<GpxExtension>private IWithAttributesprivate static final longFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newGpxExtensionCollectionConstructs a newGpxExtensionCollectionwith the given parent -
Method Summary
Modifier and TypeMethodDescriptionCreates and adds a newGpxExtensionfrom the given parameters.Creates and adds a newGpxExtensionfrom the given parameters.booleanadd(GpxExtension gpx) booleanaddAll(Collection<? extends GpxExtension> extensions) voidAdds an extension from a flat chain without prefix, e.g.addIfNotPresent(String prefix, String key) Creates and adds a newGpxExtension, if it hasn't been added yet.addOrUpdate(String prefix, String key, String value) Creates and adds a newGpxExtensionor updates its value and shows it if already present.voidclear()voidcloseChild(String qName, 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.Searches recursively for the extension with the given prefix and key in all childrenvoidfindAndRemove(String prefix, String key) Searches and removes recursively all extensions with the given prefix and key in all childrenGets the extension with the given prefix and keyGets all extensions with the given prefix and keyGets all prefixes of direct (writable) childrenbooleanDetermines if this collection contains writable extensions.voidopenChild(String namespaceURI, String qName, Attributes atts) Adds a child extension to the last extension and pushes it to the stack.voidRemoves allGpxExtensions with the given prefix and key in direct childrenvoidremoveAllWithPrefix(String prefix) Removes all extensions with the given prefix in direct childrenGets a stream with all extensions with the given prefix and keyMethods 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, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Field Details
-
serialVersionUID
- See Also:
-
childStack
-
parent
-
-
Constructor Details
-
GpxExtensionCollection
public GpxExtensionCollection()Constructs a newGpxExtensionCollection -
GpxExtensionCollection
Constructs a newGpxExtensionCollectionwith the given parent- Parameters:
parent- the parent extendingIWithAttributes
-
-
Method Details
-
openChild
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 prefixatts- the attributes
-
closeChild
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 namevalue- the value
-
add
- Specified by:
addin interfaceCollection<GpxExtension>- Specified by:
addin interfaceList<GpxExtension>- Overrides:
addin classArrayList<GpxExtension>
-
add
Creates and adds a newGpxExtensionfrom the given parameters.- Parameters:
prefix- the prefixkey- the key/tag- Returns:
- the added GpxExtension
-
add
Creates and adds a newGpxExtensionfrom the given parameters.- Parameters:
prefix- the prefixkey- the key/tagvalue- the value, can benull- Returns:
- the added GpxExtension
-
addIfNotPresent
Creates and adds a newGpxExtension, if it hasn't been added yet. Shows it if it has.- Parameters:
prefix- the prefixkey- the key/tag- Returns:
- the added or found GpxExtension
- See Also:
-
addOrUpdate
Creates and adds a newGpxExtensionor updates its value and shows it if already present.- Parameters:
prefix- the prefixkey- the key/tagvalue- the value- Returns:
- the added or found GpxExtension
- See Also:
-
addAll
- Specified by:
addAllin interfaceCollection<GpxExtension>- Specified by:
addAllin interfaceList<GpxExtension>- Overrides:
addAllin classArrayList<GpxExtension>
-
addFlat
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
Gets the extension with the given prefix and key- Parameters:
prefix- the prefixkey- the key/tag- Returns:
- the
GpxExtensionif found ornull
-
getAll
Gets all extensions with the given prefix and key- Parameters:
prefix- the prefixkey- the key/tag- Returns:
- a
GpxExtensionCollectionwith the extensions, empty collection if none found
-
stream
Gets a stream with all extensions with the given prefix and key- Parameters:
prefix- the prefixkey- the key/tag- Returns:
- the
Stream<GpxExtension>
-
find
Searches recursively for the extension with the given prefix and key in all children- Parameters:
prefix- the prefix to look forkey- the key to look for- Returns:
- the extension if found, otherwise
null
-
findAndRemove
Searches and removes recursively all extensions with the given prefix and key in all children- Parameters:
prefix- the prefix to look forkey- the key to look for
-
remove
Removes allGpxExtensions with the given prefix and key in direct children- Parameters:
prefix- the prefixkey- the key/tag
-
removeAllWithPrefix
Removes all extensions with the given prefix in direct children- Parameters:
prefix- the prefix
-
getPrefixesStream
Gets all prefixes of direct (writable) children- Returns:
- stream with the prefixes
-
isVisible
Determines if this collection contains writable extensions.- Returns:
trueif this collection contains writable extensions
-
clear
- Specified by:
clearin interfaceCollection<GpxExtension>- Specified by:
clearin interfaceList<GpxExtension>- Overrides:
clearin classArrayList<GpxExtension>
-