net.sf.okapi.common.filters

## Class PropertyTextUnitPlaceholder

- java.lang.Object
- - net.sf.okapi.common.filters.PropertyTextUnitPlaceholder

- All Implemented Interfaces:
    java.lang.Comparable<PropertyTextUnitPlaceholder>

      public class PropertyTextUnitPlaceholder
      extends java.lang.Object
      implements java.lang.Comparable<PropertyTextUnitPlaceholder>

  This class acts as a placeholder for both `Property`s and `ITextUnit`s that are found within tags. HTML and XML attributes are the canonical case. Along with the attribute name, value and type this class stores offset information for the name and value that can be used by the `AbstractFilter` to automatically generate proper attribute-based `IResource`s

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `PropertyTextUnitPlaceholder.PlaceholderAccessType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PropertyTextUnitPlaceholder(PropertyTextUnitPlaceholder.PlaceholderAccessType accessType, java.lang.String name, java.lang.String value)` Constructor for `Property` only.
    `PropertyTextUnitPlaceholder(PropertyTextUnitPlaceholder.PlaceholderAccessType accessType, java.lang.String name, java.lang.String value, int valueStartPos, int valueEndPos)` Constructor for `Property` and `ITextUnit` without a main offsets.
    `PropertyTextUnitPlaceholder(PropertyTextUnitPlaceholder.PlaceholderAccessType accessType, java.lang.String name, java.lang.String value, int mainStartPos, int mainEndPos, int valueStartPos, int valueEndPos)` Constructor for `Property` and `ITextUnit` that are delimited by formatting (i.e., name="value").

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(PropertyTextUnitPlaceholder aThat)` Compare two `PropertyTextUnitPlaceholder`s.
    `boolean` | `equals(java.lang.Object aThat)` Define equality of state.
    `PropertyTextUnitPlaceholder.PlaceholderAccessType` | `getAccessType()` Get the placeholder `PropertyTextUnitPlaceholder.PlaceholderAccessType`.
    `java.lang.String` | `getElementType()`
    `int` | `getMainEndPos()` Get the ending offset of the attribute
    `int` | `getMainStartPos()` Get the offset to the beginning of the attribute.
    `java.lang.String` | `getMimeType()` Get the attribute values mimetype
    `java.lang.String` | `getName()` Get the attribute name
    `java.lang.String` | `getValue()` Get the attribute value
    `int` | `getValueEndPos()` Get the ending offset of the attribute value
    `int` | `getValueStartPos()` Get the starting offset of the attribute value.
    `int` | `hashCode()` A class that overrides equals must also override hashCode. Return a hash code based on the MainStartPos only
    `void` | `setAccessType(PropertyTextUnitPlaceholder.PlaceholderAccessType accessType)` Set the `PropertyTextUnitPlaceholder.PlaceholderAccessType`
    `void` | `setElementType(java.lang.String elementType)`
    `void` | `setMainEndPos(int mainEndPos)` Set the ending offset of the attribute
    `void` | `setMainStartPos(int mainStartPos)` Set the offset to the beginning of the attribute.
    `void` | `setMimeType(java.lang.String mimeType)` Set the attribute values mimetype
    `void` | `setName(java.lang.String name)` Set the attribute name
    `void` | `setValue(java.lang.String value)` Set the attribute value
    `void` | `setValueEndPos(int valueEndPos)` Set the ending offset of the attribute value
    `void` | `setValueStartPos(int valueStartPos)` Set the starting offset of the attribute value.

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

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

- - ### Constructor Detail

    - #### PropertyTextUnitPlaceholder

          public PropertyTextUnitPlaceholder(PropertyTextUnitPlaceholder.PlaceholderAccessType accessType,
                                     java.lang.String name,
                                     java.lang.String value)

      Constructor for `Property` only. All offsets are the same, useful for creating placeholders for read-only `Property`s
      Parameters:
        `accessType` - a `PropertyTextUnitPlaceholder.PlaceholderAccessType`
        `name` - attribute name
        `value` - attribute value

    - #### PropertyTextUnitPlaceholder

          public PropertyTextUnitPlaceholder(PropertyTextUnitPlaceholder.PlaceholderAccessType accessType,
                                     java.lang.String name,
                                     java.lang.String value,
                                     int valueStartPos,
                                     int valueEndPos)

      Constructor for `Property` and `ITextUnit` without a main offsets. This is useful for cases where values are not delimited by any formatting
      Parameters:
        `accessType` - a `PropertyTextUnitPlaceholder.PlaceholderAccessType`
        `name` - attribute name
        `value` - attribute value
        `valueStartPos` - start offset of the value
        `valueEndPos` - ending offset of the value

    - #### PropertyTextUnitPlaceholder

          public PropertyTextUnitPlaceholder(PropertyTextUnitPlaceholder.PlaceholderAccessType accessType,
                                     java.lang.String name,
                                     java.lang.String value,
                                     int mainStartPos,
                                     int mainEndPos,
                                     int valueStartPos,
                                     int valueEndPos)

      Constructor for `Property` and `ITextUnit` that are delimited by formatting (i.e., name="value"). The offset 'n' in name is the mainStartPos, the offset 'v' in value is the valueStartPos.
      Parameters:
        `accessType` - a `PropertyTextUnitPlaceholder.PlaceholderAccessType`
        `name` - attribute name
        `value` - attribute value
        `mainStartPos` - start offset of the value delimiter
        `mainEndPos` - end offset of the entire attribute
        `valueStartPos` - start offset of the value
        `valueEndPos` - ending offset of the value

  - ### Method Detail

    - #### getAccessType

          public PropertyTextUnitPlaceholder.PlaceholderAccessType getAccessType()

      Get the placeholder `PropertyTextUnitPlaceholder.PlaceholderAccessType`.
      Returns:
        one of TRANSLATABLE, READ_ONLY_PROPERTY, WRITABLE_PROPERTY

    - #### setAccessType

          public void setAccessType(PropertyTextUnitPlaceholder.PlaceholderAccessType accessType)

      Set the `PropertyTextUnitPlaceholder.PlaceholderAccessType`
      Parameters:
        `accessType` - the type, one of TRANSLATABLE, READ_ONLY_PROPERTY, WRITABLE_PROPERTY

    - #### getMainStartPos

          public int getMainStartPos()

      Get the offset to the beginning of the attribute.
      Returns:
        offset as int

    - #### setMainStartPos

          public void setMainStartPos(int mainStartPos)

      Set the offset to the beginning of the attribute.
      Parameters:
        `mainStartPos` - the offset as integer

    - #### getMainEndPos

          public int getMainEndPos()

      Get the ending offset of the attribute
      Returns:
        offset as integer

    - #### setMainEndPos

          public void setMainEndPos(int mainEndPos)

      Set the ending offset of the attribute
      Parameters:
        `mainEndPos` - the ending offset as an integer

    - #### setName

          public void setName(java.lang.String name)

      Set the attribute name
      Parameters:
        `name` - the attribute name

    - #### getName

          public java.lang.String getName()

      Get the attribute name
      Returns:
        the attribute name

    - #### setValue

          public void setValue(java.lang.String value)

      Set the attribute value
      Parameters:
        `value` - the attribute value

    - #### getValue

          public java.lang.String getValue()

      Get the attribute value
      Returns:
        the attribute value

    - #### getValueStartPos

          public int getValueStartPos()

      Get the starting offset of the attribute value.
      Returns:
        the starting offset as int

    - #### setValueStartPos

          public void setValueStartPos(int valueStartPos)

      Set the starting offset of the attribute value.
      Parameters:
        `valueStartPos` - the start offset as int

    - #### getValueEndPos

          public int getValueEndPos()

      Get the ending offset of the attribute value
      Returns:
        the ending offset as int

    - #### setValueEndPos

          public void setValueEndPos(int valueEndPos)

      Set the ending offset of the attribute value
      Parameters:
        `valueEndPos` - the ending offset as int

    - #### setMimeType

          public void setMimeType(java.lang.String mimeType)

      Set the attribute values mimetype
      Parameters:
        `mimeType` - the mimeType to set

    - #### getMimeType

          public java.lang.String getMimeType()

      Get the attribute values mimetype
      Returns:
        the mimeType

    - #### setElementType

          public void setElementType(java.lang.String elementType)

    - #### getElementType

          public java.lang.String getElementType()

    - #### compareTo

          public int compareTo(PropertyTextUnitPlaceholder aThat)

      Compare two `PropertyTextUnitPlaceholder`s. Compare is based in MainStartPos order only. Allows sorting of many `PropertyTextUnitPlaceholder`s in the order they appear in the input
      Specified by:
        `compareTo` in interface `java.lang.Comparable<PropertyTextUnitPlaceholder>`
      Parameters:
        `aThat` - the `PropertyTextUnitPlaceholder` used to compare to this object

    - #### equals

          public boolean equals(java.lang.Object aThat)

      Define equality of state. Equality is based on the MainStartPos of the attribute.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `aThat` - the `PropertyTextUnitPlaceholder` that is compared to this object

    - #### hashCode

          public int hashCode()

      A class that overrides equals must also override hashCode. Return a hash code based on the MainStartPos only
      Overrides:
        `hashCode` in class `java.lang.Object`