Class 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 implementing IWithStore (e.g. a Unit).
    • Constructor Detail

      • Store

        public Store​(IWithStore parent)
        Creates a new store and associates it to a given parent object (e.g. a Unit or a Match).
        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()
      • setOutsideRepresentationMap

        public void setOutsideRepresentationMap​(Map<String,​String> map)
      • getOutsideRepresentationMap

        public Map<String,​String> getOutsideRepresentationMap()
      • getIdForData

        public String getIdForData​(CTag ctag)
      • 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).

        This method does not look for PCont or for IDs of Part.

        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 a Part or for a Tag).
        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 Tag object 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.