@Override public boolean containsValue(Object nextValue) { if (nextValue instanceof String) { for (Namespace nextNamespace : namespaces) { if (nextNamespace.getName().equals(nextValue)) { return true; } } } return false; }
@Override public int compareTo(Namespace other) { return uri.compareTo(other.getName()); }
@Override public int compareTo(Namespace other) { return uri.compareTo(other.getName()); }
@Override public boolean containsKey(Object nextKey) { if (nextKey instanceof String) { for (Namespace nextNamespace : namespaces) { if (nextNamespace.getPrefix().equals(nextKey)) { return true; } } } return false; }
@Override public Collection<String> values() { List<String> result = new ArrayList<String>(); for (Namespace nextNamespace : namespaces) { result.add(nextNamespace.getName()); } return result; } };
@Override public Set<String> keySet() { Set<String> result = new LinkedHashSet<String>(); for (Namespace nextNamespace : namespaces) { result.add(nextNamespace.getPrefix()); } return result; }
@Override protected String getNamespaceInternal(String prefix) throws SailException { Namespace ns = namespaces.findByPrefix(prefix); if (ns == null) return null; return ns.getName(); }
@Override public Optional<Namespace> getNamespace(String prefix) { for (Namespace nextNamespace : namespaces) { if (prefix.equals(nextNamespace.getPrefix())) { return Optional.of(nextNamespace); } } return Optional.empty(); }
/** * Sets the prefix for a namespace. This will replace any existing namespace * associated to the prefix. * * @param prefix * The new prefix. * @param name * The namespace name that the prefix maps to. * @return The {@link Namespace} object for the given namespace. */ public default Namespace setNamespace(String prefix, String name) { Optional<? extends Namespace> result = getNamespace(prefix); if (!result.isPresent() || !result.get().getName().equals(name)) { result = Optional.of(new SimpleNamespace(prefix, name)); setNamespace(result.get()); } return result.get(); }
/** * NOTE: This entry set is immutable, and does not update the internal * set through its iterator. */ @Override public Set<java.util.Map.Entry<String, String>> entrySet() { Set<java.util.Map.Entry<String, String>> result = new LinkedHashSet<Map.Entry<String, String>>(); for (Namespace nextNamespace : namespaces) { AbstractMap.SimpleImmutableEntry<String, String> nextEntry = new SimpleImmutableEntry<String, String>( nextNamespace.getPrefix(), nextNamespace.getName()); result.add(nextEntry); } return Collections.unmodifiableSet(result); }
@Override public Optional<Namespace> getNamespace(String prefix) { for (Namespace nextNamespace : namespaces) { if (prefix.equals(nextNamespace.getPrefix())) { return Optional.of(nextNamespace); } } return Optional.empty(); }
buffer = new StringBuffer(); buffer.append(ns.getName()); } else if (p != null) {