public abstract class Tag extends java.lang.Object implements Element
Modifier and Type | Class and Description |
---|---|
static class |
Tag.Type |
Constructor and Description |
---|
Tag(java.lang.String tag,
java.lang.String shortcut,
Tag.Type type,
Attributes attributes)
Creates a new instance of Tag
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttribute(java.lang.String name)
Returns attribute value by name.
|
Attribute |
getAttributeObject(java.lang.String name)
Returns attribute object by name.
|
Attributes |
getAttributes()
Returns tag's attributes.
|
int |
getIndex()
Returns the index of this tag in the entry.
|
java.lang.String |
getShortcut()
Returns the short form of this tag, most often -- the first letter.
|
Attributes |
getStartAttributes()
Returns tag's attributes.
|
java.lang.String |
getTag()
Returns this tag.
|
Tag.Type |
getType()
Returns type of this tag.
|
void |
setIndex(int shortcut)
Sets the index of the tag in the entry for proper shortcutization.
|
void |
setStartAttributes(Attributes startAttributes) |
void |
setType(Tag.Type type)
Sets type of this tag.
|
abstract java.lang.String |
toOriginal()
Returns the tag in its original form as it was in original document.
|
protected java.lang.String |
toPartialTMX()
Returns short XML-encoded representation of the tag to store in TMX,
without enclosing <bpt>, <ept> or <ph>.
|
java.lang.String |
toSafeCalcShortcut()
Returns shorcuts like '\b_i0_\b' for statistics calculation
|
java.lang.String |
toShortcut()
Returns shortcut string representation of the element.
|
java.lang.String |
toTMX()
Returns long XML-encoded representation of the tag to store in TMX.
|
public Tag(java.lang.String tag, java.lang.String shortcut, Tag.Type type, Attributes attributes)
public java.lang.String getTag()
public java.lang.String getShortcut()
public Tag.Type getType()
public void setType(Tag.Type type)
public Attributes getAttributes()
public java.lang.String getAttribute(java.lang.String name)
public Attribute getAttributeObject(java.lang.String name)
public Attributes getStartAttributes()
public void setStartAttributes(Attributes startAttributes)
public int getIndex()
public void setIndex(int shortcut)
toShortcut()
will return <s3> and toTMX()
will return <bpt
i="3"><strong></bpt>.public java.lang.String toTMX()
toPartialTMX()
in <bpt>,
<ept> or <ph>. Can be overriden in ancestors if needed, but
most probably you won't ever need to override this method, and override
toPartialTMX()
instead. E.g. for <strong> tag should
return <bpt i="3"><strong></bpt>.protected java.lang.String toPartialTMX()
public java.lang.String toShortcut()
toShortcut
in interface Element
public java.lang.String toSafeCalcShortcut()
Element
toSafeCalcShortcut
in interface Element
public abstract java.lang.String toOriginal()
toOriginal
in interface Element