public class GpxExtensionCollection extends java.util.ArrayList<GpxExtension>
ArrayList<GpxExtension>.
Can be used to collect GpxExtensions while reading GPX files, see GpxReader| Modifier and Type | Field and Description |
|---|---|
private java.util.Stack<GpxExtension> |
childStack |
private IWithAttributes |
parent |
private static long |
serialVersionUID |
| Constructor and Description |
|---|
GpxExtensionCollection()
Constructs a new
GpxExtensionCollection |
GpxExtensionCollection(IWithAttributes parent)
Constructs a new
GpxExtensionCollection with the given parent |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(GpxExtension gpx) |
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 |
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() |
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
|
add, addAll, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeprivate static final long serialVersionUID
private java.util.Stack<GpxExtension> childStack
private IWithAttributes parent
public GpxExtensionCollection()
GpxExtensionCollectionpublic GpxExtensionCollection(IWithAttributes parent)
GpxExtensionCollection with the given parentparent - the parent extending IWithAttributespublic void openChild(java.lang.String namespaceURI, java.lang.String qName, org.xml.sax.Attributes atts)
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 attributespublic void closeChild(java.lang.String qName, java.lang.String value)
qName - the qualified namevalue - the valuepublic boolean add(GpxExtension gpx)
add in interface java.util.Collection<GpxExtension>add in interface java.util.List<GpxExtension>add in class java.util.ArrayList<GpxExtension>public GpxExtension add(java.lang.String prefix, java.lang.String key)
GpxExtension from the given parameters.prefix - the prefixkey - the key/tagpublic GpxExtension add(java.lang.String prefix, java.lang.String key, java.lang.String value)
GpxExtension from the given parameters.prefix - the prefixkey - the key/tagvalue - the value, can be nullpublic GpxExtension addIfNotPresent(java.lang.String prefix, java.lang.String key)
GpxExtension, if it hasn't been added yet. Shows it if it has.prefix - the prefixkey - the key/tagGpxExtension.show()public GpxExtension addOrUpdate(java.lang.String prefix, java.lang.String key, java.lang.String value)
GpxExtension or updates its value and shows it if already present.prefix - the prefixkey - the key/tagvalue - the valueGpxExtension.show()public boolean addAll(java.util.Collection<? extends GpxExtension> extensions)
addAll in interface java.util.Collection<GpxExtension>addAll in interface java.util.List<GpxExtension>addAll in class java.util.ArrayList<GpxExtension>public void addFlat(java.lang.String[] chain, java.lang.String value)
chain - the full key chain, e.g. ["extension", "gpxx", "TrackExtension", "DisplayColor"]value - the valuepublic GpxExtension get(java.lang.String prefix, java.lang.String key)
prefix - the prefixkey - the key/tagGpxExtension if found or nullpublic GpxExtensionCollection getAll(java.lang.String prefix, java.lang.String key)
prefix - the prefixkey - the key/tagGpxExtensionCollection with the extensions, empty collection if none foundpublic java.util.stream.Stream<GpxExtension> stream(java.lang.String prefix, java.lang.String key)
prefix - the prefixkey - the key/tagStream<GpxExtension>public GpxExtension find(java.lang.String prefix, java.lang.String key)
prefix - the prefix to look forkey - the key to look fornullpublic void findAndRemove(java.lang.String prefix, java.lang.String key)
prefix - the prefix to look forkey - the key to look forpublic void remove(java.lang.String prefix, java.lang.String key)
GpxExtensions with the given prefix and key in direct childrenprefix - the prefixkey - the key/tagpublic void removeAllWithPrefix(java.lang.String prefix)
prefix - the prefixpublic java.util.stream.Stream<java.lang.String> getPrefixesStream()
public boolean isVisible()
true if this collection contains writable extensionspublic void clear()
clear in interface java.util.Collection<GpxExtension>clear in interface java.util.List<GpxExtension>clear in class java.util.ArrayList<GpxExtension>