/*
(non-Javadoc)

@see
net.sf.prefixedproperties.config.PrefixConfig#getPrefixPart(java.lang.
String)
439237
@Override
	public String getPrefixPart(final String key) {
		if (key != null) {
			lock.readLock().lock();
			try {
				for (final String prefixString : prefixes) {
					if (key.startsWith(prefixString + getPrefixDelimiter())) {
						return prefixString + getPrefixDelimiter();
					}
				}
			} finally {
				lock.readLock().unlock();
			}
			return "";
		}
		throw new IllegalArgumentException("The given key is null.");
	}
1026687
public String getPrefixStatsSinglePositionPrefixAttribute(String field) {
    return String.join(MtasToken.DELIMITER, singlePositionPrefix.get(field));
  }
843389
@Override
  public String getNamespaceURI(String prefix) {
    // per javax.xml.namespace.NamespaceContext doc
    if (prefix == null)
      throw new IllegalArgumentException("Cannot get namespace URI for null prefix");
    if (XMLConstants.XML_NS_PREFIX.equals(prefix))
      return XMLConstants.XML_NS_URI;
    if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix))
      return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;

    String namespaceURI = bindings.get(prefix);

    // per javax.xml.namespace.NamespaceContext doc
    return (namespaceURI != null) ? namespaceURI : XMLConstants.NULL_NS_URI;
  }
103890
public static String getPrefixFromValue(String value) {
    if (value == null) {
      return null;
    } else if (value.contains(DELIMITER)) {
      String[] list = value.split(DELIMITER);
      if (list != null && list.length > 0) {
        return list[0].replaceAll("\u0000", "");
      } else {
        return null;
      }
    } else {
      return value.replaceAll("\u0000", "");
    }
  }
1278059
private String getLongPrefix(String token)
    {
        String t = Util.stripLeadingHyphens(token);

        int i;
        String opt = null;
        for (i = t.length() - 2; i > 1; i--)
        {
            String prefix = t.substring(0, i);
            if (options.hasLongOption(prefix))
            {
                opt = prefix;
                break;
            }
        }
        
        return opt;
    }
699657
@Override
	public int getMinPrefixLengthForBlock() {
		Integer result;
		if(hasNoPrefixCache() || (result = prefixCache.cachedMinPrefix) == null) {
			prefixCache.cachedMinPrefix = result = cacheBits(super.getMinPrefixLengthForBlock());
		}
		return result;
	}
422603
@Override
  public String getPrefix(String namespaceURI) {
    // per javax.xml.namespace.NamespaceContext doc
    if (namespaceURI == null)
      throw new IllegalArgumentException("Cannot find prefix for null namespace URI");
    if (XMLConstants.XML_NS_URI.equals(namespaceURI))
      return XMLConstants.XML_NS_PREFIX;
    if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI))
      return XMLConstants.XMLNS_ATTRIBUTE;

    for (Map.Entry<String, String> entry: bindings.entrySet()) {
      if (namespaceURI.equals(entry.getValue()))
        return entry.getKey();
    }

    return null;
  }
184364
public static Set<String> getPropertiesByPrefix(final String propertyNamePrefix) {

        Set<String> ret = new TreeSet<String>();
        Set<Object> keys = properties.keySet();
        for (Object key : keys) {
            if (null != key && key.toString().startsWith(propertyNamePrefix)) {
                ret.add(properties.getProperty(key.toString()));
            }
        }

        return ret;
    }
349658
@Provides
	@Singleton
	@Named(GuiceProperties.REST_SERVICES_PREFIX)
	public String getRestServicesPrefix(ServletContext context)
	{
		String restPath = context.getInitParameter(RESTEASY_MAPPING_PREFIX);

		if (restPath == null || restPath.isEmpty() || restPath.equals("/"))
		{
			return "";
		}
		else
		{
			return restPath;
		}
	}
41764
String getKeyPrefix(StatementPartitioning partitioning, DeterminismMode detMode, String joinOrder) {
        // no caching for inferred yet
        if (partitioning.isInferred()) {
            return null;
        }

        String joinOrderPrefix = "#";
        if (joinOrder != null) {
            joinOrderPrefix += joinOrder;
        }

        boolean partitioned = partitioning.wasSpecifiedAsSingle();

        return joinOrderPrefix + String.valueOf(detMode.toChar()) + (partitioned ? "P#" : "R#");
    }
68937
protected static <R extends IPAddressSection> R[] getSpanningPrefixBlocks(
			R first,
			R other,
			UnaryOperator<R> getLower,
			UnaryOperator<R> getUpper,
			Comparator<R> comparator,
			UnaryOperator<R> prefixAdder,
			UnaryOperator<R> prefixRemover,
			IntFunction<R[]> arrayProducer) {
		first.checkSectionCount(other);
		R[] result = checkPrefixBlockContainment(first, other, prefixAdder, arrayProducer);
		if(result != null) {
			return result;
		}
		List<IPAddressSegmentSeries> blocks = getSpanningBlocks(first, other, getLower, getUpper, comparator, prefixRemover, IPAddressSection::splitIntoPrefixBlocks);
		result = blocks.toArray(arrayProducer.apply(blocks.size()));
		return result;
	}
682383
@Override
	public String toHexString(boolean with0xPrefix) {  
		String result;
		if(hasNoStringCache() || (result = (with0xPrefix ? stringCache.hexStringPrefixed : stringCache.hexString)) == null) {
			result = toHexString(with0xPrefix, null);
			if(with0xPrefix) {
				stringCache.hexStringPrefixed = result;
			} else {
				stringCache.hexString = result;
			}
		}
		return result;
	}
414292
@Override
	public Set<String> getPrefixes() {
		lock.readLock().lock();
		try {
			return new TreeSet<String>(prefixes);
		} finally {
			lock.readLock().unlock();
		}
	}
1133759
private String getKeyPrefix(Class targetClass) {

        String prefix = ((ConfigBundle) targetClass.getAnnotation(ConfigBundle.class)).value();

        if (prefix.isEmpty()) {
            prefix = StringUtils.camelCaseToHyphenCase(targetClass.getSimpleName());
        }

        if (".".equals(prefix)) {
            prefix = "";
        }

        return prefix;
    }
316118
public String getPrefixStatsIntersectionPrefixAttribute(String field) {
    if (intersectingPrefixes.containsKey(field)) {
      return String.join(MtasToken.DELIMITER, intersectingPrefixes.get(field));
    } else {
      return "";
    }
  }
838628
public String getNamespacePrefix(final PrefixMapping mapping,
            final String ns, final boolean compact) {
        final String nsURIPrefix = mapping.getNsURIPrefix(ns);
        if (nsURIPrefix == null) {
            if (compact) {
                final int hashIdx = ns.lastIndexOf('#');
                final int split = hashIdx > 0 ? ns.substring(0, hashIdx).lastIndexOf('/') : ns.lastIndexOf('/');
                return split > 0 ? "..." + ns.substring(split) : ns;
            }
            return ns;
        }
        return nsURIPrefix + ":";
    }
335747
public String getNamespaceURIFromPrefix(String prefix)
    {
        String uri = null;
        if (m_prefixMap != null)
            uri = m_prefixMap.lookupNamespace(prefix);
        return uri;
    }