|
PageMixer API - 3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jp.ne.dti.lares.foozy.pagemixer.Token
Abstraction of HTML page element.
HTML page is recognized as the sequence of Token (or derived classes from it) objects.
Though concept "name"/"start tag"/"end tag"/"attribute" are not needed at this abstraction level in fact, accessing/examination methods are provided for efficiency at execution (e.g.: eliminating cost of "instanceof"/narrowing).
You must concretize below method(s) to have this function.
Attribute
, Serialized FormConstructor Summary | |
Token()
Constructor. |
Method Summary | |
Token |
createFixed()
Create inmutable LOGICALY equal one. |
boolean |
equals(java.lang.Object object)
Examine object equality. |
Attribute |
findAttribute(Symbol name)
Find attribute named as specified name. |
Attribute[] |
findAttributes(Symbol name)
Find attributes named as specified name. |
Attribute[] |
getAttributes()
Get array of all attributes owned by token. |
java.lang.String |
getAttributeValue(Symbol name,
java.lang.String defaultValue)
Get attribute value directly. |
Symbol |
getName()
Get name of token. |
boolean |
hasAttribute(Symbol name,
java.lang.String expected)
Examine attribute value. |
int |
hashCode()
|
boolean |
isEmpty()
Examine whether token is "HTML empty tag" token. |
boolean |
isEnd()
Examine whether token is "HTML end tag" token. |
boolean |
isNamedAs(Symbol name)
Examine whether token is named as specified name or not. |
boolean |
isStart()
Examine whether token is "HTML start tag" token. |
abstract void |
render(SafeWriter writer)
Render own text image on specified writer. |
abstract void |
resolve(SymbolSet symbolSet)
Resolve own name symbol with specified set. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Token()
Method Detail |
public Symbol getName()
public boolean isNamedAs(Symbol name)
name
- expected name of tokenpublic boolean isStart()
public boolean isEnd()
public boolean isEmpty()
public Attribute findAttribute(Symbol name)
name
- name of attributepublic final java.lang.String getAttributeValue(Symbol name, java.lang.String defaultValue)
This returns "defaultValue" at least, even though specified attribute is not found.
name
- of attributedefaultValue
- to be returnedpublic final boolean hasAttribute(Symbol name, java.lang.String expected)
This only examines the attribute found by findAttribute(jp.ne.dti.lares.foozy.pagemixer.Symbol)
.
name
- of attributeexpected
- value(or null, if examine only attribute existance)public Attribute[] findAttributes(Symbol name)
This returns non-null array object, even if no attribute has specified name.
name
- name of attributepublic Attribute[] getAttributes()
public Token createFixed()
Mutable token costs much more to keep mutablity
(e.g.: having java.util.ArrrayList
object,
iterative processing on each elements is not cheap)
than inmutable one.
Mutablity has less need at token processing, even though it is needed at HTML page tokenization.
So, after tokenization, this method will be invoked to re-produce inmutable and LOGICALY equal one from another.
public abstract void render(SafeWriter writer) throws MixingIOException
writer
- writer written onMixingIOException
- IOException is thrownpublic abstract void resolve(SymbolSet symbolSet)
Symbol
of name may not be unified in some situations
(e.g.: after objec deserialization).
It causes comparation mistakes,
because one of Symbol
implementations uses
pointer comparation to examine string equalitiy.
This method gives the chance to unify Symbol
by resolving with specified SymbolSet
(= invoking SymbolSet.lookup(Symbol)
)
This method in derived class may cause invocation
Attribute.resolve(SymbolSet)
on own attributes.
symbolSet
- set to resolve withpublic boolean equals(java.lang.Object object)
This examines:
start-ness
of token
end-ness
of token
empty-ness
of token
attributes
of token by Utils.compare(java.lang.Object[], java.lang.Object[])
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
PageMixer API - 3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |