Package net.sf.okapi.lib.xliff2.core
Class CTag
- java.lang.Object
-
- net.sf.okapi.lib.xliff2.core.DataWithExtAttributes
-
- net.sf.okapi.lib.xliff2.core.Tag
-
- net.sf.okapi.lib.xliff2.core.CTag
-
- All Implemented Interfaces:
IWithExtAttributes
public class CTag extends Tag
Represents an opening, closing or standalone tag for an original inline code.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)Indicates if this tag is equal to another.booleangetCanCopy()Indicates if this code can be copied.booleangetCanDelete()Indicates if this code can be deleted.booleangetCanOverlap()Indicates if this spanning code can overlap others (i.e.CanReordergetCanReorder()Indicates if this code can be re-ordered.StringgetCopyOf()Gets the ID of the code from which this code is a copy.StringgetData()Gets the original data of this code's tag.DirectionalitygetDataDir()Gets the directionality of the original data of this code's tag.StringgetDataRef()Gets the ID of the element where this code's tag is stored.DirectionalitygetDir()Gets the directionality of the content of this code.StringgetDisp()Gets the user-friendly representation of the data of this code's tag.StringgetEquiv()Gets the text equivalent representation of the data of this code's tag.StringgetId()Gets the id for the code or annotation using this tag.StringgetSubFlows()Gets the IDs of the units representing the sub-flows for this code's tag.String[]getSubFlowsIds()Gets an array of the IDs of the units representing the sub-flows for this code's tag.StringgetSubType()Gets the sub-type of this code.StringgetType()Gets the type of the code or marker this tag represents.booleanhasData()Indicates if this code's tag has some content for its original data.inthashCode()booleanisCode()Indicates if this tag is for a code (CTag).booleanisInitialWithData()Indicates if this code's tag had an original data initially (when read from the document).booleanisMarker()Indicates if this tag is for a marker (MTag).voidsetCanCopy(boolean canCopy)Sets the flag indicating if this code can be copied (for both opening/closing tags).voidsetCanDelete(boolean canDelete)Sets the flag indicating if this code can be deleted (for both opening/closing tags).voidsetCanOverlap(boolean canOverlap)sets the flag indicating if this code can overlap others (for both opening/closing tags).voidsetCanReorder(CanReorder canReorder)Sets the flag indicating if this code can be re-ordered.voidsetCopyOf(String id)Sets the ID of the code from which this code is a copy (for both opening/closing tags).voidsetData(String data)Sets the original data of this code's tag.voidsetDataDir(Directionality dir)Sets the directionality of the original data of this code's tag.voidsetDataRef(String dataRef)Sets the ID of the element where this code's tag is stored.voidsetDir(Directionality dir)Sets the directionality of the content of this code (for both opening/closing tags).voidsetDisp(String disp)Sets the user-friendly representation of the data of this code's tag.voidsetEquiv(String equiv)Sets the text equivalent representation of the data of this code's tag.voidsetInitialWithData(boolean initialWithData)Sets the flag indicating if this code's tag had an original data initially.voidsetSubFlows(String subFlows)Sets the IDs of the units representing the sub-flows for this code's tag.voidsetSubType(String subType)Sets the sub-type of this code (for both opening/closing tags).voidsetType(String type)Sets the type of the code or marker (for both opening/closing tags).voidverifyTypeSubTypeValues()Verifies the type and sub-type values.-
Methods inherited from class net.sf.okapi.lib.xliff2.core.Tag
getTagType, setTagType, toString
-
Methods inherited from class net.sf.okapi.lib.xliff2.core.DataWithExtAttributes
getExtAttributes, getExtAttributeValue, hasExtAttribute, setExtAttributes
-
-
-
-
Method Detail
-
equals
public boolean equals(Object other)
Description copied from class:TagIndicates if this tag is equal to another.Use the
==operator to test if two tags are the same.
-
isCode
public boolean isCode()
Description copied from class:TagIndicates if this tag is for a code (CTag).
-
isMarker
public boolean isMarker()
Description copied from class:TagIndicates if this tag is for a marker (MTag).
-
getId
public String getId()
Description copied from class:TagGets the id for the code or annotation using this tag.
-
getType
public String getType()
Description copied from class:TagGets the type of the code or marker this tag represents.
-
setType
public void setType(String type)
Description copied from class:TagSets the type of the code or marker (for both opening/closing tags).
-
getSubType
public String getSubType()
Gets the sub-type of this code.- Returns:
- the sub-type of this code.
-
setSubType
public void setSubType(String subType)
Sets the sub-type of this code (for both opening/closing tags).- Parameters:
subType- the new sub-type of this code.
-
getCanCopy
public boolean getCanCopy()
Indicates if this code can be copied.- Returns:
- true if this code can be copied, false if it cannot.
-
setCanCopy
public void setCanCopy(boolean canCopy)
Sets the flag indicating if this code can be copied (for both opening/closing tags).- Parameters:
canCopy- true to allow this code to be copied, false otherwise.
-
getCanOverlap
public boolean getCanOverlap()
Indicates if this spanning code can overlap others (i.e. be not well-formed). This information applies only to paired codes, not to standalone codes.- Returns:
- true if this code can overlap others, false otherwise.
-
setCanOverlap
public void setCanOverlap(boolean canOverlap)
sets the flag indicating if this code can overlap others (for both opening/closing tags).- Parameters:
canOverlap- true to allow this code to overlap others, false otherwise.
-
getCanDelete
public boolean getCanDelete()
Indicates if this code can be deleted.- Returns:
- true if this code can be deleted, false otherwise.
-
setCanDelete
public void setCanDelete(boolean canDelete)
Sets the flag indicating if this code can be deleted (for both opening/closing tags).- Parameters:
canDelete- true to allow this code to be deleted, false otherwise.
-
getCanReorder
public CanReorder getCanReorder()
Indicates if this code can be re-ordered.- Returns:
- one of the
CanReordervalues. If the tag is a closing tag and the code is set toCanReorder.FIRSTNOthis method returnCanReorder.NOas the closing tag of a code cannot be a first-no (only an opening tag can be).
-
setCanReorder
public void setCanReorder(CanReorder canReorder)
Sets the flag indicating if this code can be re-ordered. If the new value is different fromCanReorder.YESthecanDeleteandcanCopyfields are set automatically to false.- Parameters:
canReorder- the new value for the flag indicating if this code can be re-ordered.
-
getCopyOf
public String getCopyOf()
Gets the ID of the code from which this code is a copy.- Returns:
- the ID of the code from which this code was copied (can be null).
-
setCopyOf
public void setCopyOf(String id)
Sets the ID of the code from which this code is a copy (for both opening/closing tags).- Parameters:
id- the ID of the code from which this code was copied (can be null).
-
hasData
public boolean hasData()
Indicates if this code's tag has some content for its original data.- Returns:
- true if the original data is neither null nor empty.
-
getData
public String getData()
Gets the original data of this code's tag.- Returns:
- the original data of this code's tag (can be null).
-
setData
public void setData(String data)
Sets the original data of this code's tag.- Parameters:
data- the original data of this code's tag (can be null).
-
getDataRef
public String getDataRef()
Gets the ID of the element where this code's tag is stored.- Returns:
- the ID of the element where this code's tag is stored (can be null).
-
setDataRef
public void setDataRef(String dataRef)
Sets the ID of the element where this code's tag is stored.- Parameters:
dataRef- the ID of the element where this code's tag is stored (can be null).
-
isInitialWithData
public boolean isInitialWithData()
Indicates if this code's tag had an original data initially (when read from the document).- Returns:
- true if this code's tag had an original data initially.
-
setInitialWithData
public void setInitialWithData(boolean initialWithData)
Sets the flag indicating if this code's tag had an original data initially.- Parameters:
initialWithData- true to indicate that this code's tag had an original data initially.
-
getDataDir
public Directionality getDataDir()
Gets the directionality of the original data of this code's tag.- Returns:
- the directionality of the original data of this code's tag.
-
setDataDir
public void setDataDir(Directionality dir)
Sets the directionality of the original data of this code's tag.- Parameters:
dir- the new directionality of the original data of this code's tag.
-
getDisp
public String getDisp()
Gets the user-friendly representation of the data of this code's tag.- Returns:
- the user-friendly representation of the data of this code's tag (can be null).
-
setDisp
public void setDisp(String disp)
Sets the user-friendly representation of the data of this code's tag.- Parameters:
disp- the new user-friendly representation of the data of this code's tag.
-
getEquiv
public String getEquiv()
Gets the text equivalent representation of the data of this code's tag.- Returns:
- the text equivalent representation of the data of this code's tag (can be empty but not null).
-
setEquiv
public void setEquiv(String equiv)
Sets the text equivalent representation of the data of this code's tag.- Parameters:
equiv- the new text equivalent representation of the data of this code's tag. A null value will result in an empty string representation.
-
getSubFlows
public String getSubFlows()
Gets the IDs of the units representing the sub-flows for this code's tag.- Returns:
- the IDs of the units representing the sub-flows for this code's tag.
-
setSubFlows
public void setSubFlows(String subFlows)
Sets the IDs of the units representing the sub-flows for this code's tag. The list is automatically normalized.- Parameters:
subFlows- the new IDs of the units representing the sub-flows for this code's tag.
-
getSubFlowsIds
public String[] getSubFlowsIds()
Gets an array of the IDs of the units representing the sub-flows for this code's tag.- Returns:
- an array of IDs (can be empty but is never null).
-
getDir
public Directionality getDir()
Gets the directionality of the content of this code.- Returns:
- the directionality of the content of this code.
-
setDir
public void setDir(Directionality dir)
Sets the directionality of the content of this code (for both opening/closing tags).- Parameters:
dir- the new directionality of the content of this code.
-
verifyTypeSubTypeValues
public void verifyTypeSubTypeValues()
Verifies the type and sub-type values.- Throws:
InvalidParameterException- if a value is invalid.
-
-