private Attributes buildAttributes(final Attribute[] attributeArray) { if (attributeArray == null || attributeArray.length == 0) { return Attributes.EMPTY_ATTRIBUTES; } final String[] innerWhiteSpaces; if (attributeArray.length < SYNTHETIC_INNER_WHITESPACES.length) { innerWhiteSpaces = SYNTHETIC_INNER_WHITESPACES[attributeArray.length]; } else { innerWhiteSpaces = new String[attributeArray.length]; Arrays.fill(innerWhiteSpaces, Attributes.DEFAULT_WHITE_SPACE); } return new Attributes(attributeArray, innerWhiteSpaces); }
int getAssociatedProcessorCount() { int c = this.associatedProcessorCount; if (c < 0) { this.associatedProcessorCount = c = computeAssociatedProcessorCount(); } return c; }
public IAttribute[] getAllAttributes() { if (this.attributes == null) { return Attributes.EMPTY_ATTRIBUTE_ARRAY; } return this.attributes.getAllAttributes(); }
Attributes removeAttribute(final AttributeName attributeName) { if (this.attributes == null) { // We have no attribute array, nothing to remove return this; } final int attrIdx = searchAttribute(attributeName); if (attrIdx < 0) { // Attribute does not exist. Just exit return this; } return removeAttribute(attrIdx); }
return setAttribute(attributeDefinitions, templateMode, newAttributeDefinition, newCompleteName, value, valueQuotes); final int oldIdx = searchAttribute(oldName); if (oldIdx < 0) { return setAttribute(attributeDefinitions, templateMode, newAttributeDefinition, newCompleteName, value, valueQuotes); (newAttributeDefinition != null? searchAttribute(newAttributeDefinition.attributeName) : searchAttribute(templateMode, newCompleteName)); if (existingIdx >= 0) { return setAttribute(attributeDefinitions, templateMode, newAttributeDefinition, newCompleteName, value, valueQuotes); newAttributes[existingIdx].modify(null, newCompleteName, value, valueQuotes); return new Attributes(newAttributes, newInnerWhiteSpaces); return new Attributes(newAttributes, this.innerWhiteSpaces);
Attribute getAttribute(final AttributeName attributeName) { final int pos = searchAttribute(attributeName); if (pos < 0) { return null; } return this.attributes[pos]; }
StandaloneElementTag removeAttribute(final String completeName) { final Attributes oldAttributes = (this.attributes != null? this.attributes : Attributes.EMPTY_ATTRIBUTES); final Attributes newAttributes = oldAttributes.removeAttribute(this.templateMode, completeName); if (oldAttributes == newAttributes) { return this; } return new StandaloneElementTag(this.templateMode, this.elementDefinition, this.elementCompleteName, newAttributes, this.synthetic, this.minimized, this.templateName, this.line, this.col); }
public final IAttribute getAttribute(final AttributeName attributeName) { Validate.notNull(attributeName, "Attribute name cannot be null"); if (this.attributes == null) { return null; } return this.attributes.getAttribute(attributeName); }
(attributeDefinition != null? searchAttribute(attributeDefinition.attributeName) : searchAttribute(templateMode, completeName)); newAttributes[existingIdx].modify(null, completeName, value, valueQuotes); return new Attributes(newAttributes, this.innerWhiteSpaces); return new Attributes(newAttributes, newInnerWhiteSpaces);
public final boolean hasAttribute(final String completeName) { Validate.notNull(completeName, "Attribute name cannot be null"); if (this.attributes == null) { return false; } return this.attributes.hasAttribute(this.templateMode, completeName); }
StandaloneElementTag replaceAttribute( final AttributeDefinitions attributeDefinitions, final AttributeName oldName, final AttributeDefinition newAttributeDefinition, final String completeNewName, final String value, final AttributeValueQuotes valueQuotes) { final Attributes oldAttributes = (this.attributes != null? this.attributes : Attributes.EMPTY_ATTRIBUTES); final Attributes newAttributes = oldAttributes.replaceAttribute(attributeDefinitions, this.templateMode, oldName, newAttributeDefinition, completeNewName, value, valueQuotes); return new StandaloneElementTag(this.templateMode, this.elementDefinition, this.elementCompleteName, newAttributes, this.synthetic, this.minimized, this.templateName, this.line, this.col); }
public Map<String,String> getAttributeMap() { if (this.attributes == null) { return Collections.emptyMap(); } return this.attributes.getAttributeMap(); }
private IElementProcessor[] computeProcessors() { final int associatedProcessorCount = (this.attributes != null? this.attributes.getAssociatedProcessorCount() : 0);
Attributes removeAttribute(final TemplateMode templateMode, final String completeName) { if (this.attributes == null) { // We have no attribute array, nothing to remove return this; } final int attrIdx = searchAttribute(templateMode, completeName); if (attrIdx < 0) { // Attribute does not exist. Just exit return this; } return removeAttribute(attrIdx); }
Attribute getAttribute(final TemplateMode templateMode, final String completeName) { final int pos = searchAttribute(templateMode, completeName); if (pos < 0) { return null; } return this.attributes[pos]; }
StandaloneElementTag removeAttribute(final AttributeName attributeName) { final Attributes oldAttributes = (this.attributes != null? this.attributes : Attributes.EMPTY_ATTRIBUTES); final Attributes newAttributes = oldAttributes.removeAttribute(attributeName); if (oldAttributes == newAttributes) { return this; } return new StandaloneElementTag(this.templateMode, this.elementDefinition, this.elementCompleteName, newAttributes, this.synthetic, this.minimized, this.templateName, this.line, this.col); }
public final IAttribute getAttribute(final String completeName) { Validate.notNull(completeName, "Attribute name cannot be null"); if (this.attributes == null) { return null; } return this.attributes.getAttribute(this.templateMode, completeName); }
public final boolean hasAttribute(final AttributeName attributeName) { Validate.notNull(attributeName, "Attribute name cannot be null"); if (this.attributes == null) { return false; } return this.attributes.hasAttribute(attributeName); }
OpenElementTag replaceAttribute( final AttributeDefinitions attributeDefinitions, final AttributeName oldName, final AttributeDefinition newAttributeDefinition, final String completeNewName, final String value, final AttributeValueQuotes valueQuotes) { final Attributes oldAttributes = (this.attributes != null? this.attributes : Attributes.EMPTY_ATTRIBUTES); final Attributes newAttributes = oldAttributes.replaceAttribute(attributeDefinitions, this.templateMode, oldName, newAttributeDefinition, completeNewName, value, valueQuotes); return new OpenElementTag(this.templateMode, this.elementDefinition, this.elementCompleteName, newAttributes, this.synthetic, this.templateName, this.line, this.col); }
Attributes removeAttribute(final TemplateMode templateMode, final String prefix, final String name) { if (this.attributes == null) { // We have no attribute array, nothing to remove return this; } final int attrIdx = searchAttribute(templateMode, prefix, name); if (attrIdx < 0) { // Attribute does not exist. Just exit return this; } return removeAttribute(attrIdx); }