public static HTMLAttributeName forHTMLName(final char[] attributeNameBuffer, final int attributeNameOffset, final int attributeNameLen) { if (attributeNameBuffer == null || attributeNameLen == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } if (attributeNameOffset < 0 || attributeNameLen < 0) { throw new IllegalArgumentException("Both name offset and length must be equal to or greater than zero"); } return (HTMLAttributeName) htmlAttributeNamesRepository.getAttribute(attributeNameBuffer, attributeNameOffset, attributeNameLen); }
return binarySearch(caseSensitive, values, attributeName);
AttributeName getAttribute(final String completeAttributeName) { int index; this.readLock.lock(); try { /* * First look for the element in the namespaced repository */ index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, completeAttributeName); if (index >= 0) { return this.repository.get(index); } } finally { this.readLock.unlock(); } /* * NOT FOUND. We need to obtain a write lock and store the text */ this.writeLock.lock(); try { return storeAttribute(completeAttributeName); } finally { this.writeLock.unlock(); } }
AttributeName getAttribute(final char[] text, final int offset, final int len) { int index; this.readLock.lock(); try { /* * First look for the element in the namespaced repository */ index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, text, offset, len); if (index >= 0) { return this.repository.get(index); } } finally { this.readLock.unlock(); } /* * NOT FOUND. We need to obtain a write lock and store the text */ this.writeLock.lock(); try { return storeAttribute(text, offset, len); } finally { this.writeLock.unlock(); } }
private AttributeName storeAttribute(final String attributeName) { int index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, attributeName); if (index >= 0) { // It was already added while we were waiting for the lock! return this.repository.get(index); } final AttributeName name; if (this.templateMode == TemplateMode.HTML) { name = buildHTMLAttributeName(attributeName); } else if (this.templateMode == TemplateMode.XML) { name = buildXMLAttributeName(attributeName); } else { // this.templateMode.isText() name = buildTextAttributeName(attributeName); } final String[] completeAttributeNames = name.completeAttributeNames; for (final String completeAttributeName : completeAttributeNames) { index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, completeAttributeName); // binary Search returned (-(insertion point) - 1) this.repositoryNames.add(((index + 1) * -1), completeAttributeName); this.repository.add(((index + 1) * -1), name); } return name; }
private AttributeName storeAttribute(final String prefix, final String attributeName) { int index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, prefix, attributeName); if (index >= 0) { // It was already added while we were waiting for the lock! return this.repository.get(index); } final AttributeName name; if (this.templateMode == TemplateMode.HTML) { name = buildHTMLAttributeName(prefix, attributeName); } else if (this.templateMode == TemplateMode.XML) { name = buildXMLAttributeName(prefix, attributeName); } else { // this.templateMode.isText() name = buildTextAttributeName(prefix, attributeName); } final String[] completeAttributeNames = name.completeAttributeNames; for (final String completeAttributeName : completeAttributeNames) { index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, completeAttributeName); // binary Search returned (-(insertion point) - 1) this.repositoryNames.add(((index + 1) * -1), completeAttributeName); this.repository.add(((index + 1) * -1), name); } return name; }
private AttributeName storeAttribute(final char[] text, final int offset, final int len) { int index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, text, offset, len); if (index >= 0) { // It was already added while we were waiting for the lock! return this.repository.get(index); } final AttributeName name; if (this.templateMode == TemplateMode.HTML) { name = buildHTMLAttributeName(text, offset, len); } else if (this.templateMode == TemplateMode.XML) { name = buildXMLAttributeName(text, offset, len); } else { // this.templateMode.isText() name = buildTextAttributeName(text, offset, len); } final String[] completeAttributeNames = name.completeAttributeNames; for (final String completeAttributeName : completeAttributeNames) { index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, completeAttributeName); // binary Search returned (-(insertion point) - 1) this.repositoryNames.add(((index + 1) * -1), completeAttributeName); this.repository.add(((index + 1) * -1), name); } return name; }
AttributeName getAttribute(final String prefix, final String attributeName) { int index; this.readLock.lock(); try { /* * First look for the element in the namespaced repository */ index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, prefix, attributeName); if (index >= 0) { return this.repository.get(index); } } finally { this.readLock.unlock(); } /* * NOT FOUND. We need to obtain a write lock and store the text */ this.writeLock.lock(); try { return storeAttribute(prefix, attributeName); } finally { this.writeLock.unlock(); } }
public static TextAttributeName forTextName(final char[] attributeNameBuffer, final int attributeNameOffset, final int attributeNameLen) { if (attributeNameBuffer == null || attributeNameLen == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } if (attributeNameOffset < 0 || attributeNameLen < 0) { throw new IllegalArgumentException("Both name offset and length must be equal to or greater than zero"); } return (TextAttributeName) textAttributeNamesRepository.getAttribute(attributeNameBuffer, attributeNameOffset, attributeNameLen); }
public static TextAttributeName forTextName(final String prefix, final String attributeName) { if (attributeName == null || attributeName.trim().length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (TextAttributeName) textAttributeNamesRepository.getAttribute(prefix, attributeName); }
public static TextAttributeName forTextName(final String attributeName) { if (attributeName == null || attributeName.trim().length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (TextAttributeName) textAttributeNamesRepository.getAttribute(attributeName); }
public static XMLAttributeName forXMLName(final String prefix, final String attributeName) { if (attributeName == null || attributeName.trim().length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (XMLAttributeName) xmlAttributeNamesRepository.getAttribute(prefix, attributeName); }
public static HTMLAttributeName forHTMLName(final String attributeName) { if (attributeName == null || attributeName.trim().length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (HTMLAttributeName) htmlAttributeNamesRepository.getAttribute(attributeName); }
public static XMLAttributeName forXMLName(final String attributeName) { if (attributeName == null || attributeName.trim().length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (XMLAttributeName) xmlAttributeNamesRepository.getAttribute(attributeName); }
public static HTMLAttributeName forHTMLName(final String prefix, final String attributeName) { if (attributeName == null || attributeName.trim().length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (HTMLAttributeName) htmlAttributeNamesRepository.getAttribute(prefix, attributeName); }
public static XMLAttributeName forXMLName(final char[] attributeNameBuffer, final int attributeNameOffset, final int attributeNameLen) { if (attributeNameBuffer == null || attributeNameLen == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } if (attributeNameOffset < 0 || attributeNameLen < 0) { throw new IllegalArgumentException("Both name offset and length must be equal to or greater than zero"); } return (XMLAttributeName) xmlAttributeNamesRepository.getAttribute(attributeNameBuffer, attributeNameOffset, attributeNameLen); }