net.sf.okapi.lib.xliff2.core

## Class Store

- java.lang.Object
- - net.sf.okapi.lib.xliff2.core.Store

-     public class Store
      extends java.lang.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 Summary

    Constructors
    Constructor and Description
    `Store(IWithStore parent)` Creates a new store and associates it to a given parent object (e.g.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `calculateDataToIdsMap()`
    `java.lang.String` | `getIdForData(CTag ctag)`
    `java.util.Map<java.lang.String,java.lang.String>` | `getOutsideRepresentationMap()`
    `IWithStore` | `getParent()` Gets the main object associated with this store.
    `Directionality` | `getSourceDir()` Gets the source directionality for this store.
    `Tags` | `getSourceTags()` Gets the source tags for this store.
    `Tag` | `getTag(java.lang.String id)` Gets the tag object for a given id.
    `Tag` | `getTag(java.lang.String id, TagType tagType)` Gets the tag for a given id and type (from the whole store).
    `Directionality` | `getTargetDir()` Gets the target directionality for this store.
    `Tags` | `getTargetTags()` Gets the target tags for this store.
    `boolean` | `hasCTagWithData()` Indicates if there is at least one code with original data in this store.
    `boolean` | `hasSourceTag()` Indicates if there is at least one tag (for code or marker) in the source content for this store.
    `boolean` | `hasTargetTag()` Indicates if there is at least one tag (for code or marker) in the target content for this store.
    `boolean` | `isIdUsed(java.lang.String id)` Indicates if a given id value is already in use in the object associated with this store (i.e.
    `boolean` | `isIdUsedInTags(java.lang.String id)` Indicates if a given id value is already used among the existing tags (not the full scope of a store).
    `void` | `setOutsideRepresentationMap(java.util.Map<java.lang.String,java.lang.String> map)`
    `void` | `setSourceDir(Directionality dir)` Sets the source directionality for this store.
    `void` | `setTargetDir(Directionality dir)` Sets the target directionality for this store.
    `java.lang.String` | `suggestId(boolean forSegment)` Gets a suggested id for code, annotation, ignorable or segment.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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(java.util.Map<java.lang.String,java.lang.String> map)

    - #### getOutsideRepresentationMap

          public java.util.Map<java.lang.String,java.lang.String> getOutsideRepresentationMap()

    - #### getIdForData

          public java.lang.String getIdForData(CTag ctag)

    - #### getTag

          public Tag getTag(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.lang.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.