net.sf.okapi.common.skeleton

## Class StorageList

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractList<E>
    - - java.util.ArrayList<IResource>
      - - net.sf.okapi.common.skeleton.StorageList

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<IResource>, java.util.Collection<IResource>, java.util.List<IResource>, java.util.RandomAccess, IResource, INameable, IReferenceable

      public class StorageList
      extends java.util.ArrayList<IResource>
      implements IResource, INameable, IReferenceable

  provides a way to store a list of resources and implements the different interfaces of the resources.

  This class is designed to be used with `GenericSkeletonWriter` and derived classes.

  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class java.util.AbstractList

      `modCount`

    - ### Fields inherited from interface net.sf.okapi.common.IResource

      `COPY_ALL, COPY_CONTENT, COPY_PROPERTIES, COPY_SEGMENTATION, COPY_SEGMENTED_CONTENT, CREATE_EMPTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StorageList(StartGroup startGroup)` Creates a new StorageList object with w StartGroup.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Property` | `createTargetProperty(LocaleId locId, java.lang.String name, boolean overwrite, int creationOptions)` Creates or get a target property based on the corresponding source.
    `<A extends IAnnotation> A` | `getAnnotation(java.lang.Class<A> annotationType)` Gets the annotation object for a given class for this resource.
    `java.lang.Iterable<IAnnotation>` | `getAnnotations()` Gets the iterable list of the annotations for this resource.
    `java.lang.String` | `getId()` Gets the identifier of the resource.
    `java.lang.String` | `getMimeType()` Gets the type of content of this resource.
    `java.lang.String` | `getName()` Gets the name of this resource.
    `Property` | `getProperty(java.lang.String name)` Gets the resource-level property for a given name.
    `java.util.Set<java.lang.String>` | `getPropertyNames()` Gets the names of all the resource-level properties for this resource.
    `int` | `getReferenceCount()` Gets the number of time this referent is referenced to.
    `ISkeleton` | `getSkeleton()` Gets the skeleton object for this resource.
    `Property` | `getSourceProperty(java.lang.String name)` Gets the source property for a given name.
    `java.util.Set<java.lang.String>` | `getSourcePropertyNames()` Gets the names of all the source properties for this resource.
    `StartGroup` | `getStartGroup()`
    `java.util.Set<LocaleId>` | `getTargetLocales()` Gets all the target locales for this resource.
    `Property` | `getTargetProperty(LocaleId language, java.lang.String name)` Gets the target property for a given name and target locale.
    `java.util.Set<java.lang.String>` | `getTargetPropertyNames(LocaleId language)` Gets the names of all the properties for a given target locale in this resource.
    `java.lang.String` | `getType()` Gets the type information associated with this resource.
    `boolean` | `hasProperty(java.lang.String name)` Indicates if a resource-level property exists for a given name.
    `boolean` | `hasSourceProperty(java.lang.String name)` Indicates if a source property exists for a given name.
    `boolean` | `hasTargetProperty(LocaleId language, java.lang.String name)` Indicates if a property exists for a given name and target locale.
    `boolean` | `isReferent()` Indicates if this resource is a referent (i.e.
    `boolean` | `isTranslatable()` Indicates if the content of this resource is translatable.
    `boolean` | `preserveWhitespaces()` Indicates if the white-spaces in the content of this resource should be preserved.
    `void` | `removeProperty(java.lang.String name)` Removes a resource-level property of a given name.
    `void` | `removeSourceProperty(java.lang.String name)` Removes a source property of a given name.
    `void` | `removeTargetProperty(LocaleId language, java.lang.String name)` Removes a target property of a given name.
    `void` | `setAnnotation(IAnnotation annotation)` Sets an annotation object for this resource.
    `void` | `setId(java.lang.String id)` Sets the identifier of this resource.
    `void` | `setIsReferent(boolean value)` Sets the flag indicating if this resource is a referent (i.e.
    `void` | `setIsTranslatable(boolean value)` Sets the flag indicating if the content of this resource is translatable.
    `void` | `setMimeType(java.lang.String value)` Sets the type of content of this resource.
    `void` | `setName(java.lang.String name)` Sets the name of this resource.
    `void` | `setPreserveWhitespaces(boolean value)` sets the flag indicating if the white-spaces in the content of this resource should be preserved.
    `Property` | `setProperty(Property property)` Sets a resource-level property.
    `void` | `setReferenceCount(int value)` Sets the number of time this referent is referenced to.
    `void` | `setSkeleton(ISkeleton skeleton)` Sets the skeleton object for this resource.
    `Property` | `setSourceProperty(Property property)` Sets a source property.
    `Property` | `setTargetProperty(LocaleId language, Property property)` Sets a target property.
    `void` | `setType(java.lang.String value)` Sets the type information associated with this resource.

    - ### Methods inherited from class java.util.ArrayList

      `add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, subList, toArray, toArray, trimToSize`

    - ### Methods inherited from class java.util.AbstractList

      `equals, hashCode`

    - ### Methods inherited from class java.util.AbstractCollection

      `containsAll, toString`

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

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.List

      `containsAll, equals, hashCode`

- - ### Constructor Detail

    - #### StorageList

          public StorageList(StartGroup startGroup)

      Creates a new StorageList object with w StartGroup.
      Parameters:
        `startGroup` - StartGroup to start with.

  - ### Method Detail

    - #### getId

          public java.lang.String getId()

      Description copied from interface: `IResource`
      Gets the identifier of the resource. This identifier is unique per extracted document and by type of resource. This value is filter-specific. It and may be different from one extraction of the same document to the next. It can a sequential number or not, incremental or not, and it can be not a number. It has no correspondence in the source document ("IDs" coming from the source document are "names" and not available for all resources).
      Specified by:
        `getId` in interface `IResource`
      Returns:
        the identifier of this resource.

    - #### setId

          public void setId(java.lang.String id)

      Description copied from interface: `IResource`
      Sets the identifier of this resource.
      Specified by:
        `setId` in interface `IResource`
      Parameters:
        `id` - the new identifier value.
      See Also:
        `IResource.getId()`

    - #### getSkeleton

          public ISkeleton getSkeleton()

      Description copied from interface: `IResource`
      Gets the skeleton object for this resource.
      Specified by:
        `getSkeleton` in interface `IResource`
      Returns:
        the skeleton object for this resource or null if there is none.

    - #### setSkeleton

          public void setSkeleton(ISkeleton skeleton)

      Description copied from interface: `IResource`
      Sets the skeleton object for this resource.
      Specified by:
        `setSkeleton` in interface `IResource`
      Parameters:
        `skeleton` - the skeleton object to set.

    - #### isReferent

          public boolean isReferent()

      Description copied from interface: `IReferenceable`
      Indicates if this resource is a referent (i.e. is referred to by another resource) or not.
      Specified by:
        `isReferent` in interface `IReferenceable`
      Returns:
        true if this resource is a referent, false if it is not.

    - #### setIsReferent

          public void setIsReferent(boolean value)

      Description copied from interface: `IReferenceable`
      Sets the flag indicating if this resource is a referent (i.e. is referred to by another resource) or not. This also sets the count of time this referent is referenced to 1.
      Specified by:
        `setIsReferent` in interface `IReferenceable`
      Parameters:
        `value` - true if the resource is a referent, false if it is not.

    - #### getReferenceCount

          public int getReferenceCount()

      Description copied from interface: `IReferenceable`
      Gets the number of time this referent is referenced to.
      Specified by:
        `getReferenceCount` in interface `IReferenceable`
      Returns:
        the number of time this referent is referenced to.

    - #### setReferenceCount

          public void setReferenceCount(int value)

      Description copied from interface: `IReferenceable`
      Sets the number of time this referent is referenced to.
      Specified by:
        `setReferenceCount` in interface `IReferenceable`
      Parameters:
        `value` - the number of time this referent is referenced to.

    - #### getName

          public java.lang.String getName()

      Description copied from interface: `INameable`
      Gets the name of this resource. The resource name corresponds to different things depending on the type of resource. For a StartDocument the name is the URI of the document. Otherwise, in most cases the name is the identifier of the resource (This is the equivalent of the XLIFF resname attribute).
      Specified by:
        `getName` in interface `INameable`
      Returns:
        This resource name, or null if there is none.

    - #### getProperty

          public Property getProperty(java.lang.String name)

      Description copied from interface: `INameable`
      Gets the resource-level property for a given name.
      Specified by:
        `getProperty` in interface `INameable`
      Parameters:
        `name` - Name of the property to retrieve.
      Returns:
        The property or null if it does not exist.

    - #### setName

          public void setName(java.lang.String name)

      Description copied from interface: `INameable`
      Sets the name of this resource. The resource name is the equivalent of the XLIFF resname attribute.
      Specified by:
        `setName` in interface `INameable`
      Parameters:
        `name` - New name to set.

    - #### setProperty

          public Property setProperty(Property property)

      Description copied from interface: `INameable`
      Sets a resource-level property. If a property already exists it is overwritten.
      Specified by:
        `setProperty` in interface `INameable`
      Parameters:
        `property` - The new property to set.
      Returns:
        The property that has been set.

    - #### getAnnotation

          public <A extends IAnnotation> A getAnnotation(java.lang.Class<A> annotationType)

      Description copied from interface: `IResource`
      Gets the annotation object for a given class for this resource.
      Specified by:
        `getAnnotation` in interface `IResource`
      Parameters:
        `annotationType` - the class of the annotation object to retrieve.
      Returns:
        the annotation for the given class for this resource.

    - #### setAnnotation

          public void setAnnotation(IAnnotation annotation)

      Description copied from interface: `IResource`
      Sets an annotation object for this resource.
      Specified by:
        `setAnnotation` in interface `IResource`
      Parameters:
        `annotation` - the annotation object to set.

    - #### createTargetProperty

          public Property createTargetProperty(LocaleId locId,
                                      java.lang.String name,
                                      boolean overwrite,
                                      int creationOptions)

      Description copied from interface: `INameable`
      Creates or get a target property based on the corresponding source.
      Specified by:
        `createTargetProperty` in interface `INameable`
      Parameters:
        `locId` - The target locale to use.
        `name` - The name of the property to create (or retrieve)
        `overwrite` - True to overwrite any existing property. False to not create a new property if one exists already.
        `creationOptions` - Creation options:
        - CREATE_EMPTY: Creates an empty property, only the read-only flag of the source is copied.
        - COPY_CONTENT: Creates a new property with all its data copied from the source.
      Returns:
        The property that was created, or retrieved.

    - #### setTargetProperty

          public Property setTargetProperty(LocaleId language,
                                   Property property)

      Description copied from interface: `INameable`
      Sets a target property. If a property already exists it is overwritten.
      Specified by:
        `setTargetProperty` in interface `INameable`
      Parameters:
        `language` - The target locale for which this property should be set.
        `property` - The new property to set. This name is case-sensitive.
      Returns:
        The property that has been set.

    - #### getTargetProperty

          public Property getTargetProperty(LocaleId language,
                                   java.lang.String name)

      Description copied from interface: `INameable`
      Gets the target property for a given name and target locale.
      Specified by:
        `getTargetProperty` in interface `INameable`
      Parameters:
        `language` - the locale of the property to retrieve.
        `name` - The name of the property to retrieve. This name is case-sensitive.
      Returns:
        The property or null if it does not exist.

    - #### hasTargetProperty

          public boolean hasTargetProperty(LocaleId language,
                                  java.lang.String name)

      Description copied from interface: `INameable`
      Indicates if a property exists for a given name and target locale.
      Specified by:
        `hasTargetProperty` in interface `INameable`
      Parameters:
        `language` - the target locale to query.
        `name` - the name of the property to query.
      Returns:
        true if a property exists, false otherwise.

    - #### getPropertyNames

          public java.util.Set<java.lang.String> getPropertyNames()

      Description copied from interface: `INameable`
      Gets the names of all the resource-level properties for this resource.
      Specified by:
        `getPropertyNames` in interface `INameable`
      Returns:
        All the names of the resource-level properties for this resource.

    - #### getTargetPropertyNames

          public java.util.Set<java.lang.String> getTargetPropertyNames(LocaleId language)

      Description copied from interface: `INameable`
      Gets the names of all the properties for a given target locale in this resource.
      Specified by:
        `getTargetPropertyNames` in interface `INameable`
      Parameters:
        `language` - the target locale to query.
      Returns:
        all the names of the target properties for the given locale in this resource.

    - #### getSourceProperty

          public Property getSourceProperty(java.lang.String name)

      Description copied from interface: `INameable`
      Gets the source property for a given name.
      Specified by:
        `getSourceProperty` in interface `INameable`
      Parameters:
        `name` - The name of the source property to retrieve.
      Returns:
        The property or null if it does not exist.

    - #### getSourcePropertyNames

          public java.util.Set<java.lang.String> getSourcePropertyNames()

      Description copied from interface: `INameable`
      Gets the names of all the source properties for this resource.
      Specified by:
        `getSourcePropertyNames` in interface `INameable`
      Returns:
        All the names of the source properties for this resource.

    - #### getTargetLocales

          public java.util.Set<LocaleId> getTargetLocales()

      Description copied from interface: `INameable`
      Gets all the target locales for this resource.
      Specified by:
        `getTargetLocales` in interface `INameable`
      Returns:
        all the target locales for this resource.

    - #### setSourceProperty

          public Property setSourceProperty(Property property)

      Description copied from interface: `INameable`
      Sets a source property. If a property already exists it is overwritten.
      Specified by:
        `setSourceProperty` in interface `INameable`
      Parameters:
        `property` - The new property to set.
      Returns:
        The property that has been set.

    - #### isTranslatable

          public boolean isTranslatable()

      Description copied from interface: `INameable`
      Indicates if the content of this resource is translatable. By default this indicator is set to true for all resources.
      Specified by:
        `isTranslatable` in interface `INameable`
      Returns:
        True if the content of this resource is translatable. False if it is not translatable.

    - #### setIsTranslatable

          public void setIsTranslatable(boolean value)

      Description copied from interface: `INameable`
      Sets the flag indicating if the content of this resource is translatable.
      Specified by:
        `setIsTranslatable` in interface `INameable`
      Parameters:
        `value` - True to indicate that the content of this resource is translatable.

    - #### getType

          public java.lang.String getType()

      Description copied from interface: `INameable`
      Gets the type information associated with this resource. For example "button".
      Specified by:
        `getType` in interface `INameable`
      Returns:
        The type information associated with this resource.

    - #### setType

          public void setType(java.lang.String value)

      Description copied from interface: `INameable`
      Sets the type information associated with this resource. For example "button".
      Specified by:
        `setType` in interface `INameable`
      Parameters:
        `value` - The new type information.

    - #### preserveWhitespaces

          public boolean preserveWhitespaces()

      Description copied from interface: `INameable`
      Indicates if the white-spaces in the content of this resource should be preserved. By default this indicator is set to false for all resources.
      Specified by:
        `preserveWhitespaces` in interface `INameable`
      Returns:
        True if the white-spaces in the content of this resource should be preserved.

    - #### setPreserveWhitespaces

          public void setPreserveWhitespaces(boolean value)

      Description copied from interface: `INameable`
      sets the flag indicating if the white-spaces in the content of this resource should be preserved.
      Specified by:
        `setPreserveWhitespaces` in interface `INameable`
      Parameters:
        `value` - True to indicate that the white-spaces in the content of this resource should be preserved.

    - #### getMimeType

          public java.lang.String getMimeType()

      Description copied from interface: `INameable`
      Gets the type of content of this resource. For example "text/xml".
      Specified by:
        `getMimeType` in interface `INameable`
      Returns:
        The type of content of this resource.

    - #### setMimeType

          public void setMimeType(java.lang.String value)

      Description copied from interface: `INameable`
      Sets the type of content of this resource. For example "text/xml".
      Specified by:
        `setMimeType` in interface `INameable`
      Parameters:
        `value` - The new type of content of this resource.

    - #### hasProperty

          public boolean hasProperty(java.lang.String name)

      Description copied from interface: `INameable`
      Indicates if a resource-level property exists for a given name.
      Specified by:
        `hasProperty` in interface `INameable`
      Parameters:
        `name` - The name of the resource-level property to query.
      Returns:
        True if a resource-level property exists, false otherwise.

    - #### hasSourceProperty

          public boolean hasSourceProperty(java.lang.String name)

      Description copied from interface: `INameable`
      Indicates if a source property exists for a given name.
      Specified by:
        `hasSourceProperty` in interface `INameable`
      Parameters:
        `name` - The name of the source property to query.
      Returns:
        True if a source property exists, false otherwise.

    - #### removeProperty

          public void removeProperty(java.lang.String name)

      Description copied from interface: `INameable`
      Removes a resource-level property of a given name. If the property does not exists nothing happens.
      Specified by:
        `removeProperty` in interface `INameable`
      Parameters:
        `name` - The name of the property to remove.

    - #### removeSourceProperty

          public void removeSourceProperty(java.lang.String name)

      Description copied from interface: `INameable`
      Removes a source property of a given name. If the property does not exists nothing happens.
      Specified by:
        `removeSourceProperty` in interface `INameable`
      Parameters:
        `name` - The name of the property to remove.

    - #### removeTargetProperty

          public void removeTargetProperty(LocaleId language,
                                  java.lang.String name)

      Description copied from interface: `INameable`
      Removes a target property of a given name. If the property does not exists nothing happens.
      Specified by:
        `removeTargetProperty` in interface `INameable`
      Parameters:
        `language` - The target locale for which this property should be set.
        `name` - The name of the property to remove.

    - #### getAnnotations

          public java.lang.Iterable<IAnnotation> getAnnotations()

      Description copied from interface: `IResource`
      Gets the iterable list of the annotations for this resource.
      Specified by:
        `getAnnotations` in interface `IResource`
      Returns:
        the iterable list of the annotations for this resource.

    - #### getStartGroup

          public StartGroup getStartGroup()