Tag (API documentation of hlt.language packages)
Date: 2013-01-30

hlt.osf.base

## Class Tag

- java.lang.Object
- - hlt.osf.base.Tag

-     public class Tag
      extends java.lang.Object

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Tag` | `bind(Tag value)` This binds this tag to the specified one and returns this tag.
    `static void` | `clearKnownTags()` Resets the know tags and the tag numbering.
    `Tag` | `deref()` Ths returns the ultimate tag this is bound to; i.e., its binding's binding's ...
    `static Tag` | `getTag(java.lang.String name)` This static method returns the tag uniquely identified with the given name.
    `int` | `hashCode()`
    `boolean` | `isBound()` Returns `true` iff this tag is bound.
    `boolean` | `isFree()` Returns `true` iff this tag is free - i.e. it does not belong to any ψ-term (although it may be bound to one that is not free).
    `boolean` | `isShared()` Returns `true` iff this tag occurs more than once in a ψ-term.
    `boolean` | `isUnbound()` Returns `true` iff this tag is unbound.
    `Tag` | `markAsShared()` Mark this tag as shared (i.e., reoccurring at distinct positions) and returns this tag.
    `java.lang.String` | `name()` Returns the name of this tag.
    `static java.lang.String` | `newTagName()` Returns a newly generated tag name.
    `Tag` | `ref()` This returns the immediate tag this is bound to.
    `Tag` | `setAsShared(boolean shared)` Set the shared mark of this tag to the specified boolean value and returns this tag.
    `Tag` | `setName(java.lang.String name)` This gives the specified name to this his tag and returns this tag.
    `Tag` | `setTerm(PsiTerm term)` Set this tag's term to the specified ψ-term, and returns this tag.
    `PsiTerm` | `term()` Returns the ψ-term to which this tag belongs if it is not free, or `null` otherwise.
    `java.lang.String` | `toString()` Return a string value for this tag, which is its name.

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

      `equals, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### newTagName

          public static java.lang.String newTagName()

      Returns a newly generated tag name. Generated tags are of the form `#_n`, where `n` is an integer, Since it could be possible that such a tag name may have be already specified as an explicitly named tag, care must be taken not to return such an already recorded tag.

    - #### clearKnownTags

          public static void clearKnownTags()

      Resets the know tags and the tag numbering.

    - #### getTag

          public static Tag getTag(java.lang.String name)

      This static method returns the tag uniquely identified with the given name. If the given name is null, a new tag is created and a newly generated name associated to it. Therefore, this class has no public constructor: the only way to access or make a tag is by invoking the method `Tag.getTag(String name)`.

    - #### ref

          public Tag ref()

      This returns the immediate tag this is bound to.

    - #### deref

          public Tag deref()

      Ths returns the ultimate tag this is bound to; i.e., its binding's binding's ... binding. This is the most important method for a tag as its real identity is always that of its dereferenced tag (which may be itself if it is unbound).

    - #### bind

          public Tag bind(Tag value)

      This binds this tag to the specified one and returns this tag. Binding also propagates sharing information between the two tags.

    - #### isBound

          public boolean isBound()

      Returns `true` iff this tag is bound.

    - #### isUnbound

          public boolean isUnbound()

      Returns `true` iff this tag is unbound.

    - #### isShared

          public boolean isShared()

      Returns `true` iff this tag occurs more than once in a ψ-term.

    - #### setAsShared

          public Tag setAsShared(boolean shared)

      Set the shared mark of this tag to the specified boolean value and returns this tag.

    - #### markAsShared

          public Tag markAsShared()

      Mark this tag as shared (i.e., reoccurring at distinct positions) and returns this tag.

    - #### term

          public PsiTerm term()

      Returns the ψ-term to which this tag belongs if it is not free, or `null` otherwise.

    - #### setTerm

          public Tag setTerm(PsiTerm term)

      Set this tag's term to the specified ψ-term, and returns this tag.

    - #### isFree

          public boolean isFree()

      Returns `true` iff this tag is free - i.e. it does not belong to any ψ-term (although it may be bound to one that is not free).

    - #### name

          public java.lang.String name()

      Returns the name of this tag.

    - #### setName

          public Tag setName(java.lang.String name)

      This gives the specified name to this his tag and returns this tag. If the specified String does not start with a '#', one will be prepended. Note, because equality of tags is object equality, giving an explicit name to a tag may mean that if another tag bears the same name, it will still be a distinct tag. For explicitly named tags, it is therefore recommended to use a global name manager ensuring unique names for all tags.

    - #### toString

          public java.lang.String toString()

      Return a string value for this tag, which is its name.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`