Class CTag

  • All Implemented Interfaces:
    IWithExtAttributes

    public class CTag
    extends Tag
    Represents an opening, closing or standalone tag for an original inline code.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected net.sf.okapi.lib.xliff2.core.CTagCommon cc  
      • Fields inherited from class net.sf.okapi.lib.xliff2.core.Tag

        tagType
    • Constructor Summary

      Constructors 
      Constructor Description
      CTag​(TagType tagType, String id, String data)
      Creates a new code tag (without any link to another tag).
    • Field Detail

      • cc

        protected net.sf.okapi.lib.xliff2.core.CTagCommon cc
    • Constructor Detail

      • CTag

        public CTag​(TagType tagType,
                    String id,
                    String data)
        Creates a new code tag (without any link to another tag).
        Parameters:
        tagType - the tag type.
        id - the id (should not be null).
        data - the data (can be null).
    • Method Detail

      • equals

        public boolean equals​(Object other)
        Description copied from class: Tag
        Indicates if this tag is equal to another.

        Use the == operator to test if two tags are the same.

        Overrides:
        equals in class Tag
        Parameters:
        other - the other tag to compare to this one.
        Returns:
        true if both tags are equals.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Tag
      • isCode

        public boolean isCode()
        Description copied from class: Tag
        Indicates if this tag is for a code (CTag).
        Specified by:
        isCode in class Tag
        Returns:
        true if this tag is used by a code (CTag), false if it is for a marker (MTag).
      • isMarker

        public boolean isMarker()
        Description copied from class: Tag
        Indicates if this tag is for a marker (MTag).
        Specified by:
        isMarker in class Tag
        Returns:
        true if this tag is one for a marker (MTag), false if it is for a code (CTag).
      • getId

        public String getId()
        Description copied from class: Tag
        Gets the id for the code or annotation using this tag.
        Specified by:
        getId in class Tag
        Returns:
        the id for the code or annotation using this tag.
      • getType

        public String getType()
        Description copied from class: Tag
        Gets the type of the code or marker this tag represents.
        Specified by:
        getType in class Tag
        Returns:
        the type of the code or marker this tag represents. If this is a CTag the type value can be null.
      • setType

        public void setType​(String type)
        Description copied from class: Tag
        Sets the type of the code or marker (for both opening/closing tags).
        Specified by:
        setType in class Tag
        Parameters:
        type - the type of the code or marker this tag represents.
      • 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 CanReorder values. If the tag is a closing tag and the code is set to CanReorder.FIRSTNO this method return CanReorder.NO as 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 from CanReorder.YES the canDelete and canCopy fields 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.