Package net.sf.okapi.lib.xliff2.core
Class Store
- java.lang.Object
-
- net.sf.okapi.lib.xliff2.core.Store
-
public class Store extends Object
Represents the store where code and markers, as well as other information, are stored and shared for a given object implementingIWithStore(e.g. aUnit).
-
-
Constructor Summary
Constructors Constructor Description Store(IWithStore parent)Creates a new store and associates it to a given parent object (e.g.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcalculateDataToIdsMap()StringgetIdForData(CTag ctag)Map<String,String>getOutsideRepresentationMap()IWithStoregetParent()Gets the main object associated with this store.DirectionalitygetSourceDir()Gets the source directionality for this store.TagsgetSourceTags()Gets the source tags for this store.TaggetTag(String id)Gets the tag object for a given id.TaggetTag(String id, TagType tagType)Gets the tag for a given id and type (from the whole store).DirectionalitygetTargetDir()Gets the target directionality for this store.TagsgetTargetTags()Gets the target tags for this store.booleanhasCTagWithData()Indicates if there is at least one code with original data in this store.booleanhasSourceTag()Indicates if there is at least one tag (for code or marker) in the source content for this store.booleanhasTargetTag()Indicates if there is at least one tag (for code or marker) in the target content for this store.booleanisIdUsed(String id)Indicates if a given id value is already in use in the object associated with this store (i.e.booleanisIdUsedInTags(String id)Indicates if a given id value is already used among the existing tags (not the full scope of a store).voidsetOutsideRepresentationMap(Map<String,String> map)voidsetSourceDir(Directionality dir)Sets the source directionality for this store.voidsetTargetDir(Directionality dir)Sets the target directionality for this store.StringsuggestId(boolean forSegment)Gets a suggested id for code, annotation, ignorable or segment.
-
-
-
Constructor Detail
-
Store
public Store(IWithStore parent)
Creates a new store and associates it to a given parent object (e.g. aUnitor aMatch).- Parameters:
parent- the parent object to associate this store with (cannot be null).
-
-
Method Detail
-
hasCTagWithData
public boolean hasCTagWithData()
Indicates if there is at least one code with original data in this store.- Returns:
- true if there is at least one code with original data in this store.
-
hasSourceTag
public boolean hasSourceTag()
Indicates if there is at least one tag (for code or marker) in the source content for this store.- Returns:
- true if there is one, false otherwise.
-
hasTargetTag
public boolean hasTargetTag()
Indicates if there is at least one tag (for code or marker) in the target content for this store.- Returns:
- true if there is one, false otherwise.
-
getSourceTags
public Tags getSourceTags()
Gets the source tags for this store.- Returns:
- the source tags for this store (can be empty but never null).
-
getTargetTags
public Tags getTargetTags()
Gets the target tags for this store.- Returns:
- the target tags for this store (can be empty but never null).
-
calculateDataToIdsMap
public void calculateDataToIdsMap()
-
getTag
public Tag getTag(String id, TagType tagType)
Gets the tag for a given id and type (from the whole store).- Parameters:
id- the id to look for.tagType- the type of the tag to look for.- Returns:
- the tag if found, null if not found.
-
isIdUsedInTags
public boolean isIdUsedInTags(String id)
Indicates if a given id value is already used among the existing tags (not the full scope of a store).- Parameters:
id- the id to verify.- Returns:
- true if the given id is already used among the existing tags.
-
isIdUsed
public boolean isIdUsed(String id)
Indicates if a given id value is already in use in the object associated with this store (i.e. for aPartor for aTag).- Parameters:
id- the id value to lookup.- Returns:
- true if the value is already used, false otherwise.
-
getTag
public Tag getTag(String id)
Gets the tag object for a given id.This method does not look for
PCont.- Parameters:
id- the id to look for.- Returns:
- the
Tagobject for the given id, or null if not found.
-
suggestId
public String suggestId(boolean forSegment)
Gets a suggested id for code, annotation, ignorable or segment.- Parameters:
forSegment- true for a segment id, false for other elements.- Returns:
- a suggested id which does not exist in this unit.
-
getSourceDir
public Directionality getSourceDir()
Gets the source directionality for this store.- Returns:
- the source directionality for this store.
-
setSourceDir
public void setSourceDir(Directionality dir)
Sets the source directionality for this store.- Parameters:
dir- the new source directionality to set.
-
getTargetDir
public Directionality getTargetDir()
Gets the target directionality for this store.- Returns:
- the target directionality for this store.
-
setTargetDir
public void setTargetDir(Directionality dir)
Sets the target directionality for this store.- Parameters:
dir- the new target directionality to set.
-
getParent
public IWithStore getParent()
Gets the main object associated with this store.- Returns:
- the main object associated with this store.
-
-