/** * Returns the next key part of this configuration key. The boolean * parameter indicates wheter a decorated key should be returned. This * affects only attribute keys: if the parameter is <b>false</b>, the * attribute markers are stripped from the key; if it is <b>true</b>, * they remain. * * @param decorated a flag if the decorated key is to be returned * @return the next key part */ public String nextKey(boolean decorated) { if (!hasNext()) { throw new NoSuchElementException("No more key parts!"); } hasIndex = false; indexValue = -1; String key = findNextIndices(); current = key; hasIndex = checkIndex(key); attribute = checkAttribute(current); return currentKey(decorated); }
int escapeOffset = escapeOffset(); if (escapeOffset < 0 || escapeOffset > pos)
if (!it.hasNext()) result.setParent(findLastPathNode(it, root)); while (it.hasNext()) if (!it.isPropertyKey()) + " (Attribute key in the middle.)"); result.addPathNode(it.currentKey()); it.next(); result.setNewNodeName(it.currentKey()); result.setAttribute(!it.isPropertyKey()); return result;
if (!it.hasNext()) result.setParent(findLastPathNode(it, root)); while (it.hasNext()) if (!it.isPropertyKey()) + " (Attribute key in the middle.)"); result.addPathNode(it.currentKey()); it.next(); result.setNewNodeName(it.currentKey()); result.setAttribute(!it.isPropertyKey()); return result;
DefaultConfigurationKey.KeyIterator keyIt, ConfigurationNode node) String keyPart = keyIt.nextKey(false); if (keyIt.hasNext()) if (!keyIt.isPropertyKey()) + "Attribute key in the middle!"); int idx = keyIt.hasIndex() ? keyIt.getIndex() : node .getChildrenCount(keyPart) - 1; if (idx < 0 || idx >= node.getChildrenCount(keyPart))
DefaultConfigurationKey.KeyIterator keyIt, ConfigurationNode node) String keyPart = keyIt.nextKey(false); if (keyIt.hasNext()) if (!keyIt.isPropertyKey()) + "Attribute key in the middle!"); int idx = keyIt.hasIndex() ? keyIt.getIndex() : node .getChildrenCount(keyPart) - 1; if (idx < 0 || idx >= node.getChildrenCount(keyPart))
int escapePos = escapedPosition(key, delimiterPos); if (escapePos < 0)
int escapePos = escapedPosition(key, delimiterPos); if (escapePos < 0)
int escapeOffset = escapeOffset(); if (escapeOffset < 0 || escapeOffset > pos)
/** * Called by {@code findNodesForKey()} to process the sub nodes of * the current node depending on the type of the current key part (children, * attributes, or both). * * @param keyPart the key part * @param subNodes a list with the sub nodes to process * @param nodes the target collection */ private void processSubNodes(DefaultConfigurationKey.KeyIterator keyPart, List<ConfigurationNode> subNodes, Collection<ConfigurationNode> nodes) { if (keyPart.hasIndex()) { if (keyPart.getIndex() >= 0 && keyPart.getIndex() < subNodes.size()) { findNodesForKey((DefaultConfigurationKey.KeyIterator) keyPart .clone(), subNodes.get(keyPart.getIndex()), nodes); } } else { for (ConfigurationNode node : subNodes) { findNodesForKey((DefaultConfigurationKey.KeyIterator) keyPart .clone(), node, nodes); } } } }
/** * Returns the next key part of this configuration key. The boolean * parameter indicates wheter a decorated key should be returned. This * affects only attribute keys: if the parameter is <b>false</b>, the * attribute markers are stripped from the key; if it is <b>true</b>, * they remain. * * @param decorated a flag if the decorated key is to be returned * @return the next key part */ public String nextKey(boolean decorated) { if (!hasNext()) { throw new NoSuchElementException("No more key parts!"); } hasIndex = false; indexValue = -1; String key = findNextIndices(); current = key; hasIndex = checkIndex(key); attribute = checkAttribute(current); return currentKey(decorated); }
/** * Returns the current key of the iteration (without skipping to the * next element). This is the same key the previous {@code next()} * call had returned. (Short form of {@code currentKey(false)}. * * @return the current key */ public String currentKey() { return currentKey(false); }
/** * Returns an iterator for iterating over the single components of this * configuration key. * * @return an iterator for this key */ public KeyIterator iterator() { return new KeyIterator(); }
/** * Returns an iterator for iterating over the single components of this * configuration key. * * @return an iterator for this key */ public KeyIterator iterator() { return new KeyIterator(); }
/** * Returns the current key of the iteration (without skipping to the * next element). This is the same key the previous {@code next()} * call had returned. (Short form of {@code currentKey(false)}. * * @return the current key */ public String currentKey() { return currentKey(false); }