|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.bliki.wiki.tags.util.Attribute
info.bliki.wiki.tags.util.NodeAttribute
public class NodeAttribute
An attribute within a tag on a page. This attribute is similar to Attribute
but 'lazy loaded' from the Page by providing the page and
cursor offsets into the page for the name and value. This is done for speed,
since if the name and value are not needed we can avoid the cost and memory
overhead of creating the strings.
Thus the property getters, defer to the base class unless the property is null, in which case an attempt is made to read it from the underlying page. Optimizations in the predicates and length calculation defer the actual instantiation of strings until absolutely needed.
| Constructor Summary | |
|---|---|
NodeAttribute()
Create an empty attribute. |
|
NodeAttribute(char[] text,
int name_start,
int name_end,
int value_start,
int value_end,
char quote)
Create an attribute. |
|
NodeAttribute(java.lang.String value)
Create a whitespace attribute with the value given. |
|
NodeAttribute(java.lang.String name,
java.lang.String value)
Create an attribute with the name and value given. |
|
NodeAttribute(java.lang.String name,
java.lang.String value,
char quote)
Create an attribute with the name, value and quote given. |
|
NodeAttribute(java.lang.String name,
java.lang.String assignment,
java.lang.String value)
Create an attribute with the name, assignment string and value given. |
|
NodeAttribute(java.lang.String name,
java.lang.String assignment,
java.lang.String value,
char quote)
Create an attribute with the name, assignment string, value and quote given. |
|
| Method Summary | |
|---|---|
java.lang.String |
getAssignment(java.lang.String text)
Get the assignment string of this attribute. |
void |
getAssignment(java.lang.StringBuilder buffer,
java.lang.String text)
Get the assignment string of this attribute. |
int |
getLength()
Get the length of the string value of this attribute. |
java.lang.String |
getName()
Get the name of this attribute. |
void |
getName(java.lang.StringBuilder buffer,
java.lang.String text)
Get the name of this attribute. |
int |
getNameEndPosition()
Get the ending position of the attribute name. |
int |
getNameStartPosition()
Get the starting position of the attribute name. |
java.lang.String |
getRawValue()
Get the raw value of the attribute. |
void |
getRawValue(java.lang.StringBuilder buffer,
java.lang.String text)
Get the raw value of the attribute. |
java.lang.String |
getValue(java.lang.String text)
Get the value of the attribute. |
void |
getValue(java.lang.StringBuilder buffer,
java.lang.String text)
Get the value of the attribute. |
int |
getValueEndPosition()
Get the ending position of the attribute value. |
int |
getValueStartPosition()
Get the starting position of the attribute value. |
boolean |
isEmpty()
Predicate to determine if this attribute has an equals sign but no value. |
boolean |
isStandAlone()
Predicate to determine if this attribute has no equals sign (or value). |
boolean |
isValued()
Predicate to determine if this attribute has a value. |
boolean |
isWhitespace()
Predicate to determine if this attribute is whitespace. |
void |
setNameEndPosition(int end)
Set the ending position of the attribute name. |
void |
setNameStartPosition(int start)
Set the starting position of the attribute name. |
void |
setValueEndPosition(int end)
Set the ending position of the attribute value. |
void |
setValueStartPosition(int start)
Set the starting position of the attribute value. |
| Methods inherited from class info.bliki.wiki.tags.util.Attribute |
|---|
getAssignment, getAssignment, getName, getQuote, getQuote, getRawValue, getValue, getValue, setAssignment, setName, setQuote, setRawValue, setValue, toString, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NodeAttribute(char[] text,
int name_start,
int name_end,
int value_start,
int value_end,
char quote)
name_start - The starting offset of the name within the page. If this is
negative, the name is considered null.name_end - The ending offset of the name within the page.value_start - he starting offset of the value within the page. If this is
negative, the value is considered null.value_end - The ending offset of the value within the page.quote - The quote, if any, surrounding the value of the attribute,
(i.e. ' or "), or zero if none.
public NodeAttribute(java.lang.String name,
java.lang.String assignment,
java.lang.String value,
char quote)
Attribute.setRawValue(java.lang.String) which sets the quote character to a proper value if
necessary.
name - The name of this attribute.assignment - The assignment string of this attribute.value - The value of this attribute.quote - The quote around the value of this attribute.
public NodeAttribute(java.lang.String name,
java.lang.String value,
char quote)
null,
and calls Attribute.setRawValue(java.lang.String) to get the correct quoting if
quote is zero.
name - The name of this attribute.value - The value of this attribute.quote - The quote around the value of this attribute.
public NodeAttribute(java.lang.String value)
throws java.lang.IllegalArgumentException
value - The value of this attribute.
java.lang.IllegalArgumentException - if the value contains other than whitespace. To set a real
value use #PageAttribute(String,String).
public NodeAttribute(java.lang.String name,
java.lang.String value)
null, and calls
Attribute.setRawValue(java.lang.String) to get the correct quoting.
name - The name of this attribute.value - The value of this attribute.
public NodeAttribute(java.lang.String name,
java.lang.String assignment,
java.lang.String value)
Attribute.setRawValue(java.lang.String) to get the correct quoting.
name - The name of this attribute.assignment - The assignment string of this attribute.value - The value of this attribute.public NodeAttribute()
Attribute.toString() and Attribute.toString(StringBuilder) methods.
| Method Detail |
|---|
public java.lang.String getName()
getName in class Attributenull if it's just a whitepace
'attribute'.Attribute.setName(java.lang.String)
public void getName(java.lang.StringBuilder buffer,
java.lang.String text)
buffer - The buffer to place the name in.getName()public java.lang.String getAssignment(java.lang.String text)
public void getAssignment(java.lang.StringBuilder buffer,
java.lang.String text)
buffer - The buffer to place the assignment string in.Attribute.getAssignment()public java.lang.String getValue(java.lang.String text)
getRawValue().
null if it's a stand-alone or empty
attribute, or the text if it's just a whitepace 'attribute'.
public void getValue(java.lang.StringBuilder buffer,
java.lang.String text)
buffer - The buffer to place the value in.Attribute.getValue()public java.lang.String getRawValue()
getRawValue in class Attributenull if it's a stand-alone
attribute, or the text if it's just a whitepace 'attribute'.Attribute.setRawValue(java.lang.String)
public void getRawValue(java.lang.StringBuilder buffer,
java.lang.String text)
buffer - The string buffer to append the attribute value to.getRawValue()public int getNameStartPosition()
public void setNameStartPosition(int start)
start - The new offset into the page at which the name begins.public int getNameEndPosition()
public void setNameEndPosition(int end)
end - The new offset into the page at which the name ends.public int getValueStartPosition()
public void setValueStartPosition(int start)
start - The new offset into the page at which the value begins.public int getValueEndPosition()
public void setValueEndPosition(int end)
end - The new offset into the page at which the value ends.public boolean isWhitespace()
isWhitespace in class Attributetrue if this attribute is whitespace,
false if it is a real attribute.public boolean isStandAlone()
isStandAlone in class Attributetrue if this attribute is a standalone attribute.
false if has an equals sign.public boolean isEmpty()
isEmpty in class Attributetrue if this attribute is an empty attribute.
false if has an equals sign and a value.public boolean isValued()
isValued in class Attributetrue if this attribute has a value.
false if it is empty or standalone.public int getLength()
getLength in class Attribute
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||