Package net.sf.okapi.lib.xliff2.core
Class Segment
- java.lang.Object
-
- net.sf.okapi.lib.xliff2.core.Part
-
- net.sf.okapi.lib.xliff2.core.Segment
-
public class Segment extends Part
Represents a segment object.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sf.okapi.lib.xliff2.core.Part
Part.GetTarget
-
-
Field Summary
Fields Modifier and Type Field Description static TargetState
STATE_DEFAULT
Default value for the target state of a segment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Segment
createAndCopyMetadata()
Creates a new empty segment based on this one.boolean
getCanResegment()
Indicates if this segment can be re-segmented.TargetState
getState()
Gets the state for this segment.String
getSubState()
Gets the sub-state for this segment.boolean
isSegment()
Indicates if this part is a segment or an ignorable.void
setCanResegment(boolean canResegment)
Sets the flag indicating if this segment can be re-segmented.void
setState(String state)
Sets the state for this segment.void
setState(TargetState state)
Sets the state for this segment.void
setSubState(String subState)
Sets the sub-state for this segment.-
Methods inherited from class net.sf.okapi.lib.xliff2.core.Part
getId, getId, getPreserveWS, getSource, getSourceTags, getStore, getTarget, getTarget, getTargetOrder, getTargetTags, hasTarget, removeMarkers, setId, setPreserveWS, setSource, setSource, setTarget, setTarget, setTargetOrder, showProtectedContent
-
-
-
-
Field Detail
-
STATE_DEFAULT
public static final TargetState STATE_DEFAULT
Default value for the target state of a segment.
-
-
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 toSTATE_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.
-
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.
-
-