Class Segment


  • public class Segment
    extends Part
    Represents a segment object.
    • Field Detail

      • STATE_DEFAULT

        public static final TargetState STATE_DEFAULT
        Default value for the target state of a segment.
    • Constructor Detail

      • Segment

        public Segment​(Segment original)
        Copy constructor.
        Parameters:
        original - the original object to duplicate.
      • Segment

        public Segment​(Store store)
        Creates a new Segment object.
        Parameters:
        store - the shared Store for this object.
    • Method Detail

      • getCanResegment

        public boolean getCanResegment()
        Indicates if this segment can be re-segmented.
        Returns:
        true if this segment can be re-segmented, false otherwise.
      • setCanResegment

        public void setCanResegment​(boolean canResegment)
        Sets the flag indicating if this segment can be re-segmented.
        Parameters:
        canResegment - true to indicate that this segment can be re-segmented.
      • getState

        public TargetState getState()
        Gets the state for this segment.
        Returns:
        the state for this segment.
      • setState

        public void setState​(String state)
        Sets the state for this segment.
        Parameters:
        state - the new state for this segment. The value must be "initial", "translated", "reviewed" or "final". It can also be null and in that case the value is set to STATE_DEFAULT.
      • setState

        public void setState​(TargetState state)
        Sets the state for this segment.
        Parameters:
        state - the new state to set.
      • getSubState

        public String getSubState()
        Gets the sub-state for this segment.
        Returns:
        the sub-state for this segment (can be null).
      • setSubState

        public void setSubState​(String subState)
        Sets the sub-state for this segment.
        Parameters:
        subState - the new sub-state for this segment. The string must be in the format "prefix:value" or it can be null.
      • isSegment

        public boolean isSegment()
        Description copied from class: Part
        Indicates if this part is a segment or an ignorable.
        Overrides:
        isSegment in class Part
        Returns:
        true if this part is a segment, false otherwise.
      • createAndCopyMetadata

        public Segment createAndCopyMetadata()
        Creates a new empty segment based on this one.

        The new segment uses the same store and has the same core metadata (translate, can-re-segment, state, sub-state) as this segment. The metadata of the source and target are also copied, but not their content. The new segment has an empty target if this one has a target and it has no target if this one has no target. The new segment has also has a new id value.

        Returns:
        the new segment.