public TextAttributeDefinition forCSSName(final char[] attributeName, final int attributeNameOffset, final int attributeNameLen) { if (attributeName == 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 (TextAttributeDefinition) this.cssAttributeRepository.getAttribute(attributeName, attributeNameOffset, attributeNameLen); }
return binarySearch(caseSensitive, values, attributeName);
index = binarySearch(this.templateMode.isCaseSensitive(), this.standardRepositoryNames, prefix, attributeName); index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, prefix, attributeName); return storeAttribute(prefix, attributeName); } finally { this.writeLock.unlock();
index = binarySearch(this.templateMode.isCaseSensitive(), this.standardRepositoryNames, text, offset, len); index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, text, offset, len); return storeAttribute(text, offset, len); } finally { this.writeLock.unlock();
this.htmlAttributeRepository = new AttributeDefinitionRepository(TemplateMode.HTML, elementProcessorsByTemplateMode); this.xmlAttributeRepository = new AttributeDefinitionRepository(TemplateMode.XML, elementProcessorsByTemplateMode); this.textAttributeRepository = new AttributeDefinitionRepository(TemplateMode.TEXT, elementProcessorsByTemplateMode); this.javascriptAttributeRepository = new AttributeDefinitionRepository(TemplateMode.JAVASCRIPT, elementProcessorsByTemplateMode); this.cssAttributeRepository = new AttributeDefinitionRepository(TemplateMode.CSS, elementProcessorsByTemplateMode);
index = binarySearch(this.templateMode.isCaseSensitive(), this.standardRepositoryNames, completeAttributeName); index = binarySearch(this.templateMode.isCaseSensitive(), this.repositoryNames, completeAttributeName); return storeAttribute(completeAttributeName); } finally { this.writeLock.unlock();
private AttributeDefinition 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 Set<IElementProcessor> elementProcessors = this.elementProcessorsByTemplateMode.get(this.templateMode); final AttributeDefinition attributeDefinition; if (this.templateMode == TemplateMode.HTML) { attributeDefinition = buildHTMLAttributeDefinition(AttributeNames.forHTMLName(attributeName), elementProcessors); } else if (this.templateMode == TemplateMode.XML) { attributeDefinition = buildXMLAttributeDefinition(AttributeNames.forXMLName(attributeName), elementProcessors); } else { // this.templateMode.isText() attributeDefinition = buildTextAttributeDefinition(this.templateMode, AttributeNames.forTextName(attributeName), elementProcessors); } final String[] completeAttributeNames = attributeDefinition.attributeName.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), attributeDefinition); } return attributeDefinition; }
private AttributeDefinition 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 Set<IElementProcessor> elementProcessors = this.elementProcessorsByTemplateMode.get(this.templateMode); final AttributeDefinition attributeDefinition; if (this.templateMode == TemplateMode.HTML) { attributeDefinition = buildHTMLAttributeDefinition(AttributeNames.forHTMLName(prefix, attributeName), elementProcessors); } else if (this.templateMode == TemplateMode.XML) { attributeDefinition = buildXMLAttributeDefinition(AttributeNames.forXMLName(prefix, attributeName), elementProcessors); } else { // this.templateMode.isText() attributeDefinition = buildTextAttributeDefinition(this.templateMode, AttributeNames.forTextName(prefix, attributeName), elementProcessors); } final String[] completeAttributeNames = attributeDefinition.attributeName.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), attributeDefinition); } return attributeDefinition; }
private AttributeDefinition 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 Set<IElementProcessor> elementProcessors = this.elementProcessorsByTemplateMode.get(this.templateMode); final AttributeDefinition attributeDefinition; if (this.templateMode == TemplateMode.HTML) { attributeDefinition = buildHTMLAttributeDefinition(AttributeNames.forHTMLName(text, offset, len), elementProcessors); } else if (this.templateMode == TemplateMode.XML) { attributeDefinition = buildXMLAttributeDefinition(AttributeNames.forXMLName(text, offset, len), elementProcessors); } else { // this.templateMode.isText() attributeDefinition = buildTextAttributeDefinition(this.templateMode, AttributeNames.forTextName(text, offset, len), elementProcessors); } final String[] completeAttributeNames = attributeDefinition.attributeName.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), attributeDefinition); } return attributeDefinition; }
private AttributeDefinition storeStandardAttribute(final AttributeDefinition attributeDefinition) { // This method will only be called from within the AttributeDefinitions class itself, during initialization of // standard elements. final String[] completeAttributeNames = attributeDefinition.attributeName.completeAttributeNames; int index; for (final String completeAttributeName : completeAttributeNames) { index = binarySearch(this.templateMode.isCaseSensitive(), this.standardRepositoryNames, completeAttributeName); // binary Search returned (-(insertion point) - 1) this.standardRepositoryNames.add(((index + 1) * -1), completeAttributeName); this.standardRepository.add(((index + 1) * -1), attributeDefinition); 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), attributeDefinition); } return attributeDefinition; }
public TextAttributeDefinition forTextName(final char[] attributeName, final int attributeNameOffset, final int attributeNameLen) { if (attributeName == 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 (TextAttributeDefinition) this.textAttributeRepository.getAttribute(attributeName, attributeNameOffset, attributeNameLen); }
public XMLAttributeDefinition forXMLName(final char[] attributeName, final int attributeNameOffset, final int attributeNameLen) { if (attributeName == 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 (XMLAttributeDefinition) this.xmlAttributeRepository.getAttribute(attributeName, attributeNameOffset, attributeNameLen); }
public XMLAttributeDefinition forXMLName(final String attributeName) { if (attributeName == null || attributeName.length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (XMLAttributeDefinition) this.xmlAttributeRepository.getAttribute(attributeName); }
public TextAttributeDefinition forJavaScriptName(final String prefix, final String attributeName) { if (attributeName == null || attributeName.length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (TextAttributeDefinition) this.javascriptAttributeRepository.getAttribute(prefix, attributeName); }
public HTMLAttributeDefinition forHTMLName(final char[] attributeName, final int attributeNameOffset, final int attributeNameLen) { if (attributeName == 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 (HTMLAttributeDefinition) this.htmlAttributeRepository.getAttribute(attributeName, attributeNameOffset, attributeNameLen); }
public HTMLAttributeDefinition forHTMLName(final String prefix, final String attributeName) { if (attributeName == null || attributeName.length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (HTMLAttributeDefinition) this.htmlAttributeRepository.getAttribute(prefix, attributeName); }
public TextAttributeDefinition forJavaScriptName(final String attributeName) { if (attributeName == null || attributeName.length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (TextAttributeDefinition) this.javascriptAttributeRepository.getAttribute(attributeName); }
public TextAttributeDefinition forTextName(final String prefix, final String attributeName) { if (attributeName == null || attributeName.length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (TextAttributeDefinition) this.textAttributeRepository.getAttribute(prefix, attributeName); }
public TextAttributeDefinition forTextName(final String attributeName) { if (attributeName == null || attributeName.length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (TextAttributeDefinition) this.textAttributeRepository.getAttribute(attributeName); }
public HTMLAttributeDefinition forHTMLName(final String attributeName) { if (attributeName == null || attributeName.length() == 0) { throw new IllegalArgumentException("Name cannot be null or empty"); } return (HTMLAttributeDefinition) this.htmlAttributeRepository.getAttribute(attributeName); }